feat: Add React Native 0.66 support (#490)
* feat: Add React Native 0.66 support * Generate lockfiles * Update Podfile.lock * chore: Migrate from react-native-navigation to react-navigation (#491) * Migrate RNN -> RN * Migrate all screens * Fix get permission status * fix app name * Update AppDelegate.m * Fix Info.plist * Set `UIViewControllerBasedStatusBarAppearance` to `YES` * Only enable `audio` if user granted microphone permission * Update App.tsx * Fix RNGH for Android * Use `navigate` instead of `push` * Fix animation * Upgrade @types/react-native * "Splash" -> "PermissionsPage"
This commit is contained in:
@@ -122,6 +122,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
*/
|
||||
def enableHermes = project.ext.react.get("enableHermes", false)
|
||||
|
||||
/**
|
||||
* Architectures to build native code for in debug.
|
||||
*/
|
||||
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
|
||||
|
||||
android {
|
||||
ndkVersion rootProject.ext.ndkVersion
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
@@ -156,6 +161,11 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
if (nativeArchitectures) {
|
||||
ndk {
|
||||
abiFilters nativeArchitectures.split(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
release {
|
||||
// Caution! In production, you need to generate your own keystore file.
|
||||
|
@@ -1,8 +1,34 @@
|
||||
package com.mrousavy.camera.example;
|
||||
|
||||
import com.reactnativenavigation.NavigationActivity;
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
import com.facebook.react.ReactRootView;
|
||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class MainActivity extends NavigationActivity {
|
||||
public class MainActivity extends ReactActivity {
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
||||
* rendering of the component.
|
||||
*/
|
||||
@Override
|
||||
protected String getMainComponentName() {
|
||||
return "VisionCameraExample";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReactActivityDelegate createReactActivityDelegate() {
|
||||
return new ReactActivityDelegate(this, getMainComponentName()) {
|
||||
@Override
|
||||
protected ReactRootView createRootView() {
|
||||
return new RNGestureHandlerEnabledRootView(MainActivity.this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,22 +1,25 @@
|
||||
package com.mrousavy.camera.example;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import com.facebook.react.PackageList;
|
||||
import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin;
|
||||
import com.reactnativenavigation.NavigationApplication;
|
||||
import com.facebook.react.ReactApplication;
|
||||
import com.facebook.react.ReactInstanceManager;
|
||||
import com.facebook.react.ReactNativeHost;
|
||||
import com.reactnativenavigation.react.NavigationReactNativeHost;
|
||||
import com.facebook.react.ReactPackage;
|
||||
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import java.util.List;
|
||||
import com.mrousavy.camera.CameraPackage;
|
||||
|
||||
import com.mrousavy.camera.CameraPackage;
|
||||
import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin;
|
||||
import com.facebook.react.bridge.JSIModulePackage;
|
||||
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
|
||||
|
||||
public class MainApplication extends NavigationApplication {
|
||||
|
||||
public class MainApplication extends Application implements ReactApplication {
|
||||
|
||||
private final ReactNativeHost mReactNativeHost =
|
||||
new NavigationReactNativeHost(this) {
|
||||
new ReactNativeHost(this) {
|
||||
@Override
|
||||
public boolean getUseDeveloperSupport() {
|
||||
return BuildConfig.DEBUG;
|
||||
@@ -27,7 +30,6 @@ public class MainApplication extends NavigationApplication {
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
List<ReactPackage> packages = new PackageList(this).getPackages();
|
||||
// Packages that cannot be autolinked yet can be added manually here, for VisionCameraExample:
|
||||
// packages.add(new MyReactNativePackage());
|
||||
packages.add(new CameraPackage());
|
||||
return packages;
|
||||
}
|
||||
@@ -51,7 +53,7 @@ public class MainApplication extends NavigationApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
// register VisionCamera Frame Processor Plugins here.
|
||||
SoLoader.init(this, /* native exopackage */ false);
|
||||
FrameProcessorPlugin.register(new ExampleFrameProcessorPlugin());
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ buildscript {
|
||||
minSdkVersion = 21
|
||||
compileSdkVersion = 30
|
||||
targetSdkVersion = 30
|
||||
ndkVersion = "20.1.5948944"
|
||||
ndkVersion = "21.4.7075529"
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
|
Reference in New Issue
Block a user