Skip to content

Commit

Permalink
Flow strict StaticContainer (#22121)
Browse files Browse the repository at this point in the history
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: #22121

Differential Revision: D12929646

Pulled By: TheSavior

fbshipit-source-id: 8826aa7bc83c854efdd71cdb4fba3d7ca98f2fce
  • Loading branch information
exced authored and facebook-github-bot committed Nov 5, 2018
1 parent 0d4f627 commit 6476151
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Libraries/Components/StaticContainer.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
* @flow strict-local
*/

'use strict';
Expand All @@ -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;
}

Expand Down

0 comments on commit 6476151

Please sign in to comment.