StaticRenderer: Removed prop types (#21348)

Summary:
related #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: https://github.com/facebook/react-native/pull/21348

Differential Revision: D10084990

Pulled By: TheSavior

fbshipit-source-id: a87a8d4976c6ffaf83dc0fddc758869dbc2e2803
This commit is contained in:
Richard Cann
2018-09-27 11:11:49 -07:00
committed by Facebook Github Bot
parent f68b0c9d79
commit 236bb018ab

View File

@@ -12,18 +12,20 @@
const React = require('React'); const React = require('React');
const PropTypes = require('prop-types'); type Props = $ReadOnly<{|
/**
class StaticRenderer extends React.Component<{ * Indicates whether the render function needs to be called again
*/
shouldUpdate: boolean, shouldUpdate: boolean,
render: Function, /**
}> { * () => renderable
static propTypes = { * A function that returns a renderable component
shouldUpdate: PropTypes.bool.isRequired, */
render: PropTypes.func.isRequired, render: () => React.Node,
}; |}>;
shouldComponentUpdate(nextProps: {shouldUpdate: boolean}): boolean { class StaticRenderer extends React.Component<Props> {
shouldComponentUpdate(nextProps: Props): boolean {
return nextProps.shouldUpdate; return nextProps.shouldUpdate;
} }