-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for enabled TurboModules in Expo #418
Conversation
Thank you for merging it and verifying that the fix is correct! I'm sorry to ask you more of your time, but would you care to publish a new version of |
v1.12.0 is out :) |
# Why We need to enable TurboModules to be able to include Reanimated v2. > A known issue with this PR is that the community AsyncStorage seizes to work — it expects only native module, isn't compatible with TurboModule AsyncStorage and we do not import the AsyncStorage community module properly. > > **Actually**, react-native-async-storage/async-storage#418 should be enough. # How Apart from the more or less usual TurboModules setup (imports, headers, flags, C++ dialect) I had to move native modules that we override in Expo from `extraModulesForBridge:` to `getModuleInstanceFromClass:`. I don't like that we have to use `RCTLogFunction` in `EXVersionManager` now (otherwise the code wouldn't compile), but I guess that if the type ever changes somebody will notice and backport the change to versioned SDKs. # Test Plan Expo Client compiled, home ran.
would it make sense to not put this under an |
# Why We need to enable TurboModules to be able to include Reanimated v2. > A known issue with this PR is that the community AsyncStorage seizes to work — it expects only native module, isn't compatible with TurboModule AsyncStorage and we do not import the AsyncStorage community module properly. > > **Actually**, react-native-async-storage/async-storage#418 should be enough. # How Apart from the more or less usual TurboModules setup (imports, headers, flags, C++ dialect) I had to move native modules that we override in Expo from `extraModulesForBridge:` to `getModuleInstanceFromClass:`. I don't like that we have to use `RCTLogFunction` in `EXVersionManager` now (otherwise the code wouldn't compile), but I guess that if the type ever changes somebody will notice and backport the change to versioned SDKs. # Test Plan Expo Client compiled, home ran.
Summary:
At Expo we're on the verge of enabling TurboModules in SDK 39 (expo/expo#9687). While we haven't added the native code for this module to the SDK yet, we want to maintain the
.expo.js
fallback, so it resolves with the React Native'sAsyncStorage
.Test Plan:
I have verified manually that copying and pasting this code to an appropriate file in
node_modules
for a running Expo project fixes the[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
error.The
if (TurboModuleRegistry)
helps to not break this code on older versions of RN which do not have TMR (I hope).