From 015b5cf8e5123d4f6685058919bd177a3a169acb Mon Sep 17 00:00:00 2001 From: Alex Madjar Date: Wed, 3 Jun 2015 17:47:24 -0700 Subject: [PATCH] [React Native] PickerIOS can update its items list Summary: @public PickerIOS doesn't look at the content of its list. It just keeps a list ref and pushes new items in. Sadly this doesn't work with the naive reference checker so new item lists don't trigger a native rerender. The solution here is to ask PickerIOS to just pass its props down to native directly Test Plan: Implemented a simple Picker hooked up to a store getting new items. Watched the list not update and then update after this diff as new items come in --- Libraries/Picker/PickerIOS.ios.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Libraries/Picker/PickerIOS.ios.js b/Libraries/Picker/PickerIOS.ios.js index b2c3c3927..b1b1d06f4 100644 --- a/Libraries/Picker/PickerIOS.ios.js +++ b/Libraries/Picker/PickerIOS.ios.js @@ -20,8 +20,7 @@ var RCTPickerIOSConsts = require('NativeModules').UIManager.RCTPicker.Constants; var StyleSheet = require('StyleSheet'); var View = require('View'); -var createReactNativeComponentClass = - require('createReactNativeComponentClass'); +var requireNativeComponent = require('requireNativeComponent'); var merge = require('merge'); var PICKER = 'picker'; @@ -112,14 +111,6 @@ var styles = StyleSheet.create({ }, }); -var rkPickerIOSAttributes = merge(ReactNativeViewAttributes.UIView, { - items: true, - selectedIndex: true, -}); - -var RCTPickerIOS = createReactNativeComponentClass({ - validAttributes: rkPickerIOSAttributes, - uiViewClassName: 'RCTPicker', -}); +var RCTPickerIOS = requireNativeComponent('RCTPicker', null); module.exports = PickerIOS;