Skip to content

Commit

Permalink
use UNSAFE version of deprecated methods to be compatible with React 17
Browse files Browse the repository at this point in the history
  • Loading branch information
ptolemybarnes committed Oct 31, 2023
1 parent 05e74ca commit 31f8281
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Geosuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class extends React.Component<IProps, IState> {
/**
* Change inputValue if prop changes
*/
componentWillReceiveProps(props: IProps) {
UNSAFE_componentWillReceiveProps(props: IProps) {
if (this.props.initialValue !== props.initialValue) {
this.setState({userInput: props.initialValue || ''});
}
Expand All @@ -128,7 +128,7 @@ export default class extends React.Component<IProps, IState> {
* Google api sdk object will be obtained and cached as a instance property.
* Necessary objects of google api will also be determined and saved.
*/
componentWillMount() {
UNSAFE_componentWillMount() {
if (typeof window === 'undefined') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/suggest-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class extends React.PureComponent<IProps, {}> {
/**
* Checking if item just became active and scrolling if needed.
*/
componentWillReceiveProps(nextProps: IProps): void {
UNSAFE_componentWillReceiveProps(nextProps: IProps): void {
if (nextProps.isActive && !this.props.isActive) {
this.scrollIfNeeded();
}
Expand Down
2 changes: 1 addition & 1 deletion src/suggest-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class extends React.PureComponent<IProps, {}> {
/**
* There are new properties available for the list
*/
componentWillReceiveProps(nextProps: IProps) {
UNSAFE_componentWillReceiveProps(nextProps: IProps) {
if (nextProps.suggests !== this.props.suggests) {
if (nextProps.suggests.length === 0) {
this.props.onSuggestNoResults();
Expand Down

0 comments on commit 31f8281

Please sign in to comment.