diff --git a/README.md b/README.md index 5727bc1..5059bef 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ public class MainActivity extends ReactActivity { } ``` - You can further optimize performance and pre-render pages [by providing the urls that the user is likely to open](https://developer.chrome.com/docs/android/custom-tabs/best-practices/#pre-render-content). +You can further optimize performance and pre-render pages [by providing the urls that the user is likely to open](https://developer.chrome.com/docs/android/custom-tabs/best-practices/#pre-render-content). ```javascript // Do not call this every time the component render diff --git a/example/.eslintrc.js b/example/.eslintrc.js index 40c6dcd..dcf0be0 100644 --- a/example/.eslintrc.js +++ b/example/.eslintrc.js @@ -1,4 +1,16 @@ module.exports = { root: true, extends: '@react-native-community', + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], + overrides: [ + { + files: ['*.ts', '*.tsx'], + rules: { + '@typescript-eslint/no-shadow': ['error'], + 'no-shadow': 'off', + 'no-undef': 'off', + }, + }, + ], }; diff --git a/example/.flowconfig b/example/.flowconfig deleted file mode 100644 index 315f274..0000000 --- a/example/.flowconfig +++ /dev/null @@ -1,66 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore polyfills -node_modules/react-native/Libraries/polyfills/.* - -; Flow doesn't support platforms -.*/Libraries/Utilities/LoadingView.js - -[untyped] -.*/node_modules/@react-native-community/cli/.*/.* - -[include] - -[libs] -node_modules/react-native/interface.js -node_modules/react-native/flow/ - -[options] -emoji=true - -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable - -exact_by_default=true - -module.file_ext=.js -module.file_ext=.json -module.file_ext=.ios.js - -munge_underscores=true - -module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' -module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FlowFixMeProps -suppress_type=$FlowFixMeState - -[lints] -sketchy-null-number=warn -sketchy-null-mixed=warn -sketchy-number=warn -untyped-type-import=warn -nonstrict-import=warn -deprecated-type=warn -unsafe-getters-setters=warn -unnecessary-invariant=warn -signature-verification-failure=warn - -[strict] -deprecated-type -nonstrict-import -sketchy-null -unclear-type -unsafe-getters-setters -untyped-import -untyped-type-import - -[version] -^0.137.0 diff --git a/example/.gitattributes b/example/.gitattributes deleted file mode 100644 index 45a3dcb..0000000 --- a/example/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Windows files should use crlf line endings -# https://help.github.com/articles/dealing-with-line-endings/ -*.bat text eol=crlf diff --git a/example/.gitignore b/example/.gitignore index ad572e6..344481b 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -20,6 +20,7 @@ DerivedData *.hmap *.ipa *.xcuserstate +ios/.xcode.env.local # Android/IntelliJ # @@ -28,6 +29,7 @@ build/ .gradle local.properties *.iml +*.hprof # node.js # @@ -48,12 +50,14 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle -# CocoaPods +# Ruby / CocoaPods /ios/Pods/ +/vendor/bundle/ diff --git a/example/.npmrc b/example/.npmrc deleted file mode 100644 index 9cf9495..0000000 --- a/example/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false \ No newline at end of file diff --git a/example/.prettierrc.js b/example/.prettierrc.js index 84196d9..2b54074 100644 --- a/example/.prettierrc.js +++ b/example/.prettierrc.js @@ -1,7 +1,7 @@ module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, bracketSpacing: false, - jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', - arrowParens: 'avoid', }; diff --git a/example/Gemfile b/example/Gemfile new file mode 100644 index 0000000..5efda89 --- /dev/null +++ b/example/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version +ruby '2.7.5' + +gem 'cocoapods', '~> 1.11', '>= 1.11.2' diff --git a/example/__tests__/App-test.js b/example/__tests__/App-test.tsx similarity index 88% rename from example/__tests__/App-test.js rename to example/__tests__/App-test.tsx index 1784766..4edaa0a 100644 --- a/example/__tests__/App-test.js +++ b/example/__tests__/App-test.tsx @@ -4,7 +4,7 @@ import 'react-native'; import React from 'react'; -import App from '../App'; +import App from '../src/App'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; diff --git a/example/_bundle/config b/example/_bundle/config new file mode 100644 index 0000000..848943b --- /dev/null +++ b/example/_bundle/config @@ -0,0 +1,2 @@ +BUNDLE_PATH: "vendor/bundle" +BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/example/_editorconfig b/example/_editorconfig deleted file mode 100644 index 7c28613..0000000 --- a/example/_editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -# Windows files -[*.bat] -end_of_line = crlf diff --git a/example/_ruby-version b/example/_ruby-version new file mode 100644 index 0000000..a603bb5 --- /dev/null +++ b/example/_ruby-version @@ -0,0 +1 @@ +2.7.5 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ef75f8e..ba15c81 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -114,40 +114,107 @@ def jscFlavor = 'org.webkit:android-jsc:+' /** * Whether to enable the Hermes VM. * - * This should be set on project.ext.react and mirrored here. If it is not set + * This should be set on project.ext.react and that value will be read here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false); /** - * Architectures to build native code for in debug. + * Architectures to build native code for. */ -def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures") +def reactNativeArchitectures() { + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] +} android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - defaultConfig { applicationId "com.example" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" + buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() + + if (isNewArchitectureEnabled()) { + // We configure the NDK build only if you decide to opt-in for the New Architecture. + externalNativeBuild { + ndkBuild { + arguments "APP_PLATFORM=android-21", + "APP_STL=c++_shared", + "NDK_TOOLCHAIN_VERSION=clang", + "GENERATED_SRC_DIR=$buildDir/generated/source", + "PROJECT_BUILD_DIR=$buildDir", + "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", + "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", + "NODE_MODULES_DIR=$rootDir/../node_modules" + cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" + cppFlags "-std=c++17" + // Make sure this target name is the same you specify inside the + // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable. + targets "example_appmodules" + } + } + if (!enableSeparateBuildPerCPUArchitecture) { + ndk { + abiFilters (*reactNativeArchitectures()) + } + } + } } + + if (isNewArchitectureEnabled()) { + // We configure the NDK build only if you decide to opt-in for the New Architecture. + externalNativeBuild { + ndkBuild { + path "$projectDir/src/main/jni/Android.mk" + } + } + def reactAndroidProjectDir = project(':ReactAndroid').projectDir + def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { + dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") + from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") + into("$buildDir/react-ndk/exported") + } + def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { + dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") + from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") + into("$buildDir/react-ndk/exported") + } + afterEvaluate { + // If you wish to add a custom TurboModule or component locally, + // you should uncomment this line. + // preBuild.dependsOn("generateCodegenArtifactsFromSchema") + preDebugBuild.dependsOn(packageReactNdkDebugLibs) + preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) + + // Due to a bug inside AGP, we have to explicitly set a dependency + // between configureNdkBuild* tasks and the preBuild tasks. + // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 + configureNdkBuildRelease.dependsOn(preReleaseBuild) + configureNdkBuildDebug.dependsOn(preDebugBuild) + reactNativeArchitectures().each { architecture -> + tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure { + dependsOn("preDebugBuild") + } + tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure { + dependsOn("preReleaseBuild") + } + } + } + } + splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" + include (*reactNativeArchitectures()) } } signingConfigs { @@ -161,11 +228,6 @@ android { buildTypes { debug { signingConfig signingConfigs.debug - if (nativeArchitectures) { - ndk { - abiFilters nativeArchitectures.split(',') - } - } } release { // Caution! In production, you need to generate your own keystore file. @@ -195,13 +257,14 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) + //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' + exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { @@ -214,14 +277,31 @@ dependencies { } if (enableHermes) { - def hermesPath = "../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") + //noinspection GradleDynamicVersion + implementation("com.facebook.react:hermes-engine:+") { // From node_modules + exclude group:'com.facebook.fbjni' + } } else { implementation jscFlavor } } +if (isNewArchitectureEnabled()) { + // If new architecture is enabled, we let you build RN from source + // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. + // This will be applied to all the imported transtitive dependency. + configurations.all { + resolutionStrategy.dependencySubstitution { + substitute(module("com.facebook.react:react-native")) + .using(project(":ReactAndroid")) + .because("On New Architecture we're building React Native from source") + substitute(module("com.facebook.react:hermes-engine")) + .using(project(":ReactAndroid:hermes-engine")) + .because("On New Architecture we're building Hermes from source") + } + } +} + // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { @@ -230,3 +310,11 @@ task copyDownloadableDepsToLibs(type: Copy) { } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) + +def isNewArchitectureEnabled() { + // To opt-in for the New Architecture, you can either: + // - Set `newArchEnabled` to true inside the `gradle.properties` file + // - Invoke gradle with `-newArchEnabled=true` + // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` + return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" +} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index b2f3ad9..4b185bc 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -8,6 +8,6 @@ android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning"> - + diff --git a/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java b/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java index a1b70b8..9ffdd88 100644 --- a/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +++ b/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * *

This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. @@ -19,6 +19,7 @@ import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; +import com.facebook.react.ReactInstanceEventListener; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; @@ -51,7 +52,7 @@ public void apply(OkHttpClient.Builder builder) { ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { + new ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 1354ebb..3f2cec1 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -14,10 +14,10 @@ + android:windowSoftInputMode="adjustResize" + android:exported="true"> diff --git a/example/android/app/src/main/java/com/example/MainActivity.java b/example/android/app/src/main/java/com/example/MainActivity.java index 297db3b..fb314db 100644 --- a/example/android/app/src/main/java/com/example/MainActivity.java +++ b/example/android/app/src/main/java/com/example/MainActivity.java @@ -1,7 +1,8 @@ package com.example; import com.facebook.react.ReactActivity; -import com.proyecto26.inappbrowser.RNInAppBrowserModule; +import com.facebook.react.ReactActivityDelegate; +import com.facebook.react.ReactRootView; public class MainActivity extends ReactActivity { @@ -14,9 +15,34 @@ protected String getMainComponentName() { return "example"; } + /** + * 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 void onStart() { - super.onStart(); - RNInAppBrowserModule.onStart(this); + protected ReactActivityDelegate createReactActivityDelegate() { + return new MainActivityDelegate(this, getMainComponentName()); + } + + public static class MainActivityDelegate extends ReactActivityDelegate { + public MainActivityDelegate(ReactActivity 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; + } } } diff --git a/example/android/app/src/main/java/com/example/MainApplication.java b/example/android/app/src/main/java/com/example/MainApplication.java index fd8ec88..61f1d42 100644 --- a/example/android/app/src/main/java/com/example/MainApplication.java +++ b/example/android/app/src/main/java/com/example/MainApplication.java @@ -7,7 +7,9 @@ import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; +import com.facebook.react.config.ReactFeatureFlags; import com.facebook.soloader.SoLoader; +import com.example.newarchitecture.MainApplicationReactNativeHost; import java.lang.reflect.InvocationTargetException; import java.util.List; @@ -35,14 +37,23 @@ protected String getJSMainModuleName() { } }; + private final ReactNativeHost mNewArchitectureNativeHost = + new MainApplicationReactNativeHost(this); + @Override public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; + 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; SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } diff --git a/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java b/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java new file mode 100644 index 0000000..68aea28 --- /dev/null +++ b/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java @@ -0,0 +1,116 @@ +package com.example.newarchitecture; + +import android.app.Application; +import androidx.annotation.NonNull; +import com.facebook.react.PackageList; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.ReactPackageTurboModuleManagerDelegate; +import com.facebook.react.bridge.JSIModulePackage; +import com.facebook.react.bridge.JSIModuleProvider; +import com.facebook.react.bridge.JSIModuleSpec; +import com.facebook.react.bridge.JSIModuleType; +import com.facebook.react.bridge.JavaScriptContextHolder; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.UIManager; +import com.facebook.react.fabric.ComponentFactory; +import com.facebook.react.fabric.CoreComponentsRegistry; +import com.facebook.react.fabric.FabricJSIModuleProvider; +import com.facebook.react.fabric.ReactNativeConfig; +import com.facebook.react.uimanager.ViewManagerRegistry; +import com.example.BuildConfig; +import com.example.newarchitecture.components.MainComponentsRegistry; +import com.example.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; +import java.util.ArrayList; +import java.util.List; + +/** + * A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both + * TurboModule delegates and the Fabric Renderer. + * + *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the + * `newArchEnabled` property). Is ignored otherwise. + */ +public class MainApplicationReactNativeHost extends ReactNativeHost { + public MainApplicationReactNativeHost(Application application) { + super(application); + } + + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + List packages = new PackageList(this).getPackages(); + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + // TurboModules must also be loaded here providing a valid TurboReactPackage implementation: + // packages.add(new TurboReactPackage() { ... }); + // If you have custom Fabric Components, their ViewManagers should also be loaded here + // inside a ReactPackage. + return packages; + } + + @Override + protected String getJSMainModuleName() { + return "index"; + } + + @NonNull + @Override + protected ReactPackageTurboModuleManagerDelegate.Builder + getReactPackageTurboModuleManagerDelegateBuilder() { + // Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary + // for the new architecture and to use TurboModules correctly. + return new MainApplicationTurboModuleManagerDelegate.Builder(); + } + + @Override + protected JSIModulePackage getJSIModulePackage() { + return new JSIModulePackage() { + @Override + public List getJSIModules( + final ReactApplicationContext reactApplicationContext, + final JavaScriptContextHolder jsContext) { + final List specs = new ArrayList<>(); + + // Here we provide a new JSIModuleSpec that will be responsible of providing the + // custom Fabric Components. + specs.add( + new JSIModuleSpec() { + @Override + public JSIModuleType getJSIModuleType() { + return JSIModuleType.UIManager; + } + + @Override + public JSIModuleProvider getJSIModuleProvider() { + final ComponentFactory componentFactory = new ComponentFactory(); + CoreComponentsRegistry.register(componentFactory); + + // Here we register a Components Registry. + // The one that is generated with the template contains no components + // and just provides you the one from React Native core. + MainComponentsRegistry.register(componentFactory); + + final ReactInstanceManager reactInstanceManager = getReactInstanceManager(); + + ViewManagerRegistry viewManagerRegistry = + new ViewManagerRegistry( + reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)); + + return new FabricJSIModuleProvider( + reactApplicationContext, + componentFactory, + ReactNativeConfig.DEFAULT_CONFIG, + viewManagerRegistry); + } + }); + return specs; + } + }; + } +} diff --git a/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java b/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java new file mode 100644 index 0000000..98ff973 --- /dev/null +++ b/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java @@ -0,0 +1,36 @@ +package com.example.newarchitecture.components; + +import com.facebook.jni.HybridData; +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.fabric.ComponentFactory; +import com.facebook.soloader.SoLoader; + +/** + * Class responsible to load the custom Fabric Components. This class has native methods and needs a + * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ + * folder for you). + * + *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the + * `newArchEnabled` property). Is ignored otherwise. + */ +@DoNotStrip +public class MainComponentsRegistry { + static { + SoLoader.loadLibrary("fabricjni"); + } + + @DoNotStrip private final HybridData mHybridData; + + @DoNotStrip + private native HybridData initHybrid(ComponentFactory componentFactory); + + @DoNotStrip + private MainComponentsRegistry(ComponentFactory componentFactory) { + mHybridData = initHybrid(componentFactory); + } + + @DoNotStrip + public static MainComponentsRegistry register(ComponentFactory componentFactory) { + return new MainComponentsRegistry(componentFactory); + } +} diff --git a/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java b/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java new file mode 100644 index 0000000..b30c50e --- /dev/null +++ b/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java @@ -0,0 +1,48 @@ +package com.example.newarchitecture.modules; + +import com.facebook.jni.HybridData; +import com.facebook.react.ReactPackage; +import com.facebook.react.ReactPackageTurboModuleManagerDelegate; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.soloader.SoLoader; +import java.util.List; + +/** + * Class responsible to load the TurboModules. This class has native methods and needs a + * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ + * folder for you). + * + *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the + * `newArchEnabled` property). Is ignored otherwise. + */ +public class MainApplicationTurboModuleManagerDelegate + extends ReactPackageTurboModuleManagerDelegate { + + private static volatile boolean sIsSoLibraryLoaded; + + protected MainApplicationTurboModuleManagerDelegate( + ReactApplicationContext reactApplicationContext, List packages) { + super(reactApplicationContext, packages); + } + + protected native HybridData initHybrid(); + + native boolean canCreateTurboModule(String moduleName); + + public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder { + protected MainApplicationTurboModuleManagerDelegate build( + ReactApplicationContext context, List packages) { + return new MainApplicationTurboModuleManagerDelegate(context, packages); + } + } + + @Override + protected synchronized void maybeLoadOtherSoLibraries() { + if (!sIsSoLibraryLoaded) { + // If you change the name of your application .so file in the Android.mk file, + // make sure you update the name here as well. + SoLoader.loadLibrary("example_appmodules"); + sIsSoLibraryLoaded = true; + } + } +} diff --git a/example/android/app/src/main/jni/Android.mk b/example/android/app/src/main/jni/Android.mk new file mode 100644 index 0000000..bb9c671 --- /dev/null +++ b/example/android/app/src/main/jni/Android.mk @@ -0,0 +1,48 @@ +THIS_DIR := $(call my-dir) + +include $(REACT_ANDROID_DIR)/Android-prebuilt.mk + +# If you wish to add a custom TurboModule or Fabric component in your app you +# will have to include the following autogenerated makefile. +# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk +include $(CLEAR_VARS) + +LOCAL_PATH := $(THIS_DIR) + +# You can customize the name of your application .so file here. +LOCAL_MODULE := example_appmodules + +LOCAL_C_INCLUDES := $(LOCAL_PATH) +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) + +# If you wish to add a custom TurboModule or Fabric component in your app you +# will have to uncomment those lines to include the generated source +# files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni) +# +# LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni +# LOCAL_SRC_FILES += $(wildcard $(GENERATED_SRC_DIR)/codegen/jni/*.cpp) +# LOCAL_EXPORT_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni + +# Here you should add any native library you wish to depend on. +LOCAL_SHARED_LIBRARIES := \ + libfabricjni \ + libfbjni \ + libfolly_runtime \ + libglog \ + libjsi \ + libreact_codegen_rncore \ + libreact_debug \ + libreact_nativemodule_core \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + librrc_view \ + libruntimeexecutor \ + libturbomodulejsijni \ + libyoga + +LOCAL_CFLAGS := -DLOG_TAG=\"ReactNative\" -fexceptions -frtti -std=c++17 -Wall + +include $(BUILD_SHARED_LIBRARY) diff --git a/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp b/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp new file mode 100644 index 0000000..0ac23cc --- /dev/null +++ b/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp @@ -0,0 +1,24 @@ +#include "MainApplicationModuleProvider.h" + +#include + +namespace facebook { +namespace react { + +std::shared_ptr MainApplicationModuleProvider( + const std::string moduleName, + const JavaTurboModule::InitParams ¶ms) { + // Here you can provide your own module provider for TurboModules coming from + // either your application or from external libraries. The approach to follow + // is similar to the following (for a library called `samplelibrary`: + // + // auto module = samplelibrary_ModuleProvider(moduleName, params); + // if (module != nullptr) { + // return module; + // } + // return rncore_ModuleProvider(moduleName, params); + return rncore_ModuleProvider(moduleName, params); +} + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationModuleProvider.h b/example/android/app/src/main/jni/MainApplicationModuleProvider.h new file mode 100644 index 0000000..0fa43fa --- /dev/null +++ b/example/android/app/src/main/jni/MainApplicationModuleProvider.h @@ -0,0 +1,16 @@ +#pragma once + +#include +#include + +#include + +namespace facebook { +namespace react { + +std::shared_ptr MainApplicationModuleProvider( + const std::string moduleName, + const JavaTurboModule::InitParams ¶ms); + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp new file mode 100644 index 0000000..dbbdc3d --- /dev/null +++ b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp @@ -0,0 +1,45 @@ +#include "MainApplicationTurboModuleManagerDelegate.h" +#include "MainApplicationModuleProvider.h" + +namespace facebook { +namespace react { + +jni::local_ref +MainApplicationTurboModuleManagerDelegate::initHybrid( + jni::alias_ref) { + return makeCxxInstance(); +} + +void MainApplicationTurboModuleManagerDelegate::registerNatives() { + registerHybrid({ + makeNativeMethod( + "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid), + makeNativeMethod( + "canCreateTurboModule", + MainApplicationTurboModuleManagerDelegate::canCreateTurboModule), + }); +} + +std::shared_ptr +MainApplicationTurboModuleManagerDelegate::getTurboModule( + const std::string name, + const std::shared_ptr jsInvoker) { + // Not implemented yet: provide pure-C++ NativeModules here. + return nullptr; +} + +std::shared_ptr +MainApplicationTurboModuleManagerDelegate::getTurboModule( + const std::string name, + const JavaTurboModule::InitParams ¶ms) { + return MainApplicationModuleProvider(name, params); +} + +bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule( + std::string name) { + return getTurboModule(name, nullptr) != nullptr || + getTurboModule(name, {.moduleName = name}) != nullptr; +} + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h new file mode 100644 index 0000000..9dc2af6 --- /dev/null +++ b/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h @@ -0,0 +1,38 @@ +#include +#include + +#include +#include + +namespace facebook { +namespace react { + +class MainApplicationTurboModuleManagerDelegate + : public jni::HybridClass< + MainApplicationTurboModuleManagerDelegate, + TurboModuleManagerDelegate> { + public: + // Adapt it to the package you used for your Java class. + static constexpr auto kJavaDescriptor = + "Lcom/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; + + static jni::local_ref initHybrid(jni::alias_ref); + + static void registerNatives(); + + std::shared_ptr getTurboModule( + const std::string name, + const std::shared_ptr jsInvoker) override; + std::shared_ptr getTurboModule( + const std::string name, + const JavaTurboModule::InitParams ¶ms) override; + + /** + * Test-only method. Allows user to verify whether a TurboModule can be + * created by instances of this class. + */ + bool canCreateTurboModule(std::string name); +}; + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainComponentsRegistry.cpp b/example/android/app/src/main/jni/MainComponentsRegistry.cpp new file mode 100644 index 0000000..8f7edff --- /dev/null +++ b/example/android/app/src/main/jni/MainComponentsRegistry.cpp @@ -0,0 +1,61 @@ +#include "MainComponentsRegistry.h" + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {} + +std::shared_ptr +MainComponentsRegistry::sharedProviderRegistry() { + auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry(); + + // Custom Fabric Components go here. You can register custom + // components coming from your App or from 3rd party libraries here. + // + // providerRegistry->add(concreteComponentDescriptorProvider< + // AocViewerComponentDescriptor>()); + return providerRegistry; +} + +jni::local_ref +MainComponentsRegistry::initHybrid( + jni::alias_ref, + ComponentFactory *delegate) { + auto instance = makeCxxInstance(delegate); + + auto buildRegistryFunction = + [](EventDispatcher::Weak const &eventDispatcher, + ContextContainer::Shared const &contextContainer) + -> ComponentDescriptorRegistry::Shared { + auto registry = MainComponentsRegistry::sharedProviderRegistry() + ->createComponentDescriptorRegistry( + {eventDispatcher, contextContainer}); + + auto mutableRegistry = + std::const_pointer_cast(registry); + + mutableRegistry->setFallbackComponentDescriptor( + std::make_shared( + ComponentDescriptorParameters{ + eventDispatcher, contextContainer, nullptr})); + + return registry; + }; + + delegate->buildRegistryFunction = buildRegistryFunction; + return instance; +} + +void MainComponentsRegistry::registerNatives() { + registerHybrid({ + makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid), + }); +} + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/MainComponentsRegistry.h b/example/android/app/src/main/jni/MainComponentsRegistry.h new file mode 100644 index 0000000..23a9cac --- /dev/null +++ b/example/android/app/src/main/jni/MainComponentsRegistry.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +class MainComponentsRegistry + : public facebook::jni::HybridClass { + public: + // Adapt it to the package you used for your Java class. + constexpr static auto kJavaDescriptor = + "Lcom/example/newarchitecture/components/MainComponentsRegistry;"; + + static void registerNatives(); + + MainComponentsRegistry(ComponentFactory *delegate); + + private: + static std::shared_ptr + sharedProviderRegistry(); + + static jni::local_ref initHybrid( + jni::alias_ref, + ComponentFactory *delegate); +}; + +} // namespace react +} // namespace facebook diff --git a/example/android/app/src/main/jni/OnLoad.cpp b/example/android/app/src/main/jni/OnLoad.cpp new file mode 100644 index 0000000..c569b6e --- /dev/null +++ b/example/android/app/src/main/jni/OnLoad.cpp @@ -0,0 +1,11 @@ +#include +#include "MainApplicationTurboModuleManagerDelegate.h" +#include "MainComponentsRegistry.h" + +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { + return facebook::jni::initialize(vm, [] { + facebook::react::MainApplicationTurboModuleManagerDelegate:: + registerNatives(); + facebook::react::MainComponentsRegistry::registerNatives(); + }); +} diff --git a/example/android/app/src/main/res/drawable/rn_edit_text_material.xml b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml new file mode 100644 index 0000000..f35d996 --- /dev/null +++ b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 9fab0be..7ba83a2 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -3,7 +3,7 @@ diff --git a/example/android/build.gradle b/example/android/build.gradle index 1a9251e..e479c01 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,3 +1,5 @@ +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 { @@ -6,7 +8,14 @@ buildscript { minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 - ndkVersion = "21.4.7075529" + + 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" + } androidXAnnotation = "1.2.0" androidXBrowser = "1.3.0" } @@ -15,7 +24,9 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:7.0.0") + 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 } @@ -23,8 +34,6 @@ buildscript { allprojects { repositories { - mavenCentral() - mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") @@ -33,9 +42,14 @@ allprojects { // 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() - mavenCentral() maven { url 'https://www.jitpack.io' } } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index a6af3a4..fa4feae 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -9,8 +9,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit @@ -25,4 +25,16 @@ android.useAndroidX=true android.enableJetifier=true # Version of flipper SDK to use with React Native -FLIPPER_VERSION=0.101.0 +FLIPPER_VERSION=0.125.0 + +# Use this property to specify which architecture you want to build. +# You can also override it from the CLI using +# ./gradlew -PreactNativeArchitectures=x86_64 +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 + +# Use this property to enable support to the new architecture. +# This will allow you to use TurboModules and the Fabric render in +# your application. You should enable this flag either if you want +# to write custom TurboModules/Fabric components OR use libraries that +# are providing them. +newArchEnabled=false diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar index e708b1c..7454180 100644 Binary files a/example/android/gradle/wrapper/gradle-wrapper.jar and b/example/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 29e4134..669386b 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/example/android/gradlew b/example/android/gradlew index 4f906e0..1b6c787 100755 --- a/example/android/gradlew +++ b/example/android/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 263c9e8..117c005 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,3 +1,11 @@ rootProject.name = 'example' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' +includeBuild('../node_modules/react-native-gradle-plugin') + +if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { + include(":ReactAndroid") + project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid') + include(":ReactAndroid:hermes-engine") + project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine') +} diff --git a/example/index.js b/example/index.js index a850d03..69303b3 100644 --- a/example/index.js +++ b/example/index.js @@ -3,7 +3,7 @@ */ import {AppRegistry} from 'react-native'; -import App from './App'; +import App from './src/App'; import {name as appName} from './app.json'; AppRegistry.registerComponent(appName, () => App); diff --git a/example/ios/Podfile b/example/ios/Podfile index 7316c41..0205e8f 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,15 +1,26 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' -platform :ios, '11.0' +platform :ios, '12.4' +install! 'cocoapods', :deterministic_uuids => false + +production = ENV["PRODUCTION"] == "1" target 'example' do config = use_native_modules! + # Flags change depending on the env values. + flags = get_default_flags() + use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods - :hermes_enabled => false + :production => production, + :hermes_enabled => flags[:hermes_enabled], + :fabric_enabled => flags[:fabric_enabled], + :flipper_configuration => FlipperConfiguration.enabled, + # An absolute path to your application root. + :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'exampleTests' do @@ -17,14 +28,8 @@ target 'example' do # Pods for testing end - # Enables Flipper. - # - # Note that if you have use_frameworks! enabled, Flipper will not work and - # you should disable the next line. - use_flipper!() - post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) end -end \ No newline at end of file +end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index dd7119d..4fb185b 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,356 +1,397 @@ PODS: - - boost-for-react-native (1.63.0) + - boost (1.76.0) - CocoaAsyncSocket (7.6.5) - DoubleConversion (1.1.6) - - FBLazyVector (0.64.2) - - FBReactNativeSpec (0.64.2): - - RCT-Folly (= 2020.01.13.00) - - RCTRequired (= 0.64.2) - - RCTTypeSafety (= 0.64.2) - - React-Core (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - Flipper (0.75.1): - - Flipper-Folly (~> 2.5) - - Flipper-RSocket (~> 1.3) - - Flipper-DoubleConversion (1.1.7) - - Flipper-Folly (2.5.3): - - boost-for-react-native + - FBLazyVector (0.69.2) + - FBReactNativeSpec (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.2) + - RCTTypeSafety (= 0.69.2) + - React-Core (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - Flipper (0.125.0): + - Flipper-Folly (~> 2.6) + - Flipper-RSocket (~> 1.4) + - Flipper-Boost-iOSX (1.76.0.1.11) + - Flipper-DoubleConversion (3.2.0.1) + - Flipper-Fmt (7.1.7) + - Flipper-Folly (2.6.10): + - Flipper-Boost-iOSX - Flipper-DoubleConversion + - Flipper-Fmt (= 7.1.7) - Flipper-Glog - libevent (~> 2.1.12) - - OpenSSL-Universal (= 1.1.180) - - Flipper-Glog (0.3.6) + - OpenSSL-Universal (= 1.1.1100) + - Flipper-Glog (0.5.0.5) - Flipper-PeerTalk (0.0.4) - - Flipper-RSocket (1.3.1): - - Flipper-Folly (~> 2.5) - - FlipperKit (0.75.1): - - FlipperKit/Core (= 0.75.1) - - FlipperKit/Core (0.75.1): - - Flipper (~> 0.75.1) + - Flipper-RSocket (1.4.3): + - Flipper-Folly (~> 2.6) + - FlipperKit (0.125.0): + - FlipperKit/Core (= 0.125.0) + - FlipperKit/Core (0.125.0): + - Flipper (~> 0.125.0) - FlipperKit/CppBridge - FlipperKit/FBCxxFollyDynamicConvert - FlipperKit/FBDefines - FlipperKit/FKPortForwarding - - FlipperKit/CppBridge (0.75.1): - - Flipper (~> 0.75.1) - - FlipperKit/FBCxxFollyDynamicConvert (0.75.1): - - Flipper-Folly (~> 2.5) - - FlipperKit/FBDefines (0.75.1) - - FlipperKit/FKPortForwarding (0.75.1): + - SocketRocket (~> 0.6.0) + - FlipperKit/CppBridge (0.125.0): + - Flipper (~> 0.125.0) + - FlipperKit/FBCxxFollyDynamicConvert (0.125.0): + - Flipper-Folly (~> 2.6) + - FlipperKit/FBDefines (0.125.0) + - FlipperKit/FKPortForwarding (0.125.0): - CocoaAsyncSocket (~> 7.6) - Flipper-PeerTalk (~> 0.0.4) - - FlipperKit/FlipperKitHighlightOverlay (0.75.1) - - FlipperKit/FlipperKitLayoutPlugin (0.75.1): + - FlipperKit/FlipperKitHighlightOverlay (0.125.0) + - FlipperKit/FlipperKitLayoutHelpers (0.125.0): - FlipperKit/Core - FlipperKit/FlipperKitHighlightOverlay - FlipperKit/FlipperKitLayoutTextSearchable + - FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0): + - FlipperKit/Core + - FlipperKit/FlipperKitHighlightOverlay + - FlipperKit/FlipperKitLayoutHelpers + - YogaKit (~> 1.18) + - FlipperKit/FlipperKitLayoutPlugin (0.125.0): + - FlipperKit/Core + - FlipperKit/FlipperKitHighlightOverlay + - FlipperKit/FlipperKitLayoutHelpers + - FlipperKit/FlipperKitLayoutIOSDescriptors + - FlipperKit/FlipperKitLayoutTextSearchable - YogaKit (~> 1.18) - - FlipperKit/FlipperKitLayoutTextSearchable (0.75.1) - - FlipperKit/FlipperKitNetworkPlugin (0.75.1): + - FlipperKit/FlipperKitLayoutTextSearchable (0.125.0) + - FlipperKit/FlipperKitNetworkPlugin (0.125.0): - FlipperKit/Core - - FlipperKit/FlipperKitReactPlugin (0.75.1): + - FlipperKit/FlipperKitReactPlugin (0.125.0): - FlipperKit/Core - - FlipperKit/FlipperKitUserDefaultsPlugin (0.75.1): + - FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0): - FlipperKit/Core - - FlipperKit/SKIOSNetworkPlugin (0.75.1): + - FlipperKit/SKIOSNetworkPlugin (0.125.0): - FlipperKit/Core - FlipperKit/FlipperKitNetworkPlugin + - fmt (6.2.1) - glog (0.3.5) - libevent (2.1.12) - - OpenSSL-Universal (1.1.180) - - RCT-Folly (2020.01.13.00): - - boost-for-react-native + - OpenSSL-Universal (1.1.1100) + - RCT-Folly (2021.06.28.00-v2): + - boost - DoubleConversion + - fmt (~> 6.2.1) - glog - - RCT-Folly/Default (= 2020.01.13.00) - - RCT-Folly/Default (2020.01.13.00): - - boost-for-react-native + - RCT-Folly/Default (= 2021.06.28.00-v2) + - RCT-Folly/Default (2021.06.28.00-v2): + - boost - DoubleConversion + - fmt (~> 6.2.1) - glog - - RCTRequired (0.64.2) - - RCTTypeSafety (0.64.2): - - FBLazyVector (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTRequired (= 0.64.2) - - React-Core (= 0.64.2) - - React (0.64.2): - - React-Core (= 0.64.2) - - React-Core/DevSupport (= 0.64.2) - - React-Core/RCTWebSocket (= 0.64.2) - - React-RCTActionSheet (= 0.64.2) - - React-RCTAnimation (= 0.64.2) - - React-RCTBlob (= 0.64.2) - - React-RCTImage (= 0.64.2) - - React-RCTLinking (= 0.64.2) - - React-RCTNetwork (= 0.64.2) - - React-RCTSettings (= 0.64.2) - - React-RCTText (= 0.64.2) - - React-RCTVibration (= 0.64.2) - - React-callinvoker (0.64.2) - - React-Core (0.64.2): + - RCTRequired (0.69.2) + - RCTTypeSafety (0.69.2): + - FBLazyVector (= 0.69.2) + - RCTRequired (= 0.69.2) + - React-Core (= 0.69.2) + - React (0.69.2): + - React-Core (= 0.69.2) + - React-Core/DevSupport (= 0.69.2) + - React-Core/RCTWebSocket (= 0.69.2) + - React-RCTActionSheet (= 0.69.2) + - React-RCTAnimation (= 0.69.2) + - React-RCTBlob (= 0.69.2) + - React-RCTImage (= 0.69.2) + - React-RCTLinking (= 0.69.2) + - React-RCTNetwork (= 0.69.2) + - React-RCTSettings (= 0.69.2) + - React-RCTText (= 0.69.2) + - React-RCTVibration (= 0.69.2) + - React-bridging (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - React-jsi (= 0.69.2) + - React-callinvoker (0.69.2) + - React-Codegen (0.69.2): + - FBReactNativeSpec (= 0.69.2) + - RCT-Folly (= 2021.06.28.00-v2) + - RCTRequired (= 0.69.2) + - RCTTypeSafety (= 0.69.2) + - React-Core (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-Core (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) - - React-Core/Default (= 0.64.2) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - RCT-Folly (= 2021.06.28.00-v2) + - React-Core/Default (= 0.69.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/CoreModulesHeaders (0.64.2): + - React-Core/CoreModulesHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/Default (0.64.2): + - React-Core/Default (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - RCT-Folly (= 2021.06.28.00-v2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/DevSupport (0.64.2): + - React-Core/DevSupport (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) - - React-Core/Default (= 0.64.2) - - React-Core/RCTWebSocket (= 0.64.2) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-jsinspector (= 0.64.2) - - React-perflogger (= 0.64.2) + - RCT-Folly (= 2021.06.28.00-v2) + - React-Core/Default (= 0.69.2) + - React-Core/RCTWebSocket (= 0.69.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-jsinspector (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTActionSheetHeaders (0.64.2): + - React-Core/RCTActionSheetHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTAnimationHeaders (0.64.2): + - React-Core/RCTAnimationHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTBlobHeaders (0.64.2): + - React-Core/RCTBlobHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTImageHeaders (0.64.2): + - React-Core/RCTImageHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTLinkingHeaders (0.64.2): + - React-Core/RCTLinkingHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTNetworkHeaders (0.64.2): + - React-Core/RCTNetworkHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTSettingsHeaders (0.64.2): + - React-Core/RCTSettingsHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTTextHeaders (0.64.2): + - React-Core/RCTTextHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTVibrationHeaders (0.64.2): + - React-Core/RCTVibrationHeaders (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) + - RCT-Folly (= 2021.06.28.00-v2) - React-Core/Default - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-Core/RCTWebSocket (0.64.2): + - React-Core/RCTWebSocket (0.69.2): - glog - - RCT-Folly (= 2020.01.13.00) - - React-Core/Default (= 0.64.2) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsiexecutor (= 0.64.2) - - React-perflogger (= 0.64.2) + - RCT-Folly (= 2021.06.28.00-v2) + - React-Core/Default (= 0.69.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsiexecutor (= 0.69.2) + - React-perflogger (= 0.69.2) - Yoga - - React-CoreModules (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTTypeSafety (= 0.64.2) - - React-Core/CoreModulesHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - React-RCTImage (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-cxxreact (0.64.2): - - boost-for-react-native (= 1.63.0) + - React-CoreModules (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTTypeSafety (= 0.69.2) + - React-Codegen (= 0.69.2) + - React-Core/CoreModulesHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - React-RCTImage (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-cxxreact (0.69.2): + - boost (= 1.76.0) - DoubleConversion - glog - - RCT-Folly (= 2020.01.13.00) - - React-callinvoker (= 0.64.2) - - React-jsi (= 0.64.2) - - React-jsinspector (= 0.64.2) - - React-perflogger (= 0.64.2) - - React-runtimeexecutor (= 0.64.2) - - React-jsi (0.64.2): - - boost-for-react-native (= 1.63.0) + - RCT-Folly (= 2021.06.28.00-v2) + - React-callinvoker (= 0.69.2) + - React-jsi (= 0.69.2) + - React-jsinspector (= 0.69.2) + - React-logger (= 0.69.2) + - React-perflogger (= 0.69.2) + - React-runtimeexecutor (= 0.69.2) + - React-jsi (0.69.2): + - boost (= 1.76.0) - DoubleConversion - glog - - RCT-Folly (= 2020.01.13.00) - - React-jsi/Default (= 0.64.2) - - React-jsi/Default (0.64.2): - - boost-for-react-native (= 1.63.0) + - RCT-Folly (= 2021.06.28.00-v2) + - React-jsi/Default (= 0.69.2) + - React-jsi/Default (0.69.2): + - boost (= 1.76.0) - DoubleConversion - glog - - RCT-Folly (= 2020.01.13.00) - - React-jsiexecutor (0.64.2): + - RCT-Folly (= 2021.06.28.00-v2) + - React-jsiexecutor (0.69.2): - DoubleConversion - glog - - RCT-Folly (= 2020.01.13.00) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-perflogger (= 0.64.2) - - React-jsinspector (0.64.2) - - React-perflogger (0.64.2) - - React-RCTActionSheet (0.64.2): - - React-Core/RCTActionSheetHeaders (= 0.64.2) - - React-RCTAnimation (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTTypeSafety (= 0.64.2) - - React-Core/RCTAnimationHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTBlob (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - React-Core/RCTBlobHeaders (= 0.64.2) - - React-Core/RCTWebSocket (= 0.64.2) - - React-jsi (= 0.64.2) - - React-RCTNetwork (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTImage (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTTypeSafety (= 0.64.2) - - React-Core/RCTImageHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - React-RCTNetwork (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTLinking (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - React-Core/RCTLinkingHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTNetwork (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTTypeSafety (= 0.64.2) - - React-Core/RCTNetworkHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTSettings (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - RCTTypeSafety (= 0.64.2) - - React-Core/RCTSettingsHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-RCTText (0.64.2): - - React-Core/RCTTextHeaders (= 0.64.2) - - React-RCTVibration (0.64.2): - - FBReactNativeSpec (= 0.64.2) - - RCT-Folly (= 2020.01.13.00) - - React-Core/RCTVibrationHeaders (= 0.64.2) - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (= 0.64.2) - - React-runtimeexecutor (0.64.2): - - React-jsi (= 0.64.2) - - ReactCommon/turbomodule/core (0.64.2): + - RCT-Folly (= 2021.06.28.00-v2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-perflogger (= 0.69.2) + - React-jsinspector (0.69.2) + - React-logger (0.69.2): + - glog + - React-perflogger (0.69.2) + - React-RCTActionSheet (0.69.2): + - React-Core/RCTActionSheetHeaders (= 0.69.2) + - React-RCTAnimation (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTTypeSafety (= 0.69.2) + - React-Codegen (= 0.69.2) + - React-Core/RCTAnimationHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTBlob (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - React-Codegen (= 0.69.2) + - React-Core/RCTBlobHeaders (= 0.69.2) + - React-Core/RCTWebSocket (= 0.69.2) + - React-jsi (= 0.69.2) + - React-RCTNetwork (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTImage (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTTypeSafety (= 0.69.2) + - React-Codegen (= 0.69.2) + - React-Core/RCTImageHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - React-RCTNetwork (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTLinking (0.69.2): + - React-Codegen (= 0.69.2) + - React-Core/RCTLinkingHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTNetwork (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTTypeSafety (= 0.69.2) + - React-Codegen (= 0.69.2) + - React-Core/RCTNetworkHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTSettings (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - RCTTypeSafety (= 0.69.2) + - React-Codegen (= 0.69.2) + - React-Core/RCTSettingsHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-RCTText (0.69.2): + - React-Core/RCTTextHeaders (= 0.69.2) + - React-RCTVibration (0.69.2): + - RCT-Folly (= 2021.06.28.00-v2) + - React-Codegen (= 0.69.2) + - React-Core/RCTVibrationHeaders (= 0.69.2) + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (= 0.69.2) + - React-runtimeexecutor (0.69.2): + - React-jsi (= 0.69.2) + - ReactCommon/turbomodule/core (0.69.2): - DoubleConversion - glog - - RCT-Folly (= 2020.01.13.00) - - React-callinvoker (= 0.64.2) - - React-Core (= 0.64.2) - - React-cxxreact (= 0.64.2) - - React-jsi (= 0.64.2) - - React-perflogger (= 0.64.2) - - RNInAppBrowser (3.6.1): + - RCT-Folly (= 2021.06.28.00-v2) + - React-bridging (= 0.69.2) + - React-callinvoker (= 0.69.2) + - React-Core (= 0.69.2) + - React-cxxreact (= 0.69.2) + - React-jsi (= 0.69.2) + - React-logger (= 0.69.2) + - React-perflogger (= 0.69.2) + - RNInAppBrowser (3.7.0): - React-Core + - SocketRocket (0.6.0) - Yoga (1.14.0) - YogaKit (1.18.1): - Yoga (~> 1.14) DEPENDENCIES: + - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) - - Flipper (~> 0.75.1) - - Flipper-DoubleConversion (= 1.1.7) - - Flipper-Folly (~> 2.5.3) - - Flipper-Glog (= 0.3.6) - - Flipper-PeerTalk (~> 0.0.4) - - Flipper-RSocket (~> 1.3) - - FlipperKit (~> 0.75.1) - - FlipperKit/Core (~> 0.75.1) - - FlipperKit/CppBridge (~> 0.75.1) - - FlipperKit/FBCxxFollyDynamicConvert (~> 0.75.1) - - FlipperKit/FBDefines (~> 0.75.1) - - FlipperKit/FKPortForwarding (~> 0.75.1) - - FlipperKit/FlipperKitHighlightOverlay (~> 0.75.1) - - FlipperKit/FlipperKitLayoutPlugin (~> 0.75.1) - - FlipperKit/FlipperKitLayoutTextSearchable (~> 0.75.1) - - FlipperKit/FlipperKitNetworkPlugin (~> 0.75.1) - - FlipperKit/FlipperKitReactPlugin (~> 0.75.1) - - FlipperKit/FlipperKitUserDefaultsPlugin (~> 0.75.1) - - FlipperKit/SKIOSNetworkPlugin (~> 0.75.1) + - Flipper (= 0.125.0) + - Flipper-Boost-iOSX (= 1.76.0.1.11) + - Flipper-DoubleConversion (= 3.2.0.1) + - Flipper-Fmt (= 7.1.7) + - Flipper-Folly (= 2.6.10) + - Flipper-Glog (= 0.5.0.5) + - Flipper-PeerTalk (= 0.0.4) + - Flipper-RSocket (= 1.4.3) + - FlipperKit (= 0.125.0) + - FlipperKit/Core (= 0.125.0) + - FlipperKit/CppBridge (= 0.125.0) + - FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0) + - FlipperKit/FBDefines (= 0.125.0) + - FlipperKit/FKPortForwarding (= 0.125.0) + - FlipperKit/FlipperKitHighlightOverlay (= 0.125.0) + - FlipperKit/FlipperKitLayoutPlugin (= 0.125.0) + - FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0) + - FlipperKit/FlipperKitNetworkPlugin (= 0.125.0) + - FlipperKit/FlipperKitReactPlugin (= 0.125.0) + - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0) + - FlipperKit/SKIOSNetworkPlugin (= 0.125.0) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) + - OpenSSL-Universal (= 1.1.1100) - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) - React (from `../node_modules/react-native/`) + - React-bridging (from `../node_modules/react-native/ReactCommon`) - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) + - React-Codegen (from `build/generated/ios`) - React-Core (from `../node_modules/react-native/`) - React-Core/DevSupport (from `../node_modules/react-native/`) - React-Core/RCTWebSocket (from `../node_modules/react-native/`) @@ -359,6 +400,7 @@ DEPENDENCIES: - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) + - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) @@ -376,20 +418,25 @@ DEPENDENCIES: SPEC REPOS: trunk: - - boost-for-react-native - CocoaAsyncSocket - Flipper + - Flipper-Boost-iOSX - Flipper-DoubleConversion + - Flipper-Fmt - Flipper-Folly - Flipper-Glog - Flipper-PeerTalk - Flipper-RSocket - FlipperKit + - fmt - libevent - OpenSSL-Universal + - SocketRocket - YogaKit EXTERNAL SOURCES: + boost: + :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" DoubleConversion: :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" FBLazyVector: @@ -406,8 +453,12 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/Libraries/TypeSafety" React: :path: "../node_modules/react-native/" + React-bridging: + :path: "../node_modules/react-native/ReactCommon" React-callinvoker: :path: "../node_modules/react-native/ReactCommon/callinvoker" + React-Codegen: + :path: build/generated/ios React-Core: :path: "../node_modules/react-native/" React-CoreModules: @@ -420,6 +471,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/jsiexecutor" React-jsinspector: :path: "../node_modules/react-native/ReactCommon/jsinspector" + React-logger: + :path: "../node_modules/react-native/ReactCommon/logger" React-perflogger: :path: "../node_modules/react-native/ReactCommon/reactperflogger" React-RCTActionSheet: @@ -450,48 +503,55 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c + boost: a7c83b31436843459a1961bfd74b96033dc77234 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de - FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b - FBReactNativeSpec: 3349272af73455a0b14b67ee118d35007a25c0e0 - Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021 - Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41 - Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c - Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6 + DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 + FBLazyVector: e3c1479be506060131807f2f2435af5107c58410 + FBReactNativeSpec: 1381e8c4230895b6c2d20cea6b216ac7096a95f0 + Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 + Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c + Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 + Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b + Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3 + Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446 Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 - Flipper-RSocket: 127954abe8b162fcaf68d2134d34dc2bd7076154 - FlipperKit: 8a20b5c5fcf9436cac58551dc049867247f64b00 - glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62 + Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 + FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 + fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 + glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b - RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c - RCTRequired: 6d3e854f0e7260a648badd0d44fc364bc9da9728 - RCTTypeSafety: c1f31d19349c6b53085766359caac425926fafaa - React: bda6b6d7ae912de97d7a61aa5c160db24aa2ad69 - React-callinvoker: 9840ea7e8e88ed73d438edb725574820b29b5baa - React-Core: b5e385da7ce5f16a220fc60fd0749eae2c6120f0 - React-CoreModules: 17071a4e2c5239b01585f4aa8070141168ab298f - React-cxxreact: 9be7b6340ed9f7c53e53deca7779f07cd66525ba - React-jsi: 67747b9722f6dab2ffe15b011bcf6b3f2c3f1427 - React-jsiexecutor: 80c46bd381fd06e418e0d4f53672dc1d1945c4c3 - React-jsinspector: cc614ec18a9ca96fd275100c16d74d62ee11f0ae - React-perflogger: 25373e382fed75ce768a443822f07098a15ab737 - React-RCTActionSheet: af7796ba49ffe4ca92e7277a5d992d37203f7da5 - React-RCTAnimation: 6a2e76ab50c6f25b428d81b76a5a45351c4d77aa - React-RCTBlob: 02a2887023e0eed99391b6445b2e23a2a6f9226d - React-RCTImage: ce5bf8e7438f2286d9b646a05d6ab11f38b0323d - React-RCTLinking: ccd20742de14e020cb5f99d5c7e0bf0383aefbd9 - React-RCTNetwork: dfb9d089ab0753e5e5f55fc4b1210858f7245647 - React-RCTSettings: b14aef2d83699e48b410fb7c3ba5b66cd3291ae2 - React-RCTText: 41a2e952dd9adc5caf6fb68ed46b275194d5da5f - React-RCTVibration: 24600e3b1aaa77126989bc58b6747509a1ba14f3 - React-runtimeexecutor: a9904c6d0218fb9f8b19d6dd88607225927668f9 - ReactCommon: 149906e01aa51142707a10665185db879898e966 - RNInAppBrowser: 0523b3c15501fb8b54b4f32905d2e71ca902d914 - Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac + OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c + RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a + RCTRequired: b723d4d6da2795df58189a01f92856b6912cf256 + RCTTypeSafety: 3973d2fcf39f43f7819e840d56ea6b2fe45996a0 + React: 242d4ffb093ed57c4761307a69b23b2479930ae9 + React-bridging: 66938204bc9d703b9c357201a40bf498aeb14412 + React-callinvoker: bf0a87845bc3158eec32be848bd9546e79d6dd25 + React-Codegen: e5c04fc987e909433915f247699402ece1955aa0 + React-Core: 5acd5715010b56d23846859b3a68c316dad09d5b + React-CoreModules: 73db18e3aaf5e29f73e4b7c9ddf6ead823795d06 + React-cxxreact: 0fc57a199d2d69c0e0401c9eab944be9b972bf1b + React-jsi: f845df5e8fd5688cab3cdaaa06f5413e791a01bd + React-jsiexecutor: 7c23e92591431ac925f430b3118de934cb816ac0 + React-jsinspector: 31e53f048cc8f32605de36981903a7bbf9456892 + React-logger: 9a6c684d5cd56c4129e0c2842dba75c4bfb1e981 + React-perflogger: 281c34e42f13245c7a4d6932364d9182f8655e1a + React-RCTActionSheet: 92f4292754a1b4a0e42bf9b1489206a06f878929 + React-RCTAnimation: 2a5bb5549758e4e594481633f3db649d11519f75 + React-RCTBlob: cf573ac95fc612ed4440cad0b92161722430de87 + React-RCTImage: af8b9a46a743937db396fcb43320f57b570661dc + React-RCTLinking: 81029ed5767d2a2c13c03caeed32f87b72e73838 + React-RCTNetwork: 24c2b13acdcd43af39b2da90584c92e7799ee366 + React-RCTSettings: 028b0e20ff60d2c7ba47cedec8e99e69b6691c40 + React-RCTText: 6d17c2aead07b9de7ddc8765b580d0fb4b1d2e50 + React-RCTVibration: 0d07f00705b5f11e88aaaaf9131f5e1785d4bd6e + React-runtimeexecutor: 8030b9cf9b9e87b878d92da680b55b5e74c58e70 + ReactCommon: a9414b91f0d19de002b55d9f4f6cb176d6dd8452 + RNInAppBrowser: e36d6935517101ccba0e875bac8ad7b0cb655364 + SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 + Yoga: 236056dd74cda4d9d76c20306fd8c20bb087614d YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 52d4730468a14603cf036e5a7bed6dd442161ac8 +PODFILE CHECKSUM: d86e66c2874689cd5ab998282245ad4757a12721 -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.3 diff --git a/example/ios/_xcode.env b/example/ios/_xcode.env new file mode 100644 index 0000000..3d5782c --- /dev/null +++ b/example/ios/_xcode.env @@ -0,0 +1,11 @@ +# This `.xcode.env` file is versioned and is used to source the environment +# used when running script phases inside Xcode. +# To customize your local environment, you can create an `.xcode.env.local` +# file that is not versioned. + +# NODE_BINARY variable contains the PATH to the node executable. +# +# Customize the NODE_BINARY variable here. +# For example, to use nvm with brew, add the following line +# . "$(brew --prefix nvm)/nvm.sh" --no-use +export NODE_BINARY=$(command -v node) diff --git a/example/ios/example.xcodeproj/project.pbxproj b/example/ios/example.xcodeproj/project.pbxproj index 7b074c3..d00901b 100644 --- a/example/ios/example.xcodeproj/project.pbxproj +++ b/example/ios/example.xcodeproj/project.pbxproj @@ -8,12 +8,12 @@ /* Begin PBXBuildFile section */ 00E356F31AD99517003FC87E /* exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* exampleTests.m */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; + 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 154552189CDC9F62022BD0DF /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 10FF48BA602E0054E362A08B /* libPods-example.a */; }; + 1684E9C371C0C76BDEF57A70 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9175F3F44CCD533E2218D8A /* libPods-example.a */; }; + 713F482285094178E08E2051 /* libPods-example-exampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CA2ECDA364CD559854BC2903 /* libPods-example-exampleTests.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; - 9387E98EF5CEB72300930B8B /* libPods-example-exampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31463ACA39844DEFDFC7D429 /* libPods-example-exampleTests.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -30,20 +30,20 @@ 00E356EE1AD99517003FC87E /* exampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = exampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* exampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = exampleTests.m; sourceTree = ""; }; - 07D7DD1A4B197AF1FFC69665 /* Pods-example-exampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-exampleTests.debug.xcconfig"; path = "Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests.debug.xcconfig"; sourceTree = ""; }; - 10FF48BA602E0054E362A08B /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = example/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = example/AppDelegate.m; sourceTree = ""; }; + 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = example/AppDelegate.mm; sourceTree = ""; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = example/main.m; sourceTree = ""; }; - 31463ACA39844DEFDFC7D429 /* libPods-example-exampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-exampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 382717C75894DA17E9815D7E /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = ""; }; - 54A4D01A90408A3FF978BF9F /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = ""; }; - 71D9DE764177ACCC379079BE /* Pods-example-exampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-exampleTests.release.xcconfig"; path = "Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests.release.xcconfig"; sourceTree = ""; }; + 43596BD23C90573F1E2EE008 /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = ""; }; + 6634AEAC213561B7785C9565 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = ""; }; + 7535B591744F88B9F83E699B /* Pods-example-exampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-exampleTests.release.xcconfig"; path = "Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests.release.xcconfig"; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = ""; }; + 88C69C238BBDD5452DF4E3B2 /* Pods-example-exampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example-exampleTests.debug.xcconfig"; path = "Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests.debug.xcconfig"; sourceTree = ""; }; + CA2ECDA364CD559854BC2903 /* libPods-example-exampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example-exampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + F9175F3F44CCD533E2218D8A /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -51,7 +51,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9387E98EF5CEB72300930B8B /* libPods-example-exampleTests.a in Frameworks */, + 713F482285094178E08E2051 /* libPods-example-exampleTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -59,7 +59,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 154552189CDC9F62022BD0DF /* libPods-example.a in Frameworks */, + 1684E9C371C0C76BDEF57A70 /* libPods-example.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -87,7 +87,7 @@ isa = PBXGroup; children = ( 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, + 13B07FB01A68108700A75B9A /* AppDelegate.mm */, 13B07FB51A68108700A75B9A /* Images.xcassets */, 13B07FB61A68108700A75B9A /* Info.plist */, 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, @@ -100,8 +100,8 @@ isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - 10FF48BA602E0054E362A08B /* libPods-example.a */, - 31463ACA39844DEFDFC7D429 /* libPods-example-exampleTests.a */, + F9175F3F44CCD533E2218D8A /* libPods-example.a */, + CA2ECDA364CD559854BC2903 /* libPods-example-exampleTests.a */, ); name = Frameworks; sourceTree = ""; @@ -121,7 +121,7 @@ 00E356EF1AD99517003FC87E /* exampleTests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, - D152939CCA38608B30C33274 /* Pods */, + BBD78D7AC51CEA395F1C20DB /* Pods */, ); indentWidth = 2; sourceTree = ""; @@ -137,15 +137,14 @@ name = Products; sourceTree = ""; }; - D152939CCA38608B30C33274 /* Pods */ = { + BBD78D7AC51CEA395F1C20DB /* Pods */ = { isa = PBXGroup; children = ( - 54A4D01A90408A3FF978BF9F /* Pods-example.debug.xcconfig */, - 382717C75894DA17E9815D7E /* Pods-example.release.xcconfig */, - 07D7DD1A4B197AF1FFC69665 /* Pods-example-exampleTests.debug.xcconfig */, - 71D9DE764177ACCC379079BE /* Pods-example-exampleTests.release.xcconfig */, + 43596BD23C90573F1E2EE008 /* Pods-example.debug.xcconfig */, + 6634AEAC213561B7785C9565 /* Pods-example.release.xcconfig */, + 88C69C238BBDD5452DF4E3B2 /* Pods-example-exampleTests.debug.xcconfig */, + 7535B591744F88B9F83E699B /* Pods-example-exampleTests.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -156,12 +155,12 @@ isa = PBXNativeTarget; buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "exampleTests" */; buildPhases = ( - 197E5E8A6B60036A0BA04EB7 /* [CP] Check Pods Manifest.lock */, + 7DED289F0A95A2F0FFE9EC40 /* [CP] Check Pods Manifest.lock */, 00E356EA1AD99517003FC87E /* Sources */, 00E356EB1AD99517003FC87E /* Frameworks */, 00E356EC1AD99517003FC87E /* Resources */, - F22061A9297718D922D9864F /* [CP] Embed Pods Frameworks */, - E92ECE06264B321513F203B6 /* [CP] Copy Pods Resources */, + B9A6DC2DA5EF736659D70D5F /* [CP] Embed Pods Frameworks */, + AEE77D8C0766220447901574 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -177,14 +176,14 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */; buildPhases = ( - A99020072AC9CCACAB42FCF7 /* [CP] Check Pods Manifest.lock */, + F5A4A708535B38A022E6C22A /* [CP] Check Pods Manifest.lock */, FD10A7F022414F080027D42C /* Start Packager */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - F4D57F5DD05AF02E494D1836 /* [CP] Embed Pods Frameworks */, - F3C40C0DFA051B78EC9F148B /* [CP] Copy Pods Resources */, + 25517CC5599175EBE75A4610 /* [CP] Embed Pods Frameworks */, + 206A7FC9BEFA7C6C37CF4B4F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -257,37 +256,51 @@ files = ( ); inputPaths = ( + "$(SRCROOT)/.xcode.env.local", + "$(SRCROOT)/.xcode.env", ); name = "Bundle React Native code and images"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; + shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; }; - 197E5E8A6B60036A0BA04EB7 /* [CP] Check Pods Manifest.lock */ = { + 206A7FC9BEFA7C6C37CF4B4F /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist", ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-example-exampleTests-checkManifestLockResult.txt", + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 25517CC5599175EBE75A4610 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - A99020072AC9CCACAB42FCF7 /* [CP] Check Pods Manifest.lock */ = { + 7DED289F0A95A2F0FFE9EC40 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -302,14 +315,14 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-example-exampleTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - E92ECE06264B321513F203B6 /* [CP] Copy Pods Resources */ = { + AEE77D8C0766220447901574 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -326,7 +339,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; - F22061A9297718D922D9864F /* [CP] Embed Pods Frameworks */ = { + B9A6DC2DA5EF736659D70D5F /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -343,38 +356,26 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example-exampleTests/Pods-example-exampleTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - F3C40C0DFA051B78EC9F148B /* [CP] Copy Pods Resources */ = { + F5A4A708535B38A022E6C22A /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist", ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - F4D57F5DD05AF02E494D1836 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist", + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; FD10A7F022414F080027D42C /* Start Packager */ = { @@ -411,7 +412,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, + 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -429,7 +430,7 @@ /* Begin XCBuildConfiguration section */ 00E356F61AD99517003FC87E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 07D7DD1A4B197AF1FFC69665 /* Pods-example-exampleTests.debug.xcconfig */; + baseConfigurationReference = 88C69C238BBDD5452DF4E3B2 /* Pods-example-exampleTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -437,7 +438,7 @@ "$(inherited)", ); INFOPLIST_FILE = exampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -456,12 +457,12 @@ }; 00E356F71AD99517003FC87E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 71D9DE764177ACCC379079BE /* Pods-example-exampleTests.release.xcconfig */; + baseConfigurationReference = 7535B591744F88B9F83E699B /* Pods-example-exampleTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; INFOPLIST_FILE = exampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -480,7 +481,7 @@ }; 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 54A4D01A90408A3FF978BF9F /* Pods-example.debug.xcconfig */; + baseConfigurationReference = 43596BD23C90573F1E2EE008 /* Pods-example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -500,13 +501,14 @@ PRODUCT_NAME = example; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 382717C75894DA17E9815D7E /* Pods-example.release.xcconfig */; + baseConfigurationReference = 6634AEAC213561B7785C9565 /* Pods-example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -524,6 +526,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = example; SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -533,7 +536,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -561,7 +564,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -577,18 +580,25 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", - "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", ); MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; name = Debug; @@ -598,7 +608,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -626,7 +636,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -635,17 +645,24 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", ); LIBRARY_SEARCH_PATHS = ( + "\"$(SDKROOT)/usr/lib/swift\"", "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", - "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", "\"$(inherited)\"", ); MTL_ENABLE_DEBUG_INFO = NO; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; diff --git a/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/example/AppDelegate.m b/example/ios/example/AppDelegate.m deleted file mode 100644 index 1ea8ea4..0000000 --- a/example/ios/example/AppDelegate.m +++ /dev/null @@ -1,62 +0,0 @@ -#import "AppDelegate.h" - -#import -#import -#import - -#ifdef FB_SONARKIT_ENABLED -#import -#import -#import -#import -#import -#import - -static void InitializeFlipper(UIApplication *application) { - FlipperClient *client = [FlipperClient sharedClient]; - SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; - [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; - [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; - [client addPlugin:[FlipperKitReactPlugin new]]; - [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; - [client start]; -} -#endif - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ -#ifdef FB_SONARKIT_ENABLED - InitializeFlipper(application); -#endif - - RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge - moduleName:@"example" - initialProperties:nil]; - - 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; -} - -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ -#if DEBUG - return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; -#else - return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; -#endif -} - -@end diff --git a/example/ios/example/AppDelegate.mm b/example/ios/example/AppDelegate.mm new file mode 100644 index 0000000..1a05b82 --- /dev/null +++ b/example/ios/example/AppDelegate.mm @@ -0,0 +1,133 @@ +#import "AppDelegate.h" + +#import +#import +#import + +#import + +#if RCT_NEW_ARCH_ENABLED +#import +#import +#import +#import +#import +#import + +#import + +static NSString *const kRNConcurrentRoot = @"concurrentRoot"; + +@interface AppDelegate () { + RCTTurboModuleManager *_turboModuleManager; + RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; + std::shared_ptr _reactNativeConfig; + facebook::react::ContextContainer::Shared _contextContainer; +} +@end +#endif + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + RCTAppSetupPrepareApp(application); + + RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; + +#if RCT_NEW_ARCH_ENABLED + _contextContainer = std::make_shared(); + _reactNativeConfig = std::make_shared(); + _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); + _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; + bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; +#endif + + NSDictionary *initProps = [self prepareInitialProps]; + UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"example", 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; +} + +/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. +/// +/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html +/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). +/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`. +- (BOOL)concurrentRootEnabled +{ + // Switch this bool to turn on and off the concurrent root + return true; +} + +- (NSDictionary *)prepareInitialProps +{ + NSMutableDictionary *initProps = [NSMutableDictionary new]; + +#ifdef RCT_NEW_ARCH_ENABLED + initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); +#endif + + return initProps; +} + +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge +{ +#if DEBUG + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; +#else + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; +#endif +} + +#if RCT_NEW_ARCH_ENABLED + +#pragma mark - RCTCxxBridgeDelegate + +- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge +{ + _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge + delegate:self + jsInvoker:bridge.jsCallInvoker]; + return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); +} + +#pragma mark RCTTurboModuleManagerDelegate + +- (Class)getModuleClassFromName:(const char *)name +{ + return RCTCoreModulesClassProvider(name); +} + +- (std::shared_ptr)getTurboModule:(const std::string &)name + jsInvoker:(std::shared_ptr)jsInvoker +{ + return nullptr; +} + +- (std::shared_ptr)getTurboModule:(const std::string &)name + initParams: + (const facebook::react::ObjCTurboModule::InitParams &)params +{ + return nullptr; +} + +- (id)getModuleInstanceFromClass:(Class)moduleClass +{ + return RCTAppSetupDefaultModuleFromClass(moduleClass); +} + +#endif + +@end diff --git a/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json b/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json index 118c98f..8121323 100644 --- a/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json @@ -2,37 +2,52 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/example/ios/example/main.m b/example/ios/example/main.m index b1df44b..d645c72 100644 --- a/example/ios/example/main.m +++ b/example/ios/example/main.m @@ -2,7 +2,8 @@ #import "AppDelegate.h" -int main(int argc, char * argv[]) { +int main(int argc, char *argv[]) +{ @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } diff --git a/example/ios/exampleTests/exampleTests.m b/example/ios/exampleTests/exampleTests.m index 9809b80..6f94430 100644 --- a/example/ios/exampleTests/exampleTests.m +++ b/example/ios/exampleTests/exampleTests.m @@ -13,7 +13,7 @@ @interface exampleTests : XCTestCase @implementation exampleTests -- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test +- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test { if (test(view)) { return YES; @@ -34,23 +34,25 @@ - (void)testRendersWelcomeScreen __block NSString *redboxError = nil; #ifdef DEBUG - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; - } - }); + RCTSetLogFunction( + ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { + if (level >= RCTLogLevelError) { + redboxError = message; + } + }); #endif while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; + foundElement = [self findSubviewInView:vc.view + matching:^BOOL(UIView *view) { + if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { + return YES; + } + return NO; + }]; } #ifdef DEBUG @@ -61,5 +63,4 @@ - (void)testRendersWelcomeScreen XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); } - @end diff --git a/example/package.json b/example/package.json index 878f745..4e9046f 100644 --- a/example/package.json +++ b/example/package.json @@ -7,31 +7,43 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "jest", - "lint": "eslint .", - "bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", + "lint": "eslint . --ext .js,.jsx,.ts,.tsx", + "bundle:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res", "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force", "clean:android": "cd android && ./gradlew clean && cd ..", "clean:ios": "cd ios && pod cache clean --all;rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;" }, "dependencies": { - "react": "17.0.2", - "react-native": "0.66.4", + "react": "18.0.0", + "react-native": "0.69.2", "react-native-inappbrowser-reborn": "file:.." }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", + "@tsconfig/react-native": "^2.0.2", + "@types/jest": "^26.0.23", + "@types/react-native": "^0.69.3", + "@types/react-test-renderer": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^5.29.0", + "@typescript-eslint/parser": "^5.29.0", "babel-jest": "^26.6.3", - "eslint": "7.14.0", + "eslint": "^7.32.0", "jest": "^26.6.3", - "metro-react-native-babel-preset": "^0.66.2", - "react-test-renderer": "17.0.2" + "metro-react-native-babel-preset": "^0.70.3", + "react-test-renderer": "18.0.0", + "typescript": "^4.4.4" }, "jest": { "preset": "react-native", - "transformIgnorePatterns": [ - "node_modules/(?!(jest-)?react-native.*|@react-native-community)/" + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "jsx", + "json", + "node" ] } } diff --git a/example/App.js b/example/src/App.tsx similarity index 53% rename from example/App.js rename to example/src/App.tsx index 880b57a..e80f401 100644 --- a/example/App.js +++ b/example/src/App.tsx @@ -1,9 +1,5 @@ /** - * Sample React Native App - * https://github.com/facebook/react-native - * * @format - * @flow strict-local */ import React, {useEffect, useCallback, useState} from 'react'; @@ -15,9 +11,14 @@ import { TextInput, View, Button, + SafeAreaView, + StatusBarStyle, + useColorScheme, + ScrollView, } from 'react-native'; import {openLink, tryDeepLinking} from './utils'; import {InAppBrowser} from 'react-native-inappbrowser-reborn'; +import {Colors} from 'react-native/Libraries/NewAppScreen'; const instructions = Platform.select({ ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', @@ -28,7 +29,7 @@ const instructions = Platform.select({ const App = () => { const [url, setUrl] = useState('https://reactnative.dev'); - const [statusBarStyle] = useState('dark-content'); + const [statusBarStyle] = useState('dark-content'); useEffect(() => { InAppBrowser.mayLaunchUrl('https://reactnative.dev', []); @@ -38,26 +39,40 @@ const App = () => { await openLink(url, statusBarStyle); }, [url, statusBarStyle]); + const isDarkMode = useColorScheme() === 'dark'; + + const backgroundStyle = { + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, + flex: 1, + height: '100%', + }; + return ( - + - - {'Welcome InAppBrowser\nfor React Native!'} - - Type the url - setUrl(text)} - value={url} - /> - -