Skip to content

Commit 7e050c3

Browse files
committed
Update dependencies
Prepare for React 16.3 by removing componentWillUpdate usage
1 parent 9d5625b commit 7e050c3

File tree

3 files changed

+1729
-514
lines changed

3 files changed

+1729
-514
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,29 @@
6262
"react": "^15.0.0 || ^16.0.0 || ^17.0.0"
6363
},
6464
"devDependencies": {
65-
"@storybook/addon-actions": "^3.2.14",
66-
"@storybook/addon-options": "^3.2.14",
67-
"@storybook/react": "^3.2.14",
65+
"@storybook/addon-actions": "^3.3.12",
66+
"@storybook/addon-options": "^3.3.12",
67+
"@storybook/react": "^3.3.12",
6868
"babel-cli": "^6.24.1",
6969
"babel-core": "^6.25.0",
70-
"babel-jest": "^22.0.0",
70+
"babel-jest": "^22.1.0",
7171
"babel-preset-env": "^1.6.1",
7272
"babel-preset-react": "^6.24.1",
7373
"babel-preset-stage-2": "^6.24.1",
7474
"babel-runtime": "^6.25.0",
7575
"concurrently": "3.5.1",
76-
"enzyme": "^3.1.1",
76+
"enzyme": "^3.3.0",
7777
"enzyme-adapter-react-16": "^1.0.4",
78-
"enzyme-to-json": "^3.2.2",
79-
"eslint": "^4.10.0",
80-
"eslint-config-insilico": "^5.0.1",
81-
"flow-bin": "^0.63.0",
82-
"flow-copy-source": "^1.2.1",
78+
"enzyme-to-json": "^3.3.1",
79+
"eslint": "^4.17.0",
80+
"eslint-config-insilico": "^5.1.0",
81+
"flow-bin": "^0.64.0",
82+
"flow-copy-source": "^1.2.2",
8383
"husky": "^0.14.3",
8484
"intersection-observer": "^0.5.0",
85-
"jest": "^22.0.0",
86-
"lint-staged": "^6.0.0",
87-
"prettier": "^1.8.1",
85+
"jest": "^22.1.4",
86+
"lint-staged": "^6.1.0",
87+
"prettier": "^1.10.2",
8888
"react": "^16.2.0",
8989
"react-dom": "^16.2.0",
9090
"react-test-renderer": "^16.2.0",

src/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ class Observer extends React.Component<Props, State> {
5050
inView: false,
5151
}
5252

53-
componentWillUpdate(nextProps: Props, nextState: State) {
54-
if (!!this.props.onChange && nextState !== this.state) {
55-
this.props.onChange(nextState.inView)
56-
}
57-
}
58-
5953
componentDidUpdate(prevProps: Props, prevState: State) {
6054
// If a IntersectionObserver option changed, reinit the observer
6155
if (
@@ -109,7 +103,12 @@ class Observer extends React.Component<Props, State> {
109103
}
110104
}
111105

112-
handleChange = (inView: boolean) => this.setState({ inView })
106+
handleChange = (inView: boolean) => {
107+
this.setState({ inView })
108+
if (this.props.onChange) {
109+
this.props.onChange(inView)
110+
}
111+
}
113112

114113
render() {
115114
const {

0 commit comments

Comments
 (0)