Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.0 kB
2
Indexable
Never
 const onLogout = () => {
  // AsyncStorage.clear().then(response => {
  fb
   .auth()
   .signOut()
   .then(async() => {

    let keys = [
      'fcmToken',
      'userDetails',
      'language',
      'categoryData',
    ];
    await AsyncStorage.multiRemove(keys, err => {
      // keys k1 & k2 removed, if they existed
      // do most stuff after removal (if you want)
    });

    // AsyncStorage.getAllKeys().then((key: any) => {
    //   console.log('key', key);
    //   if (Platform.OS === 'ios') {
    //    key.forEach((item: string) => {
    //     if (item !== 'resourcesData') {
    //      AsyncStorage.removeItem(item);
    //     }
    //    });
    //   } else {
    //    if (key !== 'resourcesData') {
    //     AsyncStorage.removeItem(key);
    //    }
    //   }
      navigation.dispatch(
            CommonActions.reset({
             index: 0,
             routes: [{name: Screens.HOME}],
            }),
           )
     });

  //  });
  //    });
 };
Leave a Comment