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
1 changed files with 12 additions and 10 deletions

View File

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