-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecated AppState.removeEventListener on react v0.70 #113
Comments
In the meantime, a fix to this is editing the index.js file as follows: `state = { componentWillUnmount() { |
@ullmanj , i don't have this content in index.ts file (Using typescript). I can only see the interfaces mentioned in index.ts file under react-native-countdown-component inside node_modules. Can you help? |
Hi! Yes — I found the code above in the index file under react-native-countdown-component inside node_modules. I see that binotby linked a fix above. Maybe you could try that if the code isn't showing up for you in the index file? |
Thanks @ullmanj that worked as expected Here you can find the patch-package react-native-countdown-component+2.7.1.patch
|
This is working thanks.......................................................................................... |
until: Math.max(this.props.until, 0),
lastUntil: null,
wentBackgroundAt: null,
+ eventListener: null, // NEW LINE
};
componentDidMount() {
- AppState.addEventListener('change', this._handleAppStateChange);
+ this.state.eventListener = AppState.addEventListener('change', this._handleAppStateChange); // MODIFIED
+
}
componentWillUnmount() {
clearInterval(this.timer);
- AppState.removeEventListener('change', this._handleAppStateChange);
+ this.state.eventListener.remove(); // MODIFIED
}
componentDidUpdate(prevProps, prevState) {
|
getting this error while using the above code |
@Rksingh620 It seems that there is a typo: you wrote "eventListner" when it should be "eventListener" based on the code above. |
To fix this error, open node modules and find the react-native-countdown-component folder, open the folder and open the index.js file. find the
then find the
|
The text was updated successfully, but these errors were encountered: