Install RNN

This commit is contained in:
Marc Rousavy 2021-02-19 18:02:24 +01:00
parent 3597fa949d
commit fa1c5fa698
10 changed files with 5769 additions and 32 deletions

View File

@ -1,15 +1,8 @@
package com.example.reactnativevisioncamera; package com.example.reactnativevisioncamera;
import com.facebook.react.ReactActivity; import com.reactnativenavigation.NavigationActivity;
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";
}
} }

View File

@ -3,8 +3,9 @@ package com.example.reactnativevisioncamera;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import com.facebook.react.PackageList; import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication; import com.reactnativenavigation.NavigationApplication;
import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage; import com.facebook.react.ReactPackage;
import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactInstanceManager;
import com.facebook.soloader.SoLoader; import com.facebook.soloader.SoLoader;
@ -12,10 +13,10 @@ import java.lang.reflect.InvocationTargetException;
import java.util.List; import java.util.List;
import com.reactnativevisioncamera.VisionCameraPackage; import com.reactnativevisioncamera.VisionCameraPackage;
public class MainApplication extends Application implements ReactApplication { public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost = private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) { new NavigationReactNativeHost(this) {
@Override @Override
public boolean getUseDeveloperSupport() { public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG; return BuildConfig.DEBUG;
@ -45,7 +46,7 @@ public class MainApplication extends Application implements ReactApplication {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled
} }

View File

@ -2,8 +2,9 @@
buildscript { buildscript {
ext { ext {
RNNKotlinVersion = "1.3.61"
buildToolsVersion = "29.0.2" buildToolsVersion = "29.0.2"
minSdkVersion = 16 minSdkVersion = 21
compileSdkVersion = 29 compileSdkVersion = 29
targetSdkVersion = 29 targetSdkVersion = 29
} }
@ -12,6 +13,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath("com.android.tools.build:gradle:3.5.3") classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -1,5 +1,22 @@
import { AppRegistry } from 'react-native'; import { Navigation } from "react-native-navigation";
import App from './src/App'; import App from './src/App';
import { name as appName } from './app.json'; import Settings from './src/Settings';
AppRegistry.registerComponent(appName, () => App); Navigation.registerComponent('Home', () => App);
Navigation.registerComponent('Settings', () => Settings);
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
stack: {
children: [
{
component: {
name: 'Home'
}
}
]
}
}
});
});

View File

@ -296,6 +296,15 @@ PODS:
- React-Core (= 0.63.4) - React-Core (= 0.63.4)
- React-cxxreact (= 0.63.4) - React-cxxreact (= 0.63.4)
- React-jsi (= 0.63.4) - React-jsi (= 0.63.4)
- ReactNativeNavigation (7.10.0):
- React-Core
- React-RCTImage
- React-RCTText
- ReactNativeNavigation/Core (= 7.10.0)
- ReactNativeNavigation/Core (7.10.0):
- React-Core
- React-RCTImage
- React-RCTText
- Yoga (1.14.0) - Yoga (1.14.0)
- YogaKit (1.18.1): - YogaKit (1.18.1):
- Yoga (~> 1.14) - Yoga (~> 1.14)
@ -348,6 +357,7 @@ DEPENDENCIES:
- React-RCTText (from `../node_modules/react-native/Libraries/Text`) - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeNavigation (from `../node_modules/react-native-navigation`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS: SPEC REPOS:
@ -418,6 +428,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Vibration" :path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon: ReactCommon:
:path: "../node_modules/react-native/ReactCommon" :path: "../node_modules/react-native/ReactCommon"
ReactNativeNavigation:
:path: "../node_modules/react-native-navigation"
Yoga: Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga" :path: "../node_modules/react-native/ReactCommon/yoga"
@ -459,6 +471,7 @@ SPEC CHECKSUMS:
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
ReactNativeNavigation: fa1eed29e815dfca6a1cb325776ef97658c54ce3
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

View File

@ -6,10 +6,10 @@
*/ */
#import "AppDelegate.h" #import "AppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>
#import <React/RCTBridge.h> #import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h> #import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#ifdef FB_SONARKIT_ENABLED #ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h> #import <FlipperKit/FlipperClient.h>
@ -36,21 +36,14 @@ static void InitializeFlipper(UIApplication *application) {
#ifdef FB_SONARKIT_ENABLED #ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application); InitializeFlipper(application);
#endif #endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; [ReactNativeNavigation bootstrapWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"VisionCameraExample"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES; return YES;
} }
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
return [ReactNativeNavigation extraModulesForBridge:bridge];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{ {
#if DEBUG #if DEBUG

5691
example/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,8 @@
}, },
"dependencies": { "dependencies": {
"react": "16.13.1", "react": "16.13.1",
"react-native": "0.63.4" "react-native": "0.63.4",
"react-native-navigation": "^7.10.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",

View File

@ -16,6 +16,7 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
backgroundColor: 'white',
}, },
box: { box: {
width: 60, width: 60,

25
example/src/Settings.tsx Normal file
View File

@ -0,0 +1,25 @@
import React from 'react';
import { StyleSheet, View, Text } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>powered by Cuvent</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
},
box: {
width: 60,
height: 60,
marginVertical: 20,
},
});