Flow strict StaticContainer (#22121)
Summary: Related to #22100 Turn on Flow strict mode for StaticContainer.react This component needed proper Props type definition. I went through the only component (`TabBarItemIOS.ios`) using this to try to know the most appropriate props. - All flow tests succeed. [GENERAL] [ENHANCEMENT] [StaticContainer.react.js] - Flow strict mode Pull Request resolved: https://github.com/facebook/react-native/pull/22121 Differential Revision: D12929646 Pulled By: TheSavior fbshipit-source-id: 8826aa7bc83c854efdd71cdb4fba3d7ca98f2fce
This commit is contained in:
parent
0d4f627f42
commit
6476151717
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
@ -27,8 +27,19 @@ const React = require('React');
|
|||
* Typically, you will not need to use this component and should opt for normal
|
||||
* React reconciliation.
|
||||
*/
|
||||
class StaticContainer extends React.Component<Object> {
|
||||
shouldComponentUpdate(nextProps: Object): boolean {
|
||||
|
||||
type Props = $ReadOnly<{|
|
||||
/**
|
||||
* Whether or not this component should update.
|
||||
*/
|
||||
shouldUpdate: ?boolean,
|
||||
/**
|
||||
* Content short-circuited by React reconciliation process.
|
||||
*/
|
||||
children: React.Node,
|
||||
|}>;
|
||||
class StaticContainer extends React.Component<Props> {
|
||||
shouldComponentUpdate(nextProps: Props): boolean {
|
||||
return !!nextProps.shouldUpdate;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue