Skip to content

Commit 236bb01

Browse files
richardcannfacebook-github-bot
authored andcommitted
StaticRenderer: Removed prop types (facebook#21348)
Summary: related facebook#21342 The `render` function, I was not able to specifically type since the props passed to it may vary. At the moment only `renderRow` function from ListView component is using StaticRenderer, and the type of the renderRow function is `Function`. Let me know what your thoughts are on this. Thank you Pull Request resolved: facebook#21348 Differential Revision: D10084990 Pulled By: TheSavior fbshipit-source-id: a87a8d4976c6ffaf83dc0fddc758869dbc2e2803
1 parent f68b0c9 commit 236bb01

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Libraries/Components/StaticRenderer.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@
1212

1313
const React = require('React');
1414

15-
const PropTypes = require('prop-types');
16-
17-
class StaticRenderer extends React.Component<{
15+
type Props = $ReadOnly<{|
16+
/**
17+
* Indicates whether the render function needs to be called again
18+
*/
1819
shouldUpdate: boolean,
19-
render: Function,
20-
}> {
21-
static propTypes = {
22-
shouldUpdate: PropTypes.bool.isRequired,
23-
render: PropTypes.func.isRequired,
24-
};
20+
/**
21+
* () => renderable
22+
* A function that returns a renderable component
23+
*/
24+
render: () => React.Node,
25+
|}>;
2526

26-
shouldComponentUpdate(nextProps: {shouldUpdate: boolean}): boolean {
27+
class StaticRenderer extends React.Component<Props> {
28+
shouldComponentUpdate(nextProps: Props): boolean {
2729
return nextProps.shouldUpdate;
2830
}
2931

0 commit comments

Comments
 (0)