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
This commit is contained in:
Jakob Kerkhove 2016-06-01 08:44:03 -07:00 committed by Facebook Github Bot 6
parent 0cc0aaecbb
commit cec913e7ce
2 changed files with 10 additions and 3 deletions

View File

@ -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;

View File

@ -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.';