在最近的一次react native 0.71.3的升级中,升级的一部分是添加了一个方法:
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
this,
getMainComponentName(),
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
);
}
指令是将其添加到MainActivity.java
。这一切都很好,但有一个问题:
我们的代码已经有了这个方法,但形式完全不同,它使用了完全不同的机制
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new InitialPropsReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
我需要合并功能,并返回一个ReactActivityDelegate
与我们需要的一切。有没有人有经验,如何正确地做到这一点?它让我为难。
1条答案
按热度按时间3pvhb19x1#
我觉得这个就够了