From fc587c9e9801c307c494af2e53a47cb6ed9f72fd Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Wed, 9 Jun 2021 10:33:32 -0700 Subject: [PATCH] Back out "Back out "[react-native][PR] remove defaultProps from picker of components"" Summary: Changelog: [Internal] - Remove defaultProps from Picker Reviewed By: TheSavior Differential Revision: D28941586 fbshipit-source-id: ca9efef597936badfd5c2920028ebd11dc7422a0 --- Libraries/Components/Picker/Picker.js | 12 ++++++------ .../__tests__/__snapshots__/Picker-test.js.snap | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Libraries/Components/Picker/Picker.js b/Libraries/Components/Picker/Picker.js index bb5416b45e6..7c411f4741e 100644 --- a/Libraries/Components/Picker/Picker.js +++ b/Libraries/Components/Picker/Picker.js @@ -166,24 +166,24 @@ class Picker extends React.Component { static Item: typeof PickerItem = PickerItem; - static defaultProps: {|mode: $TEMPORARY$string<'dialog'>|} = { - mode: MODE_DIALOG, - }; - render(): React.Node { + const {mode = MODE_DIALOG, children, ...rest} = this.props; + if (Platform.OS === 'ios') { /* $FlowFixMe[prop-missing] (>=0.81.0 site=react_native_ios_fb) This * suppression was added when renaming suppression sites. */ /* $FlowFixMe[incompatible-type] (>=0.81.0 site=react_native_ios_fb) This * suppression was added when renaming suppression sites. */ - return {this.props.children}; + return {children}; } else if (Platform.OS === 'android') { return ( /* $FlowFixMe[incompatible-type] (>=0.81.0 site=react_native_android_fb) This * suppression was added when renaming suppression sites. */ /* $FlowFixMe[prop-missing] (>=0.81.0 site=react_native_android_fb) This * suppression was added when renaming suppression sites. */ - {this.props.children} + + {children} + ); } else { return ; diff --git a/Libraries/Components/Picker/__tests__/__snapshots__/Picker-test.js.snap b/Libraries/Components/Picker/__tests__/__snapshots__/Picker-test.js.snap index 32c40aa992d..af39b089a30 100644 --- a/Libraries/Components/Picker/__tests__/__snapshots__/Picker-test.js.snap +++ b/Libraries/Components/Picker/__tests__/__snapshots__/Picker-test.js.snap @@ -64,7 +64,6 @@ exports[` should render as expected: should deep render when not mocke exports[` should render as expected: should shallow render as when mocked 1`] = ` @@ -81,7 +80,6 @@ exports[` should render as expected: should shallow render as should render as expected: should shallow render as when not mocked 1`] = `