-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
react-native 0.69 support for new architecture #7547
Comments
Also, problems popping up after upgrading from 68.[x] to 69 too... Will be tracking and sharing findings under this one. React-Native upgrade has a lot of nonsense code changes, fixed one by one in AppDelegate.mm, MainActivity and app/build.gradle Podfile dependency lost, HMSegmentedView removed from Pods in first pod-install, started getting ReactNative Also Fix: Old school then started to get one or more required architectures cannot find under lib-podmodules.a:
Then started to getting module map for Yogakit can found under arm64 architecture and resolved with: |
So the issue seems to be linked to the new autolinking implemetation of react native cli (see https://github.com/react-native-community/cli/releases/tag/v8.0.0-alpha.0). |
newest react native navigation with react native 0.69 build error on Android after fixed on iOS follow up guide above |
I’m experiencing this issue on a brand new RN project created using the RN cli tool. Should I use 0.68 for now? |
Then you have to figure out whole this thinks after became a more messy way. RN 0.69 and TurboModules are coming, we all know that. If you have event bit of time I would say don't step back |
I'll try the Android version tomorrow. Please also share if anything useful comes up. |
I'm not sure I understand |
I mean if you downgrade to 0.68 you have to upgrade later and it could be more complicated than now. Since you just created a new project |
In Android I can not import NavigationActivity in MainActivity on RN 0.69.1 |
any updates? |
Hi everyone, additional to manual Android configuration I changed public MainActivityDelegate(ReactActivity activity, String mainComponentName) { with public MainActivityDelegate(NavigationActivity activity, String mainComponentName) { Also make sure your kotlin version is updated too. Here is how my import org.apache.tools.ant.taskdefs.condition.Os
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlinVersion = "1.5.31" // <- CHANGED
RNNKotlinVersion = kotlinVersion // <- CHANGED
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // <- CHANGED
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
} @chengjunzhang1219 this solved the same issue you mention |
Hi, @gaguirre can you please share your full MainActivity.java file? |
@erennyuksell sure package com.app;
import com.reactnativenavigation.NavigationActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
public class MainActivity extends NavigationActivity {
public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}
@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
}
@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
}
} And full package com.app;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.reactnativenavigation.NavigationApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.soloader.SoLoader;
import com.app.newarchitecture.MainApplicationReactNativeHost;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost =
new NavigationReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@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());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
private final ReactNativeHost mNewArchitectureNativeHost =
new MainApplicationReactNativeHost(this);
@Override
public ReactNativeHost getReactNativeHost() {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
return mNewArchitectureNativeHost;
} else {
return mReactNativeHost;
}
}
@Override
public void onCreate() {
super.onCreate();
// If you opted-in for the New Architecture, we enable the TurboModule system
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.app.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
} |
Hey guys, if someone can submit a PR for adding RN 0.69 support that would be awesome! We currently don't have any Android dev maintaining RNN but we are hiring. |
This worked for me, thank you |
@yogevbd I'll try to find some time and send a PR fixing RNN setup for both Android and iOS 🤞 |
@gaguirre |
Hi @yogevbd |
@chengjunzhang1219 I haven't tried upgrading the kotlin version because I didn't need to. |
after applying this changes the app compiles but I'm getting this error when running (old arch)
|
@enahum do you see that in the logs or are you seeing the typical RN error screen (the red one)? |
Ok the issue was with another dependency, it seems that the suggested code works just fine. |
This PR updates autolink script for both Android and iOS to make them compatible with RN 0.69 It should fix #7564 and also tackle an issue commented in #7547 I've also added some snapshot tests for the modified files (`activityLinker.js` and `appDeletegateLinker.js`). In order to do so, some fixtures were added: `MainActivity.java` and `AppDelegate.mm` files for RN 0.68 and 0.69 These tests execution is included in `test-all` command, but could be removed if necessary. Co-authored-by: Gonzalo Aguirre <gonzalo@underscope.io>
I have a working version of the new architecture working on iOS! Will push it tomorrow and will try to get the Android part done this week. |
@yogevbd that is incredible news, thanks for sharing |
hello can anybody help me |
Currently, no |
@enahum I've run into that same error message after upgrading to 0.69.4 |
@zzorba any lib that imports ViewPropStyle, TextPropStyle etc, as they were deprecated. There is a lib that is shipped with RN to allow you to use those deprecated props, so you'll need to patch your dependencies |
Hi, is there any development? |
any solution ?? |
Hi there! Still not working on RN 0.69? |
Hi everyone! Some solutions about NavigationActivity doesn't have createReactActivityDelegate method? |
Thank you, you are the best! It really helps me |
Hi, for me this was practicly working, I had this issue : I just removed the @OverRide above the protected boolean isConcurrentRootEnabled and my it worked. |
So it looks like fabric, or the concurrent root flags are not exposed in any way right now. Are there any plans of supporting those in react-native-navigation? How's that PR going @erennyuksell ? |
@cordeiro22 did you get a resolution to this? |
When run start script it ignores the package
The text was updated successfully, but these errors were encountered: