Reputation: 2641
I am implementing a screen in which a permission is required to display the main components.
When the permission is asked to the user, if it is not granted, how can I listen to the user permissions changes in the device settings, in order to render the main components when he goes back to the app (which was in background) and has granted the required permission?
Upvotes: 0
Views: 2790
Reputation: 2641
The solution is tu use AppState
componentDidMount() {
AppState.addEventListener('change', this._handleAppStateChange);
}
componentWillUnmount() {
AppState.removeEventListener('change', this._handleAppStateChange);
}
_handleAppStateChange = (nextAppState) => {
//Check permission here
};
Upvotes: 1