From cec913e7ce05d26181ab4d46e2e41d72acdfb87d Mon Sep 17 00:00:00 2001 From: Jakob Kerkhove Date: Wed, 1 Jun 2016 08:44:03 -0700 Subject: [PATCH] Native propTypes RCTDatePickerIOS !== propTypes DatePickerIOS Summary: The propTypes of RCTDatePickerIOS do not fit with the propTypes of DatePickerIOS. All dates (date, minimumDate, maximumDate) are a timestamp (check line 126), so they should have propType number. OnDateChange function should not be required since it is called onChange in the iOS implementation. The problem currently causes warnings that the given types are wrong, while they were added correctly. Closes https://github.com/facebook/react-native/pull/7833 Differential Revision: D3371324 Pulled By: nicklockwood fbshipit-source-id: bca5b2bbe7e9dd2e045288bfbd268578848c7bff --- Libraries/Components/DatePicker/DatePickerIOS.ios.js | 11 +++++++++-- Libraries/ReactIOS/verifyPropTypes.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index 60382cc4a74..00ff474590d 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -145,8 +145,15 @@ const styles = StyleSheet.create({ }, }); -var RCTDatePickerIOS = requireNativeComponent('RCTDatePicker', DatePickerIOS, { - nativeOnly: { onChange: true }, +const RCTDatePickerIOS = requireNativeComponent('RCTDatePicker', { + propTypes: { + ...DatePickerIOS.propTypes, + date: PropTypes.number, + minimumDate: PropTypes.number, + maximumDate: PropTypes.number, + onDateChange: () => null, + onChange: PropTypes.func, + } }); module.exports = DatePickerIOS; diff --git a/Libraries/ReactIOS/verifyPropTypes.js b/Libraries/ReactIOS/verifyPropTypes.js index d284d60ec0a..b93f4afc659 100644 --- a/Libraries/ReactIOS/verifyPropTypes.js +++ b/Libraries/ReactIOS/verifyPropTypes.js @@ -49,7 +49,7 @@ function verifyPropTypes( message = '`' + componentName + '` has no propType for native prop `' + viewConfig.uiViewClassName + '.' + prop + '` of native type `' + nativeProps[prop] + '`'; - }; + } message += '\nIf you haven\'t changed this prop yourself, this usually means that ' + 'your versions of the native code and JavaScript code are out of sync. Updating both ' + 'should make this error go away.';