2015-01-29 17:10:49 -08:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-23 15:07:33 -07:00
|
|
|
*
|
2018-02-16 18:24:55 -08: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-29 17:10:49 -08:00
|
|
|
*
|
2018-05-10 19:06:46 -07:00
|
|
|
* @format
|
2015-03-25 15:36:50 -07:00
|
|
|
* @flow
|
2015-01-29 17:10:49 -08:00
|
|
|
*/
|
2018-05-10 19:06:46 -07:00
|
|
|
|
2015-01-29 17:10:49 -08:00
|
|
|
'use strict';
|
|
|
|
|
2018-03-03 15:04:46 -08:00
|
|
|
const React = require('React');
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2018-03-03 15:04:46 -08:00
|
|
|
const PropTypes = require('prop-types');
|
2017-04-12 16:09:48 -07:00
|
|
|
|
2017-08-17 18:36:54 -07:00
|
|
|
class StaticRenderer extends React.Component<{
|
|
|
|
shouldUpdate: boolean,
|
|
|
|
render: Function,
|
|
|
|
}> {
|
2016-07-26 01:00:02 -07:00
|
|
|
static propTypes = {
|
2017-04-12 16:09:48 -07:00
|
|
|
shouldUpdate: PropTypes.bool.isRequired,
|
|
|
|
render: PropTypes.func.isRequired,
|
2016-07-26 01:00:02 -07:00
|
|
|
};
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2018-05-10 19:06:46 -07:00
|
|
|
shouldComponentUpdate(nextProps: {shouldUpdate: boolean}): boolean {
|
2015-01-29 17:10:49 -08:00
|
|
|
return nextProps.shouldUpdate;
|
2016-07-26 01:00:02 -07:00
|
|
|
}
|
2015-01-29 17:10:49 -08:00
|
|
|
|
2017-08-17 18:36:54 -07:00
|
|
|
render(): React.Node {
|
2015-01-29 17:10:49 -08:00
|
|
|
return this.props.render();
|
2016-07-26 01:00:02 -07:00
|
|
|
}
|
|
|
|
}
|
2015-01-29 17:10:49 -08:00
|
|
|
|
|
|
|
module.exports = StaticRenderer;
|