Skip to content

Commit

Permalink
Native propTypes RCTDatePickerIOS !== propTypes DatePickerIOS
Browse files Browse the repository at this point in the history
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 #7833

Differential Revision: D3371324

Pulled By: nicklockwood

fbshipit-source-id: bca5b2bbe7e9dd2e045288bfbd268578848c7bff
  • Loading branch information
dejakob authored and Facebook Github Bot 6 committed Jun 1, 2016
1 parent 0cc0aae commit cec913e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions Libraries/Components/DatePicker/DatePickerIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/verifyPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down

0 comments on commit cec913e

Please sign in to comment.