Continuing updating the reformatting of propTypes and set redux, intl functions to end of component

• Removing:
- the reformatting of propTypes and set redux, intl functions to end of component
This commit is contained in:
mgabdev
2020-08-17 19:57:35 -05:00
parent 46a0cbca7d
commit ddca693cfc
101 changed files with 2053 additions and 2140 deletions

View File

@@ -11,42 +11,8 @@ const updateOnPropsForRendered = ['id', 'index', 'listLength']
// Diff these props in the "unrendered" state
const updateOnPropsForUnrendered = ['id', 'index', 'listLength', 'cachedHeight']
const makeMapStateToProps = (state, props) => ({
cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]),
})
const mapDispatchToProps = (dispatch) => ({
onHeightChange(key, id, height) {
dispatch(setHeight(key, id, height))
},
})
export default
@connect(makeMapStateToProps, mapDispatchToProps)
class IntersectionObserverArticle extends React.Component {
static propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired,
id: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
index: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
listLength: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
saveHeightKey: PropTypes.string,
cachedHeight: PropTypes.number,
onHeightChange: PropTypes.func,
children: PropTypes.node,
}
state = {
isIntersecting: false,
isHidden: false,
@@ -165,3 +131,37 @@ class IntersectionObserverArticle extends React.Component {
}
}
const makeMapStateToProps = (state, props) => ({
cachedHeight: state.getIn(['height_cache', props.saveHeightKey, props.id]),
})
const mapDispatchToProps = (dispatch) => ({
onHeightChange(key, id, height) {
dispatch(setHeight(key, id, height))
},
})
IntersectionObserverArticle.propTypes = {
intersectionObserverWrapper: PropTypes.object.isRequired,
id: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
index: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
listLength: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]),
saveHeightKey: PropTypes.string,
cachedHeight: PropTypes.number,
onHeightChange: PropTypes.func,
children: PropTypes.node,
}
export default connect(makeMapStateToProps, mapDispatchToProps)(IntersectionObserverArticle)