-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removed defaultprops from DatePickerIOS #31619
Conversation
Base commit: cb610dd |
@@ -117,10 +117,6 @@ type Props = $ReadOnly<{| | |||
* source of truth. | |||
*/ | |||
class DatePickerIOS extends React.Component<Props> { | |||
static DefaultProps: {|mode: $TEMPORARY$string<'datetime'>|} = { | |||
mode: 'datetime', | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to set the default value of this prop. So for every access of props.mode
, if no value is set it still needs to be datetime
-- the thing we want to remove is depending on defaultProps
static type as a construct used in React.
You can take a look at destructuring with a default value here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, can you add a snapshot test that ensures the default value is used? You can take a look at an example component snapshot test from VirtualizedList-test.js
: https://github.com/facebook/react-native/blob/dc80b2dcb52fadec6a573a9dd1824393f8c29fdc/Libraries/Lists/__tests__/VirtualizedList-test.js
Base commit: cb610dd |
Summary
Removed defaultProps from DatePickeriOS #31605 .
Changelog
[iOS] [Removed] - Removed defaultProps from DatePickerIOS.ios.js
Test Plan
Build & render DatePickeriOS on RNTester app successfully.