Posts

Showing posts with the label asyncstorage

React Native - Play Store Warning “Starting May 5th you must let us know why your app requires broad storage access”

22 4 I have a react native app which is on play store for some time and recently i received this important notice from play store, stating if i don't fix this my app will be removed from play store. Can anyone tell me what this is and how to fix it? Here is the complete message from Play store We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs. Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either: Update your app to use more privacy friendly best practices, such as the Storage Access Framework or Media Store API ...

AsyncStorage : React Native

Save 'unique Id' as session variable in react native You can add the unique id using AsyncStorage like this : AsyncStorage.setItem('Key Name', uniqueId) And after that you can get from other component like this : AsyncStorage.getItem('Key Name').then((value) => console.log(value)) For details you can read from the documentation. I hope this answer can help you. import { AsyncStorage} from 'react-native'; AsyncStorage.getItem('Key Name').then((value) => console.log(value)) we can get value from asyncstorage in any component of app. number of another function are used like merge,remove etc.please see documentation

React Native StackNavigator initialRouteName

In React Native Navigation library 'react-navigation' How could I set StackNavigator initialRouteName by AsyncStorage? function getInitialScreen() { AsyncStorage.getItem('initialScreen') .then(screenName => { return (screenName) ? screenName : 'Login'; }) .catch(err => {}); } const Navigator = StackNavigator({ Splash: { screen: Splash }, Login: { screen: Login }, WebPage: { screen: WebPage } }, { initialRouteName: getInitialScreen() }); I’ve also had this problem and currently the only good solution is the following example: const RootNavLogged = StackNavigator({ ... },{ initialRouteName : 'Home' }); const RootNav = StackNavigator({ ... },{ initialRouteName : 'Login' }); class App extends Component { render(){ if (this.props.userLogged == true ){ return ( <R...