Closed camilossantos2809 closed 4 months ago
Before executing the clear method on iOS, check if the directory exists using RCTGetStorageDirectory to avoid throwing an error.
clear
RCTGetStorageDirectory
Fixes #1020
To test this change I created an app from scratch and call await AsyncStorage.clear(). The component code is available on gist
await AsyncStorage.clear()
before:
https://github.com/react-native-async-storage/async-storage/assets/20076881/0a7e7881-6404-4260-bc58-d23179b29f18
after:
https://github.com/react-native-async-storage/async-storage/assets/20076881/5cafc379-839d-45cf-9c0b-76a2855358e0
:tada: This PR is included in version 1.22.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Summary
Before executing the
clear
method on iOS, check if the directory exists usingRCTGetStorageDirectory
to avoid throwing an error.Fixes #1020
Test Plan
To test this change I created an app from scratch and call
await AsyncStorage.clear()
. The component code is available on gistbefore:
https://github.com/react-native-async-storage/async-storage/assets/20076881/0a7e7881-6404-4260-bc58-d23179b29f18
after:
https://github.com/react-native-async-storage/async-storage/assets/20076881/5cafc379-839d-45cf-9c0b-76a2855358e0