Skip to content
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

TypeError: _reactNative.AppState.removeEventListener is not a function #134

Open
opeyemijj opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@opeyemijj
Copy link

If there isn’t an update available or if the update doesn’t fix the issue, you can manually patch the library by updating how AppState listeners are added and removed.

Steps to Manually Patch the Library:
Locate the node_modules/react-native-countdown-component/index.js file.
Find instances of AppState.addEventListener and AppState.removeEventListener.
Replace them with the updated API as follows:

Replace:
AppState.addEventListener('change', this._handleAppStateChange);

with:
this.appStateSubscription = AppState.addEventListener('change', this._handleAppStateChange);

Also Replace:
AppState.removeEventListener('change', this._handleAppStateChange);

with:
this.appStateSubscription && this.appStateSubscription.remove();

Save the file and re-run your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant