| #
f179ccd5 |
| 11-Jan-2023 |
Kudo Chien <[email protected]> |
[go] vendor react-native-async-storage (#20780)
# Why
react-native 0.71 removed the builtin async storage, to keep the backward compatibility, we should now vendor the *@react-native-async-storag
[go] vendor react-native-async-storage (#20780)
# Why
react-native 0.71 removed the builtin async storage, to keep the backward compatibility, we should now vendor the *@react-native-async-storage/async-storage*
close ENG-7190
# How
- [tools] add @react-native-async-storage/async-storage to vendoring config
- to support expo-go's scoped async storage, we should further patch react-native-async-storage. they are now in the vendoring patch.
- previously on ios, we had the patch [in our fork](https://github.com/expo/react-native/commit/c7d3f6d12ed566bd5700c8ec0d6b5b82018207a4)
- previously on android, we did this from [the transform tool for our fork](https://github.com/expo/expo/blob/9047ecfbe233924e4848722b518d8ce1fa8b7173/android/tools/src/main/java/host/exp/exponent/tools/ReactAndroidCodeTransformer.java#L215-L216)
- the new react-native-async-storage saves data in a different storage, so they have the migration steps. to keep backward compatibility for existing expo-go. i skip the migrations and read the storage data from previous expo-go paths.
- the new react-native-async-storage saves ios data in [*Application Support* rather than *Documents*](https://github.com/react-native-async-storage/async-storage/pull/274). i don't want to follow the design. the reason is, besides backward compatibility, expo-go as a developer tool, it's good for developers to view the storage in *Documents*.
- [ios] migrate the AsyncStorage native module from `RCTAsyncLocalStorage` to `RNCAsyncStorage`
- [android] migrate `ExponentAsyncStorageModule` parent class to the new `AsyncStorageModule`
- the new react-native-async-storage doesn't support turbo module, we have to move our integration from *ExpoTurboPackage* to *ExponentPackage*
- the classic native module system respects the `@ReactMethod` annotation, we should add all of them in the `ExponentAsyncStorageModule`.
# Test Plan
- [ncl] AsyncStorage test case before this pr and after. makes sure the AsyncStorage value is kept after the changes.
show more ...
|