-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
use new architecture #181
use new architecture #181
Conversation
新版这个文件的命名是_BUCK
React native new architecture
React native new architecture
昨晚我花了一晚上去尝试用新架构运行,最终在踩了一堆坑后还是构建失败了,这玩意对windows环境极其不友好,等rn0.71正式版出来再看看情况吧,0.71又改了挺多东西的,新架构升级没那么简单的,涉及原生模块,一堆问题 |
你可以试试 我举个例子: 以前添加package是在 @Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new GzipPackage());
packages.add(new CachePackage());
packages.add(new UtilsPackage());
packages.add(new LyricPackage());
return packages;
} 启用新架构之后是在 @Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
// packages.add(new TurboReactPackage() { ... });
// If you have custom Fabric Components, their ViewManagers should also be loaded here
// inside a ReactPackage.
packages.add(new GzipPackage());
packages.add(new CachePackage());
packages.add(new UtilsPackage());
packages.add(new LyricPackage());
return packages;
} 关键官方文档里升级它又不写清楚。。。 还有个大坑是不仅要改原生,连
// Adapt it to the package you used for your Java class.
static constexpr auto kJavaDescriptor =
"Lcn/toside/music/mobile/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; 我没了解过C++就光试这个路径估计都踩了一两个小时的坑,开头 |
我现在没有环境试,要周末才行, |
好的👌 |
RNN在新版RN上还有其他的问题(DrawerLayoutAndroid组件在使用RNN导航到其他屏幕再返回会无法弹出),我打算从RNN迁移到React Navigation,直接创建一个空白RN项目,再将代码复制过去,然后清空现有项目,迁移完成再把代码复制回来。 由于现在在开发v1.0.0版本,旧的代码全部重构,现在这套代码已经打算弃用了,所以你先不用折腾它先,等v1.0.0出来再说 |
好耶,RNN从来没用过,一直用的 |
都差不多的,尝试切换到React Navigation后DrawerLayoutAndroid还是有问题,一旦切到二级页面再回来,侧栏就弹不出来了,这看起来是DrawerLayoutAndroid的bug,由于RNN支持动画分享,我现在又切回RNN了,DrawerLayoutAndroid的问题通过用研究出的 hack 方式解决了 v1.0.0将加密库切换到了react-native-quick-crypto,现在它也不支持RN0.71,看来升级到RN0.71还要等一段时间看看了:( |
1.0版本还没有开源吧,想看看源码是怎么写的 |
与PC2.0一样,打算完善好功能再把代码推到主仓库 |
移动端v1.0.0的代码已推到dev分支,已经启用了新架构 ) |
已知问题:
暂时不知道咋修复。。。