Skip to content

Commit 31f8281

Browse files
committed
use UNSAFE version of deprecated methods to be compatible with React 17
1 parent 05e74ca commit 31f8281

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Geosuggest.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default class extends React.Component<IProps, IState> {
117117
/**
118118
* Change inputValue if prop changes
119119
*/
120-
componentWillReceiveProps(props: IProps) {
120+
UNSAFE_componentWillReceiveProps(props: IProps) {
121121
if (this.props.initialValue !== props.initialValue) {
122122
this.setState({userInput: props.initialValue || ''});
123123
}
@@ -128,7 +128,7 @@ export default class extends React.Component<IProps, IState> {
128128
* Google api sdk object will be obtained and cached as a instance property.
129129
* Necessary objects of google api will also be determined and saved.
130130
*/
131-
componentWillMount() {
131+
UNSAFE_componentWillMount() {
132132
if (typeof window === 'undefined') {
133133
return;
134134
}

src/suggest-item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default class extends React.PureComponent<IProps, {}> {
8484
/**
8585
* Checking if item just became active and scrolling if needed.
8686
*/
87-
componentWillReceiveProps(nextProps: IProps): void {
87+
UNSAFE_componentWillReceiveProps(nextProps: IProps): void {
8888
if (nextProps.isActive && !this.props.isActive) {
8989
this.scrollIfNeeded();
9090
}

src/suggest-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class extends React.PureComponent<IProps, {}> {
4242
/**
4343
* There are new properties available for the list
4444
*/
45-
componentWillReceiveProps(nextProps: IProps) {
45+
UNSAFE_componentWillReceiveProps(nextProps: IProps) {
4646
if (nextProps.suggests !== this.props.suggests) {
4747
if (nextProps.suggests.length === 0) {
4848
this.props.onSuggestNoResults();

0 commit comments

Comments
 (0)