2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-23 22:07:33 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-01-30 01:10:49 +00:00
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2015-03-25 22:36:50 +00:00
|
|
|
* @flow
|
2015-01-30 01:10:49 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
|
2015-01-30 01:10:49 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-03-03 23:04:46 +00:00
|
|
|
const React = require('React');
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2018-03-03 23:04:46 +00:00
|
|
|
const PropTypes = require('prop-types');
|
2017-04-12 23:09:48 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class StaticRenderer extends React.Component<{
|
|
|
|
shouldUpdate: boolean,
|
|
|
|
render: Function,
|
|
|
|
}> {
|
2016-07-26 08:00:02 +00:00
|
|
|
static propTypes = {
|
2017-04-12 23:09:48 +00:00
|
|
|
shouldUpdate: PropTypes.bool.isRequired,
|
|
|
|
render: PropTypes.func.isRequired,
|
2016-07-26 08:00:02 +00:00
|
|
|
};
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2018-05-11 02:06:46 +00:00
|
|
|
shouldComponentUpdate(nextProps: {shouldUpdate: boolean}): boolean {
|
2015-01-30 01:10:49 +00:00
|
|
|
return nextProps.shouldUpdate;
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
render(): React.Node {
|
2015-01-30 01:10:49 +00:00
|
|
|
return this.props.render();
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-30 01:10:49 +00:00
|
|
|
|
|
|
|
module.exports = StaticRenderer;
|