Skip to content

Commit

Permalink
npx rnn-link is run
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzitelli committed Aug 26, 2022
1 parent a0f877d commit fa85cf4
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
26 changes: 3 additions & 23 deletions android/app/src/main/java/com/rnnstarter/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
package com.rnnstarter;

import com.facebook.react.ReactActivity;
import com.reactnativenavigation.NavigationActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;

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 "RNNStarter";
}

/**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}

public class MainActivity extends NavigationActivity {
public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
public MainActivityDelegate(NavigationActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}

Expand Down
9 changes: 5 additions & 4 deletions android/app/src/main/java/com/rnnstarter/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
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.rnnstarter.newarchitecture.MainApplicationReactNativeHost;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
public class MainApplication extends NavigationApplication {

private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
new NavigationReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down Expand Up @@ -54,7 +55,7 @@ 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;
SoLoader.init(this, /* native exopackage */ false);

initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}

Expand Down
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.apache.tools.ant.taskdefs.condition.Os

buildscript {
ext {
RNNKotlinVersion = "1.4.31"
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
Expand All @@ -22,6 +23,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
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")
Expand Down
18 changes: 18 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- glog (0.3.5)
- HMSegmentedControl (1.5.6)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2021.06.28.00-v2):
Expand Down Expand Up @@ -350,6 +351,17 @@ PODS:
- React-jsi (= 0.69.5)
- React-logger (= 0.69.5)
- React-perflogger (= 0.69.5)
- ReactNativeNavigation (7.30.0-alpha.1):
- HMSegmentedControl
- React-Core
- React-RCTImage
- React-RCTText
- ReactNativeNavigation/Core (= 7.30.0-alpha.1)
- ReactNativeNavigation/Core (7.30.0-alpha.1):
- HMSegmentedControl
- React-Core
- React-RCTImage
- React-RCTText
- SocketRocket (0.6.0)
- Yoga (1.14.0)
- YogaKit (1.18.1):
Expand Down Expand Up @@ -411,6 +423,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeNavigation (from `../node_modules/react-native-navigation`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand All @@ -426,6 +439,7 @@ SPEC REPOS:
- Flipper-RSocket
- FlipperKit
- fmt
- HMSegmentedControl
- libevent
- OpenSSL-Universal
- SocketRocket
Expand Down Expand Up @@ -494,6 +508,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeNavigation:
:path: "../node_modules/react-native-navigation"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand All @@ -514,6 +530,7 @@ SPEC CHECKSUMS:
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
HMSegmentedControl: 34c1f54d822d8308e7b24f5d901ec674dfa31352
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a
Expand Down Expand Up @@ -542,6 +559,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 42b34fde72e42446d9b08d2b9a3ddc2fa9ac6189
React-runtimeexecutor: c778439c3c430a5719d027d3c67423b390a221fe
ReactCommon: ab1003b81be740fecd82509c370a45b1a7dda0c1
ReactNativeNavigation: 76d2483f8e84b5af708cd8b85d70cf29c304593a
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: c2b1f2494060865ac1f27e49639e72371b1205fa
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
Expand Down
4 changes: 2 additions & 2 deletions ios/RNNStarter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = io.batyr.RNNStarter;
PRODUCT_NAME = RNNStarter;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -522,7 +522,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = io.batyr.RNNStarter;
PRODUCT_NAME = RNNStarter;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
21 changes: 6 additions & 15 deletions ios/RNNStarter/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#import "AppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <React/RCTAppSetupUtils.h>

Expand Down Expand Up @@ -34,6 +34,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
RCTAppSetupPrepareApp(application);

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[ReactNativeNavigation bootstrapWithBridge:bridge];

#if RCT_NEW_ARCH_ENABLED
_contextContainer = std::make_shared<facebook::react::ContextContainer const>();
Expand All @@ -43,20 +44,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif

NSDictionary *initProps = [self prepareInitialProps];
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"RNNStarter", initProps);

if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}

Expand All @@ -82,6 +69,10 @@ - (NSDictionary *)prepareInitialProps
return initProps;
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
return [ReactNativeNavigation extraModulesForBridge:bridge];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
Expand Down

0 comments on commit fa85cf4

Please sign in to comment.