mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 02:54:42 +00:00
2b6599e9c8
Summary: Description: ------------ While creating a custom component I added a prop `style: ?ViewStyleProp`. When I tried to pass the following object ``` style={{ opacity: new Animated.Value(0), }} ``` to this `style` prop I received a yellow box with the warning: ``` Warning: Failed prop type: Invalid prop `opacity` of type `object` supplied to `MyComponent`, expected `number`. ``` Then I browsed through the source code and found an inconsistency in types checks. Namely, https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/StyleSheetTypes.js#L158 has the following declaration `opacity?: number | AnimatedNode`, whereas https://github.com/facebook/react-native/blob/master/Libraries/Components/View/ViewStylePropTypes.js#L50 is willing to accept **only** a `number`: `opacity: ReactPropTypes.number`. Pull Request resolved: https://github.com/facebook/react-native/pull/20773 Differential Revision: D9464634 Pulled By: TheSavior fbshipit-source-id: fa21f706cb890dbeec136f1c4fab468904cd284b