diff --git a/.gitignore b/.gitignore index a341533ec4f..be2c9010fff 100644 --- a/.gitignore +++ b/.gitignore @@ -171,6 +171,7 @@ android/captures/ # Intellij *.iml +*.hprof # Keystore files *.jks @@ -237,4 +238,4 @@ playground/ios/Podfile.lock website/package-lock.json # detox artifacts -artifacts/ \ No newline at end of file +artifacts/ diff --git a/autolink/postlink/gradleLinker.js b/autolink/postlink/gradleLinker.js index 019531f8b04..2a5984e9dc7 100644 --- a/autolink/postlink/gradleLinker.js +++ b/autolink/postlink/gradleLinker.js @@ -3,7 +3,7 @@ var path = require('./path'); var fs = require('fs'); var { warnn, errorn, logn, infon, debugn } = require('./log'); var { insertString } = require('./stringUtils'); -var DEFAULT_KOTLIN_VERSION = '1.4.31'; +var DEFAULT_KOTLIN_VERSION = '1.5.31'; // This should be the minSdkVersion required for RNN. var DEFAULT_MIN_SDK_VERSION = 21; diff --git a/babel.config.js b/babel.config.js index c1d044b7c29..7d688a04fb7 100644 --- a/babel.config.js +++ b/babel.config.js @@ -3,6 +3,7 @@ module.exports = function (api) { return { presets: ['module:metro-react-native-babel-preset'], plugins: [ + 'react-native-reanimated/plugin', '@babel/plugin-proposal-export-namespace-from', '@babel/plugin-proposal-export-default-from', ], diff --git a/e2e/config.json b/e2e/config.json index 4a18907cd52..6640a550291 100644 --- a/e2e/config.json +++ b/e2e/config.json @@ -1,7 +1,7 @@ { "globalSetup": "./global-setup.js", "globalTeardown": "./global-teardown.js", - "setupTestFrameworkScriptFile" : "./init.js", + "setupFilesAfterEnv" : ["./init.js"], "testEnvironment": "node", "bail": true, "verbose": true, diff --git a/jest-setup.js b/jest-setup.js index 1cd3444f44d..7614f84e1bd 100644 --- a/jest-setup.js +++ b/jest-setup.js @@ -1,3 +1,4 @@ +import 'react-native-gesture-handler/jestSetup'; const { mockDetox } = require('detox-testing-library-rnn-adapter'); mockDetox(() => require('./playground/index')); diff --git a/lib/android/app/build.gradle b/lib/android/app/build.gradle index 51148fea824..30267749385 100644 --- a/lib/android/app/build.gradle +++ b/lib/android/app/build.gradle @@ -1,29 +1,32 @@ -import groovy.json.JsonSlurper import org.gradle.api.tasks.testing.logging.TestExceptionFormat apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } -def DEFAULT_COMPILE_SDK_VERSION = 29 -def DEFAULT_MIN_SDK_VERSION = 19 -def DEFAULT_TARGET_SDK_VERSION = 29 -def kotlinVersion = rootProject.ext.get("RNNKotlinVersion") -def kotlinStdlib = safeExtGet('RNNKotlinStdlib', 'kotlin-stdlib-jdk8') -def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.4.3') +def safeExtGetFallbackLowerBound(prop, fallback) { + Math.max(safeExtGet(prop,fallback),fallback) +} + + +def DEFAULT_COMPILE_SDK_VERSION = 30 +def DEFAULT_MIN_SDK_VERSION = 21 +def DEFAULT_TARGET_SDK_VERSION = 30 +def DEFAULT_KOTLIN_VERSION = "1.5.31" +def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8' +def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION) +def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB ) +def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2') android { - compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) + compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) - versionCode 1 - versionName "1.0" + minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION) + targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) } buildTypes { release { @@ -69,94 +72,6 @@ android { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 } - - flavorDimensions "RNN.reactNativeVersion" - productFlavors { - reactNative51 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "51") - } - reactNative55 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "55") - } - reactNative56 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "56") - } - reactNative57 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "57") - } - reactNative57_5 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "57") - } - reactNative60 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "60") - } - reactNative62 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "62") - } - reactNative63 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "63") - } - } - - def flavor = resolveFlavor() - variantFilter { variant -> - def names = variant.flavors*.name - if (!names.contains(flavor)) { - setIgnore(true) - } - } -} - -String resolveFlavor() { - List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson()) - Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger() - Integer reactNativePatchComponent = reactNativeVersionComponents[2].toInteger() - - if (reactNativeMinorComponent >= 63) { - return "reactNative63" - } else if (reactNativeMinorComponent >= 62) { - return "reactNative62" - } else if (reactNativeMinorComponent >= 60) { - return "reactNative60" - } else if (reactNativeMinorComponent >= 57 && reactNativePatchComponent >= 5) { - return "reactNative57_5" - } else if (reactNativeMinorComponent >= 57) { - return "reactNative57" - } else if (reactNativeMinorComponent >= 56) { - return "reactNative56" - } else if (reactNativeMinorComponent >= 55) { - return "reactNative55" - } else if (reactNativeMinorComponent >= 51) { - return "reactNative51" - } -} - - -Object findReactNativePackageJson() { - def searchPath = 'node_modules/react-native/package.json' - def projectDir = project.projectDir.toString() + '/' - def rnPackageJsonFile = new File(projectDir + searchPath) - while (!rnPackageJsonFile.exists()) { - searchPath = '../' + searchPath - rnPackageJsonFile = new File(projectDir + searchPath) - } - return rnPackageJsonFile -} - -List reactNativeVersionComponents(rnPackageJsonFile) { - def packageSlurper = new JsonSlurper() - def reactNativePackageJson = packageSlurper.parseText(rnPackageJsonFile.text) - def reactNativeVersion = reactNativePackageJson.version - - return reactNativeVersion.tokenize('-')[0].tokenize('.') } allprojects { p -> @@ -170,17 +85,16 @@ allprojects { p -> } dependencies { - implementation "androidx.core:core-ktx:1.3.2" + implementation "androidx.core:core-ktx:1.6.0" implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesCore" implementation "androidx.constraintlayout:constraintlayout:2.0.4" - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.annotation:annotation:1.1.0' - implementation 'com.google.android.material:material:1.2.0-alpha03' + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'androidx.annotation:annotation:1.2.0' + implementation 'com.google.android.material:material:1.4.0' implementation 'com.github.wix-playground:ahbottomnavigation:3.3.0' -// implementation project(':AHBottomNavigation') implementation 'com.github.wix-playground:reflow-animator:1.0.6' implementation 'com.github.clans:fab:1.6.4' diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt b/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt index 4aeee3225d8..1e20a318aa7 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt @@ -30,4 +30,4 @@ open class HardwareBackButtonOptions(json: JSONObject? = null) { dismissModalOnPress = BoolParser.parse(json, "dismissModalOnPress") popStackOnPress = BoolParser.parse(json, "popStackOnPress") } -} \ No newline at end of file +} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/options/parsers/ColorParser.kt b/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/ColorParser.kt similarity index 99% rename from lib/android/app/src/reactNative63/java/com/reactnativenavigation/options/parsers/ColorParser.kt rename to lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/ColorParser.kt index 857af348911..8ccda494363 100644 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/options/parsers/ColorParser.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/ColorParser.kt @@ -35,4 +35,4 @@ object ColorParser { } } -} \ No newline at end of file +} diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java similarity index 100% rename from lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/react/DevPermissionRequest.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/DevPermissionRequest.java index b7786f564ff..53d0fe22cf4 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/react/DevPermissionRequest.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/DevPermissionRequest.java @@ -22,7 +22,6 @@ public DevPermissionRequest(boolean isDebug) { public boolean shouldAskPermission(Activity activity) { return isDebug && Build.VERSION.SDK_INT >= 23 && - BuildConfig.REACT_NATVE_VERSION_MINOR <= 51 && !Settings.canDrawOverlays(activity); } diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java similarity index 100% rename from lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactNativeHost.java similarity index 94% rename from lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactNativeHost.java index 9b1bd158f3a..17d5b53e46e 100644 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactNativeHost.java @@ -1,5 +1,9 @@ package com.reactnativenavigation.react; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.facebook.hermes.reactexecutor.HermesExecutorFactory; import com.facebook.infer.annotation.Assertions; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactInstanceManagerBuilder; @@ -9,9 +13,6 @@ import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; import com.reactnativenavigation.NavigationApplication; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { private @Nullable NavigationDevBundleDownloadListener bundleListener; @@ -39,7 +40,7 @@ protected ReactInstanceManager createReactInstanceManager() { .setJSMainModulePath(getJSMainModuleName()) .setUseDeveloperSupport(getUseDeveloperSupport()) .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) + .setJavaScriptExecutorFactory(new HermesExecutorFactory()) .setUIImplementationProvider(getUIImplementationProvider()) .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) .setJSIModulesPackage(getJSIModulePackage()) diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java similarity index 100% rename from lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReactGateway.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java index 035ec31b2c5..6a091703112 100644 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReactGateway.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java @@ -4,11 +4,11 @@ import android.content.Intent; import android.content.res.Configuration; +import androidx.annotation.NonNull; + import com.facebook.react.ReactNativeHost; import com.reactnativenavigation.NavigationActivity; -import androidx.annotation.NonNull; - public class ReactGateway { private final ReactNativeHost host; diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/ReloadHandlerFacade.java similarity index 100% rename from lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/ReloadHandlerFacade.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/ReloadHandlerFacade.java diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt b/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt index da7d5b1b4f9..b70d3e13c52 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt @@ -26,7 +26,7 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ hasAdjustedSize = false val viewTag = getChildAt(0).id val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { + reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext.exceptionHandler) { override fun runGuarded() { val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( UIManagerModule::class.java diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt b/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt index 23a93c54060..cad2373e2a3 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt @@ -1,7 +1,10 @@ package com.reactnativenavigation.react.modal import android.content.Context +import android.graphics.Insets import android.graphics.Point +import android.os.Build +import android.view.WindowInsets import android.view.WindowManager import com.facebook.infer.annotation.Assertions import com.facebook.react.bridge.ReactContext @@ -116,7 +119,24 @@ private fun getModalHostSize(context: Context): Point { // getCurrentSizeRange will return the min and max width and height that the window can be display.getCurrentSizeRange(MIN_POINT, MAX_POINT) // getSize will return the dimensions of the screen in its current orientation - display.getSize(SIZE_POINT) + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + val metrics = wm.currentWindowMetrics + val bounds = wm.currentWindowMetrics.bounds + val windowInsets: WindowInsets = metrics.windowInsets + val insets: Insets = windowInsets.getInsetsIgnoringVisibility( + WindowInsets.Type.navigationBars() + or WindowInsets.Type.displayCutout() + ) + + val insetsWidth: Int = insets.right + insets.left + val insetsHeight: Int = insets.top + insets.bottom + + SIZE_POINT.set(bounds.width() - insetsWidth, bounds.height() - insetsHeight) + + } else { + display.getSize(SIZE_POINT) + } val attrs = intArrayOf(android.R.attr.windowFullscreen) val theme = context.theme val ta = theme.obtainStyledAttributes(attrs) diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java index 81382b1a589..3895cd0e7d6 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java @@ -7,6 +7,8 @@ import com.reactnativenavigation.options.ModalPresentationStyle; import com.reactnativenavigation.options.Options; import com.reactnativenavigation.react.CommandListener; +import com.reactnativenavigation.react.CommandListenerAdapter; +import com.reactnativenavigation.utils.ContextKt; import com.reactnativenavigation.utils.ScreenAnimationListener; import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController; @@ -45,7 +47,6 @@ void showModal(ViewController appearing, ViewController disappearing, Comm listener.onError("Can not show modal before activity is created"); return; } - Options options = appearing.resolveCurrentOptions(defaultOptions); AnimationOptions enterAnimationOptions = options.animations.showModal.getEnter(); @@ -53,7 +54,7 @@ void showModal(ViewController appearing, ViewController disappearing, Comm modalsLayout.setVisibility(View.VISIBLE); modalsLayout.addView(appearing.getView(), matchParentLP()); - if (enterAnimationOptions.enabled.isTrueOrUndefined()) { + if ( enterAnimationOptions.enabled.isTrueOrUndefined()) { if (enterAnimationOptions.shouldWaitForRender().isTrue()) { appearing.addOnAppearedListener(() -> modalAnimator.show(appearing, disappearing, options.animations.showModal, createListener(appearing, disappearing, listener))); } else { @@ -90,10 +91,12 @@ public void onCancel() { } private void onShowModalEnd(ViewController toAdd, @Nullable ViewController toRemove, CommandListener listener) { - toAdd.onViewDidAppear(); - if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) { - toRemove.detachView(); - } + toAdd.addOnAppearedListener(()->{ + toAdd.onViewDidAppear(); + if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) { + toRemove.detachView(); + } + }); listener.onSuccess(toAdd.getId()); } diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java index b933b8bd871..2768e335a94 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java @@ -175,9 +175,7 @@ public void push(ViewController child, CommandListener listener) { presenter.getAdditionalPushAnimations(this, child, resolvedOptions), () -> onPushAnimationComplete(child, toRemove, listener)); } else { - child.onViewDidAppear(); - getView().removeView(toRemove.getView()); - listener.onSuccess(child.getId()); + onPushAnimationComplete(child, toRemove, listener); } } else { listener.onSuccess(child.getId()); @@ -191,8 +189,10 @@ public void destroy() { } private void onPushAnimationComplete(ViewController toAdd, ViewController toRemove, CommandListener listener) { - toAdd.onViewDidAppear(); - if (!peek().equals(toRemove)) getView().removeView(toRemove.getView()); + toAdd.addOnAppearedListener(() -> { + toAdd.onViewDidAppear(); + if (!peek().equals(toRemove)) getView().removeView(toRemove.getView()); + }); listener.onSuccess(toAdd.getId()); } diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt index 62fac1b7cc6..425bb0fad29 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt @@ -8,11 +8,12 @@ import androidx.core.view.get import com.reactnativenavigation.utils.isDebug import java.util.* -open class YellowBoxDelegate(private val context: Context, private val yellowBoxHelper: YellowBoxHelper = YellowBoxHelper()) { - constructor(context: Context) : this(context, YellowBoxHelper()) + +open class YellowBoxDelegate(private val context: Context) { var parent: ViewGroup? = null private set + @get:RestrictTo(RestrictTo.Scope.TESTS) val yellowBoxes: List get() = yellowBoxViews @@ -22,7 +23,7 @@ open class YellowBoxDelegate(private val context: Context, private val yellowBox open fun onChildViewAdded(parent: View, child: View?) { if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) + if (isYellowBox(parent, child)) onYellowBoxAdded(parent) } fun onYellowBoxAdded(parent: View) { @@ -39,4 +40,9 @@ open class YellowBoxDelegate(private val context: Context, private val yellowBox isDestroyed = true if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } } + + fun isYellowBox(parent: View?, child: View?): Boolean { + return parent is ViewGroup && + child is ViewGroup && parent.indexOfChild(child) >= 1 + } } \ No newline at end of file diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index b3a34cfbac6..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 0c5f74c0ebb..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 8ff7f4dc12b..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -/** - * Default implementation of {@link ReactNativeHost} that includes {@link NavigationPackage} - * and user-defined additional packages. - */ -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 69ed8e0e5ec..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/SyncUiImplementation.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/SyncUiImplementation.java deleted file mode 100644 index 1009b901d19..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/SyncUiImplementation.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.reactnativenavigation.react; - -import androidx.annotation.Nullable; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.MeasureSpecProvider; -import com.facebook.react.uimanager.SizeMonitoringFrameLayout; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIImplementation; -import com.facebook.react.uimanager.UIImplementationProvider; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.events.EventDispatcher; - -import java.util.List; - -@SuppressWarnings("WeakerAccess") -public class SyncUiImplementation extends UIImplementation { - private static final Object lock = new Object(); - - public static class Provider extends UIImplementationProvider { - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - } - - public SyncUiImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - public SyncUiImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public void manageChildren( - int viewTag, - @Nullable ReadableArray moveFrom, - @Nullable ReadableArray moveTo, - @Nullable ReadableArray addChildTags, - @Nullable ReadableArray addAtIndices, - @Nullable ReadableArray removeFrom) { - synchronized (lock) { - super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom); - } - } - - @Override - public void setChildren(int viewTag, ReadableArray childrenTags) { - synchronized (lock) { - super.setChildren(viewTag, childrenTags); - } - } - - @Override - public void createView(int tag, String className, int rootViewTag, ReadableMap props) { - synchronized (lock) { - super.createView(tag, className, rootViewTag, props); - } - } - - @Override - public void removeRootShadowNode(int rootViewTag) { - synchronized (lock) { - super.removeRootShadowNode(rootViewTag); - } - } - - @Override - public void registerRootView(T rootView, int tag, ThemedReactContext context) { - synchronized (lock) { - super.registerRootView(rootView, tag, context); - } - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index b3a34cfbac6..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 0c5f74c0ebb..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index e587d0467de..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -/** - * Default implementation of {@link ReactNativeHost} that includes {@link NavigationPackage} - * and user-defined additional packages. - */ -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesProvider(getJSIModulesProvider()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 69ed8e0e5ec..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index f30f66b91b6..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/SyncUiImplementation.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/SyncUiImplementation.java deleted file mode 100644 index 931f8a147b9..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/SyncUiImplementation.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.reactnativenavigation.react; - -import androidx.annotation.Nullable; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIImplementation; -import com.facebook.react.uimanager.UIImplementationProvider; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.common.MeasureSpecProvider; -import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout; -import com.facebook.react.uimanager.events.EventDispatcher; - -import java.util.List; - -@SuppressWarnings("WeakerAccess") -public class SyncUiImplementation extends UIImplementation { - private static final Object lock = new Object(); - - public static class Provider extends UIImplementationProvider { - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - } - - public SyncUiImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - public SyncUiImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public void manageChildren( - int viewTag, - @Nullable ReadableArray moveFrom, - @Nullable ReadableArray moveTo, - @Nullable ReadableArray addChildTags, - @Nullable ReadableArray addAtIndices, - @Nullable ReadableArray removeFrom) { - synchronized (lock) { - super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom); - } - } - - @Override - public void setChildren(int viewTag, ReadableArray childrenTags) { - synchronized (lock) { - super.setChildren(viewTag, childrenTags); - } - } - - @Override - public void createView(int tag, String className, int rootViewTag, ReadableMap props) { - synchronized (lock) { - super.createView(tag, className, rootViewTag, props); - } - } - - @Override - public void removeRootShadowNode(int rootViewTag) { - synchronized (lock) { - super.removeRootShadowNode(rootViewTag); - } - } - - @Override - public void registerRootView(T rootView, int tag, ThemedReactContext context) { - synchronized (lock) { - super.registerRootView(rootView, tag, context); - } - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index 86af8ca5768..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 919fe4af048..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - @Override - public void onSuccess() { - - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index c563d02d9a4..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -/** - * Default implementation of {@link ReactNativeHost} that includes {@link NavigationPackage} - * and user-defined additional packages. - */ -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesPackage(getJSIModulePackage()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 69ed8e0e5ec..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index 697ea43e48a..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - protected abstract void onSuccess(); -} diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/SyncUiImplementation.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/SyncUiImplementation.java deleted file mode 100644 index 931f8a147b9..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/SyncUiImplementation.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.reactnativenavigation.react; - -import androidx.annotation.Nullable; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIImplementation; -import com.facebook.react.uimanager.UIImplementationProvider; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.common.MeasureSpecProvider; -import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout; -import com.facebook.react.uimanager.events.EventDispatcher; - -import java.util.List; - -@SuppressWarnings("WeakerAccess") -public class SyncUiImplementation extends UIImplementation { - private static final Object lock = new Object(); - - public static class Provider extends UIImplementationProvider { - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - } - - public SyncUiImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - public SyncUiImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public void manageChildren( - int viewTag, - @Nullable ReadableArray moveFrom, - @Nullable ReadableArray moveTo, - @Nullable ReadableArray addChildTags, - @Nullable ReadableArray addAtIndices, - @Nullable ReadableArray removeFrom) { - synchronized (lock) { - super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom); - } - } - - @Override - public void setChildren(int viewTag, ReadableArray childrenTags) { - synchronized (lock) { - super.setChildren(viewTag, childrenTags); - } - } - - @Override - public void createView(int tag, String className, int rootViewTag, ReadableMap props) { - synchronized (lock) { - super.createView(tag, className, rootViewTag, props); - } - } - - @Override - public void removeRootShadowNode(int rootViewTag) { - synchronized (lock) { - super.removeRootShadowNode(rootViewTag); - } - } - - @Override - public void registerRootView(T rootView, int tag, ThemedReactContext context) { - synchronized (lock) { - super.registerRootView(rootView, tag, context); - } - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index 86af8ca5768..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 919fe4af048..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - @Override - public void onSuccess() { - - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index b447eb13d08..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -/** - * Default implementation of {@link ReactNativeHost} that includes {@link NavigationPackage} - * and user-defined additional packages. - */ -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesPackage(getJSIModulePackage()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 69ed8e0e5ec..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index 697ea43e48a..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - protected abstract void onSuccess(); -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/SyncUiImplementation.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/SyncUiImplementation.java deleted file mode 100644 index 536b4bab231..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/SyncUiImplementation.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import androidx.annotation.Nullable; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIImplementation; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.common.MeasureSpecProvider; -import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout; -import com.facebook.react.uimanager.events.EventDispatcher; - -import java.util.List; - -@SuppressWarnings("WeakerAccess") -public class SyncUiImplementation extends UIImplementation { - private static final Object lock = new Object(); - - public SyncUiImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - public SyncUiImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public void manageChildren( - int viewTag, - @Nullable ReadableArray moveFrom, - @Nullable ReadableArray moveTo, - @Nullable ReadableArray addChildTags, - @Nullable ReadableArray addAtIndices, - @Nullable ReadableArray removeFrom) { - synchronized (lock) { - super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom); - } - } - - @Override - public void setChildren(int viewTag, ReadableArray childrenTags) { - synchronized (lock) { - super.setChildren(viewTag, childrenTags); - } - } - - @Override - public void createView(int tag, String className, int rootViewTag, ReadableMap props) { - synchronized (lock) { - super.createView(tag, className, rootViewTag, props); - } - } - - @Override - public void removeRootShadowNode(int rootViewTag) { - synchronized (lock) { - super.removeRootShadowNode(rootViewTag); - } - } - - @Override - public void registerRootView(T rootView, int tag, ThemedReactContext context) { - synchronized (lock) { - super.registerRootView(rootView, tag, context); - } - } -} diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index 86af8ca5768..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 919fe4af048..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - @Override - public void onSuccess() { - - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 321fb55e961..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -/** - * Default implementation of {@link ReactNativeHost} that includes {@link NavigationPackage} - * and user-defined additional packages. - */ -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesPackage(getJSIModulePackage()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 69ed8e0e5ec..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index 697ea43e48a..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - protected abstract void onSuccess(); -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/SyncUiImplementation.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/SyncUiImplementation.java deleted file mode 100644 index 5c2698cdb05..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/SyncUiImplementation.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.reactnativenavigation.react; - -import androidx.annotation.Nullable; - -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIImplementation; -import com.facebook.react.uimanager.UIImplementationProvider; -import com.facebook.react.uimanager.UIManagerModule; -import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.common.MeasureSpecProvider; -import com.facebook.react.uimanager.common.SizeMonitoringFrameLayout; -import com.facebook.react.uimanager.events.EventDispatcher; - -import java.util.List; - -@SuppressWarnings("WeakerAccess") -public class SyncUiImplementation extends UIImplementation { - private static final Object lock = new Object(); - - public static class Provider extends UIImplementationProvider { - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public UIImplementation createUIImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - return new SyncUiImplementation(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - } - - public SyncUiImplementation(ReactApplicationContext reactContext, List viewManagerList, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerList, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - public SyncUiImplementation(ReactApplicationContext reactContext, UIManagerModule.ViewManagerResolver viewManagerResolver, EventDispatcher eventDispatcher, int minTimeLeftInFrameForNonBatchedOperationMs) { - super(reactContext, viewManagerResolver, eventDispatcher, minTimeLeftInFrameForNonBatchedOperationMs); - } - - @Override - public void manageChildren( - int viewTag, - @Nullable ReadableArray moveFrom, - @Nullable ReadableArray moveTo, - @Nullable ReadableArray addChildTags, - @Nullable ReadableArray addAtIndices, - @Nullable ReadableArray removeFrom) { - synchronized (lock) { - super.manageChildren(viewTag, moveFrom, moveTo, addChildTags, addAtIndices, removeFrom); - } - } - - @Override - public void setChildren(int viewTag, ReadableArray childrenTags) { - synchronized (lock) { - super.setChildren(viewTag, childrenTags); - } - } - - @Override - public void createView(int tag, String className, int rootViewTag, ReadableMap props) { - synchronized (lock) { - super.createView(tag, className, rootViewTag, props); - } - } - - @Override - public void removeRootShadowNode(int rootViewTag) { - synchronized (lock) { - super.removeRootShadowNode(rootViewTag); - } - } - - @Override - public void registerRootView(T rootView, int tag, ThemedReactContext context) { - synchronized (lock) { - super.registerRootView(rootView, tag, context); - } - } -} diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index 86af8ca5768..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index 919fe4af048..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - @Override - public void onSuccess() { - - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 7f3e074dbad..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Application; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - @SuppressWarnings("WeakerAccess") - public NavigationReactNativeHost(Application application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesPackage(getJSIModulePackage()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 5003e711951..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - // noop, needs rn >= 0.62 - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, final int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index 697ea43e48a..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.bridge.NativeDeltaClient; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess(@Nullable NativeDeltaClient nativeDeltaClient) { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } - - protected abstract void onSuccess(); -} diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/options/parsers/ColorParser.java b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/options/parsers/ColorParser.java deleted file mode 100644 index f6ff316278a..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/options/parsers/ColorParser.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.reactnativenavigation.options.parsers; - -import android.content.Context; - -import com.reactnativenavigation.options.params.Colour; -import com.reactnativenavigation.options.params.DontApplyColour; -import com.reactnativenavigation.options.params.NullColor; - -import org.json.JSONObject; - -public class ColorParser { - public static Colour parse(Context context, JSONObject json, String color) { - if (json.has(color)) { - return json.opt(color) instanceof Integer ? new Colour(json.optInt(color)) : new DontApplyColour(); - } - return new NullColor(); - } -} diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 0391aa6d22e..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactInstanceManagerBuilder; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.common.LifecycleState; -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; -import com.reactnativenavigation.NavigationApplication; -import com.reactnativenavigation.react.DevBundleDownloadListenerAdapter; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider { - - private @Nullable NavigationDevBundleDownloadListener bundleListener; - private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() { - @Override - public void onSuccess() { - if (bundleListener != null) { - bundleListener.onSuccess(); - } - } - }; - - public NavigationReactNativeHost(NavigationApplication application) { - super(application); - } - - @Override - public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) { - bundleListener = listener; - } - - protected ReactInstanceManager createReactInstanceManager() { - ReactInstanceManagerBuilder builder = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setJSMainModulePath(getJSMainModuleName()) - .setUseDeveloperSupport(getUseDeveloperSupport()) - .setRedBoxHandler(getRedBoxHandler()) - .setJavaScriptExecutorFactory(getJavaScriptExecutorFactory()) - .setUIImplementationProvider(getUIImplementationProvider()) - .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) - .setJSIModulesPackage(getJSIModulePackage()) - .setDevBundleDownloadListener(getDevBundleDownloadListener()); - - for (ReactPackage reactPackage : getPackages()) { - builder.addPackage(reactPackage); - } - - String jsBundleFile = getJSBundleFile(); - if (jsBundleFile != null) { - builder.setJSBundleFile(jsBundleFile); - } else { - builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); - } - return builder.build(); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected DevBundleDownloadListener getDevBundleDownloadListener() { - return bundleListenerMediator; - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index f30f66b91b6..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index f905d8a3cdc..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -import com.facebook.react.views.view.ReactViewBackgroundDrawable; -import com.reactnativenavigation.utils.ViewUtils; - -import androidx.annotation.NonNull; - -import static com.reactnativenavigation.utils.ViewUtils.findChildrenByClassRecursive; - -public class YellowBoxHelper { - private final static int YELLOW_BOX_COLOR = -218449360; - - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).getChildCount() > 1 && - !findChildrenByClassRecursive((ViewGroup) child, View.class, YellowBackgroundMatcher()).isEmpty(); - } - - @NonNull - private static ViewUtils.Matcher YellowBackgroundMatcher() { - return child1 -> child1.getBackground() instanceof ReactViewBackgroundDrawable && ((ReactViewBackgroundDrawable) child1.getBackground()).getColor() == YELLOW_BOX_COLOR; - } -} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index d5ad33c75c5..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess() { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index feb40fb680e..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener { - @Override - public void onSuccess() { - onSuccess(); - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 035ec31b2c5..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReactGateway.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.reactnativenavigation.react; - -import android.app.Activity; -import android.content.Intent; -import android.content.res.Configuration; - -import com.facebook.react.ReactNativeHost; -import com.reactnativenavigation.NavigationActivity; - -import androidx.annotation.NonNull; - -public class ReactGateway { - - private final ReactNativeHost host; - private final NavigationReactInitializer initializer; - private final JsDevReloadHandler jsDevReloadHandler; - - public ReactGateway(ReactNativeHost host) { - this.host = host; - initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport()); - jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager()); - if (host instanceof BundleDownloadListenerProvider) { - ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); - } - } - - public void onActivityCreated(NavigationActivity activity) { - initializer.onActivityCreated(); - jsDevReloadHandler.setReloadListener(activity); - } - - public void onActivityResumed(NavigationActivity activity) { - initializer.onActivityResumed(activity); - jsDevReloadHandler.onActivityResumed(activity); - } - - public boolean onNewIntent(Intent intent) { - if (host.hasInstance()) { - host.getReactInstanceManager().onNewIntent(intent); - return true; - } - return false; - } - - public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) { - if (host.hasInstance()) { - host.getReactInstanceManager().onConfigurationChanged(activity, newConfig); - } - } - - public void onActivityPaused(NavigationActivity activity) { - initializer.onActivityPaused(activity); - jsDevReloadHandler.onActivityPaused(activity); - } - - public void onActivityDestroyed(NavigationActivity activity) { - jsDevReloadHandler.removeReloadListener(activity); - initializer.onActivityDestroyed(activity); - } - - public boolean onKeyUp(Activity activity, int keyCode) { - return jsDevReloadHandler.onKeyUp(activity, keyCode); - } - - public void onBackPressed() { - host.getReactInstanceManager().onBackPressed(); - } - - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data); - } -} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index f30f66b91b6..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.reactnativenavigation.react; - -import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; - -import javax.annotation.Nullable; - -public abstract class ReloadHandlerFacade implements DevBundleDownloadListener { - @Override - public void onSuccess() { - - } - - @Override - public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) { - - } - - @Override - public void onFailure(Exception cause) { - - } -} diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index 3cd7dae3763..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller; - -import android.view.View; -import android.view.ViewGroup; - -public class YellowBoxHelper { - boolean isYellowBox(View parent, View child) { - return parent instanceof ViewGroup && - child instanceof ViewGroup && - ((ViewGroup) parent).indexOfChild(child) >= 1; - } -} diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java index 6450567de2d..7b3cc465f42 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java @@ -50,6 +50,7 @@ public class ModalPresenterTest extends BaseTest { @Override public void beforeEach() { + super.beforeEach(); Activity activity = newActivity(); ChildControllersRegistry childRegistry = new ChildControllersRegistry(); @@ -177,7 +178,6 @@ public void showModal_rejectIfContentIsNull() { public void showModal_onViewDidAppearIsInvokedBeforeViewDisappear() { disableShowModalAnimation(modal1); root.onViewWillAppear(); - uut.showModal(modal1, root, new CommandListenerAdapter()); idleMainLooper(); InOrder inOrder = inOrder(modal1, root); @@ -210,6 +210,7 @@ public void dismissModal_previousViewIsAddedAtIndex0() { uut.setRootLayout(spy); uut.showModal(modal1, root, new CommandListenerAdapter()); + idleMainLooper(); uut.dismissModal(modal1, root, root, new CommandListenerAdapter()); verify(spy).addView(root.getView(), 0); @@ -237,6 +238,7 @@ public void dismissModal_previousModalIsAddedBackToHierarchy() { verify(modal1).onViewWillAppear(); uut.showModal(modal2, modal1, new CommandListenerAdapter()); + idleMainLooper(); assertThat(modal1.getView().getParent()).isNull(); Shadows.shadowOf(Looper.getMainLooper()).idle(); @@ -253,9 +255,9 @@ public void dismissModal_previousControllerIsNotAddedIfDismissedModalIsNotTop() uut.showModal(modal1, root, new CommandListenerAdapter()); uut.showModal(modal2, modal1, new CommandListenerAdapter()); + idleMainLooper(); assertThat(modal1.getView().getParent()).isNull(); assertThat(root.getView().getParent()).isNull(); - uut.dismissModal(modal1, null, root, new CommandListenerAdapter()); assertThat(root.getView().getParent()).isNull(); diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java index 733f517d69d..6644441b01d 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java @@ -7,6 +7,7 @@ import com.reactnativenavigation.TestUtils; import com.reactnativenavigation.mocks.SimpleViewController; import com.reactnativenavigation.options.Options; +import com.reactnativenavigation.options.TransitionAnimationOptions; import com.reactnativenavigation.react.CommandListener; import com.reactnativenavigation.react.CommandListenerAdapter; import com.reactnativenavigation.react.events.EventEmitter; @@ -54,6 +55,7 @@ public class ModalStackTest extends BaseTest { @Override public void beforeEach() { + super.beforeEach(); activity = newActivity(); childRegistry = new ChildControllersRegistry(); root = new SimpleViewController(activity, childRegistry, "root", new Options()); @@ -90,10 +92,21 @@ public void modalRefIsSaved() { assertThat(findModal(MODAL_ID_1)).isNotNull(); } + @Test + public void showModal_DidAppearEventShouldWaitForReactViewToBeShown(){ + CommandListener listener = spy(new CommandListenerAdapter()); + uut.showModal(modal1, root, listener); + verify(modal1).addOnAppearedListener(any()); + verify(listener).onSuccess(modal1.getId()); + idleMainLooper(); + verify(modal1).onViewDidAppear(); + } + @Test public void showModal() { CommandListener listener = spy(new CommandListenerAdapter()); uut.showModal(modal1, root, listener); + idleMainLooper(); verify(listener).onSuccess(modal1.getId()); verify(modal1).onViewDidAppear(); assertThat(uut.size()).isOne(); diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java index 2490271cb42..6ea75842139 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java @@ -507,6 +507,7 @@ public void popTo_FromCorrectStackUpToChild() { StackController stack2 = newStack(child2, child3, child4); BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2)); uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager); + idleMainLooper(); CommandListenerAdapter listener = spy(new CommandListenerAdapter() { @Override @@ -670,7 +671,7 @@ public void pop_FromCorrectStackByFindingChildId_Promise() { final StackController stack2 = newStack(child2, child3); BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2)); uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager); - + idleMainLooper(); CommandListenerAdapter listener = spy(new CommandListenerAdapter() { @Override public void onSuccess(String childId) { diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt index 19bc3c6e0e6..c0d9dda3472 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt @@ -197,6 +197,7 @@ class StackControllerTest : BaseTest() { fun setRoot_pushDuringSetRootAnimationShouldNotCrash() { uut.push(child1, CommandListenerAdapter()) uut.push(child2, CommandListenerAdapter()) + idleMainLooper() uut.setRoot(listOf(child1), CommandListenerAdapter()) uut.push(child3, CommandListenerAdapter()) @@ -281,6 +282,7 @@ class StackControllerTest : BaseTest() { disablePushAnimation(child1, child2) uut.push(child1, CommandListenerAdapter()) // Initialize stack with a child uut.push(child2, CommandListenerAdapter()) + idleMainLooper() verify(child2).onViewDidAppear() } @@ -608,8 +610,10 @@ class StackControllerTest : BaseTest() { assertNotChildOf(uut.view, child1.view) uut.push(child1, CommandListenerAdapter()) assertIsChild(uut.view, child1.view) + idleMainLooper() uut.push(child2, CommandListenerAdapter()) + idleMainLooper() assertIsChild(uut.view, child2) assertNotChildOf(uut.view, child1) } @@ -663,6 +667,7 @@ class StackControllerTest : BaseTest() { val child1View: View = child1.view uut.push(child1, CommandListenerAdapter()) uut.push(child2, CommandListenerAdapter()) + idleMainLooper() assertIsChild(uut.view, child2View) assertNotChildOf(uut.view, child1View) @@ -715,6 +720,7 @@ class StackControllerTest : BaseTest() { uut.push(child2, CommandListenerAdapter()) uut.push(child3, CommandListenerAdapter()) uut.push(child4, CommandListenerAdapter()) + idleMainLooper() uut.popTo(child2, Options.EMPTY, CommandListenerAdapter()) verify(animator, never()).pop(any(), eq(child1), any(), any(), any()) @@ -729,6 +735,7 @@ class StackControllerTest : BaseTest() { uut.push(child1, mock()) uut.push(child2, mock()) uut.push(child3, mock()) + idleMainLooper() uut.popTo(child1, Options.EMPTY, mock()) animator.endPushAnimation(child3) assertContainsOnlyId(child1.id) @@ -759,8 +766,8 @@ class StackControllerTest : BaseTest() { disablePushAnimation(child1, child2, child3) uut.push(child1, CommandListenerAdapter()) uut.push(child2, CommandListenerAdapter()) - uut.push(child3, CommandListenerAdapter()) + idleMainLooper() uut.popToRoot(Options.EMPTY, object : CommandListenerAdapter() { override fun onSuccess(childId: String) { verify(animator).pop(eq(child1), eq(child3), any(), any(), any()) @@ -776,6 +783,8 @@ class StackControllerTest : BaseTest() { uut.push(child1, CommandListenerAdapter()) uut.push(child2, CommandListenerAdapter()) uut.push(child3, CommandListenerAdapter()) + idleMainLooper() + uut.popToRoot(Options.EMPTY, object : CommandListenerAdapter() { override fun onSuccess(childId: String) { verify(child1, never()).destroy() @@ -811,6 +820,7 @@ class StackControllerTest : BaseTest() { uut.push(child1, mock()) uut.push(child2, mock()) uut.push(child3, mock()) + idleMainLooper() uut.popToRoot(Options.EMPTY, mock()) animator.endPushAnimation(child3) assertContainsOnlyId(child1.id) diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegateTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegateTest.java index baeff6de60e..7509c7ee352 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegateTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegateTest.java @@ -8,14 +8,13 @@ import com.reactnativenavigation.BaseTest; import org.junit.Test; -import org.mockito.Mockito; import static org.assertj.core.api.Java6Assertions.assertThat; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; public class YellowBoxDelegateTest extends BaseTest { private YellowBoxDelegate uut; - private YellowBoxHelper yellowBoxHelper; private View yellowBox; private ViewGroup parent; @@ -24,8 +23,7 @@ public void beforeEach() { Activity context = newActivity(); yellowBox = new View(context); parent = new FrameLayout(context); - yellowBoxHelper = Mockito.mock(YellowBoxHelper.class); - uut = new YellowBoxDelegate(context, yellowBoxHelper); + uut = new YellowBoxDelegate(context); parent.addView(new View(context)); // We assume view at index 0 is not a yellow box parent.addView(yellowBox); } @@ -52,9 +50,10 @@ public void onReactViewDestroy_yellowBoxIsAddedBackToParent() { @Test public void onChildViewAdded() { + uut = spy(uut); uut.onChildViewAdded(parent, yellowBox); dispatchPreDraw(yellowBox); - verify(yellowBoxHelper).isYellowBox(parent, yellowBox); + verify(uut).isYellowBox(parent, yellowBox); } @Test diff --git a/lib/android/build.gradle b/lib/android/build.gradle index e9a3e8a4158..d686a24b728 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -2,18 +2,18 @@ buildscript { ext { - RNNKotlinVersion = '1.4.31' + kotlinVersion = "1.5.31" + RNNKotlinVersion = kotlinVersion } repositories { + google() mavenLocal() mavenCentral() - google() - jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31" + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + classpath("com.android.tools.build:gradle:4.2.2") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -22,10 +22,9 @@ buildscript { allprojects { repositories { - mavenLocal() mavenCentral() + mavenLocal() google() - jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../../node_modules/react-native/android" diff --git a/lib/android/gradle.properties b/lib/android/gradle.properties index eeea815a325..8b89a202bf3 100644 --- a/lib/android/gradle.properties +++ b/lib/android/gradle.properties @@ -17,5 +17,5 @@ # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -# android.useAndroidX=true -# android.enableJetifier=true +android.useAndroidX=true +android.enableJetifier=true diff --git a/lib/android/gradle/wrapper/gradle-wrapper.properties b/lib/android/gradle/wrapper/gradle-wrapper.properties index fd44bb50b67..ecfd475ef99 100644 --- a/lib/android/gradle/wrapper/gradle-wrapper.properties +++ b/lib/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip diff --git a/lib/android/gradlew b/lib/android/gradlew index 9d82f789151..82653490fbc 100755 --- a/lib/android/gradlew +++ b/lib/android/gradlew @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# 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 +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$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" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# 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 -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +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 @@ -105,8 +109,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# 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"` @@ -134,27 +138,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` 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" ;; + 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 -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# 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" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/lib/android/gradlew.bat b/lib/android/gradlew.bat index aec99730b4e..5dd299de97c 100644 --- a/lib/android/gradlew.bat +++ b/lib/android/gradlew.bat @@ -8,20 +8,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +38,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +48,13 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/lib/src/components/ComponentWrapper.test.tsx b/lib/src/components/ComponentWrapper.test.tsx index 417c3c82459..65a40cbff22 100644 --- a/lib/src/components/ComponentWrapper.test.tsx +++ b/lib/src/components/ComponentWrapper.test.tsx @@ -73,7 +73,7 @@ describe('ComponentWrapper', () => { ); expect(NavigationComponent).not.toBeInstanceOf(MyComponent); const tree = renderer.create(); - expect(tree.toJSON()!.children).toEqual(['Hello, World!']); + expect((tree.toJSON() as renderer.ReactTestRendererJSON)!.children).toEqual(['Hello, World!']); }); it('injects props from wrapper into original component', () => { @@ -87,7 +87,7 @@ describe('ComponentWrapper', () => { const tree = renderer.create( ); - expect(tree.toJSON()!.children).toEqual(['yo']); + expect((tree.toJSON() as renderer.ReactTestRendererJSON)!.children).toEqual(['yo']); expect(renderCount).toHaveBeenCalledTimes(1); }); @@ -295,7 +295,7 @@ describe('ComponentWrapper', () => { reduxStore ); const tree = renderer.create(); - expect(tree.toJSON()!.children).toEqual(['it just works']); + expect((tree.toJSON() as renderer.ReactTestRendererJSON)!.children).toEqual(['it just works']); expect((NavigationComponent as any).options()).toEqual({ foo: 123 }); }); }); diff --git a/package.json b/package.json index f59e0878e18..6ff0d40115c 100644 --- a/package.json +++ b/package.json @@ -66,48 +66,49 @@ "tslib": "1.9.3" }, "devDependencies": { - "@babel/core": "7.10.3", - "@babel/plugin-proposal-export-default-from": "7.10.1", - "@babel/plugin-proposal-export-namespace-from": "7.10.1", - "@babel/types": "7.6.x", + "@babel/core": "7.15.5", + "@babel/plugin-proposal-export-default-from": "7.14.5", + "@babel/plugin-proposal-export-namespace-from": "7.14.5", + "@babel/types": "7.15.6", "@react-native-community/blur": "^3.6.0", "@react-native-community/datetimepicker": "^3.4.7", "@react-native-community/eslint-config": "2.0.0", "@react-native-community/netinfo": "^5.9.4", "@testing-library/jest-native": "^4.0.1", "@testing-library/react-native": "^7.2.0", - "@types/detox": "16.4.1", + "@types/detox": "17.14.2", "@types/hoist-non-react-statics": "^3.0.1", "@types/jasmine": "3.5.10", - "@types/jest": "26.0.3", - "@types/lodash": "^4.14.149", - "@types/react": "16.9.41", - "@types/react-native": "0.63.1", - "@types/react-test-renderer": "16.9.2", + "@types/jest": "27.0.2", + "@types/lodash": "^4.14.175", + "@types/react": "17.0.26", + "@types/react-native": "0.65.3", + "@types/react-test-renderer": "17.0.1", "@typescript-eslint/eslint-plugin": "3.3.0", "@typescript-eslint/parser": "3.3.0", - "babel-jest": "26.1.0", + "babel-jest": "27.2.4", "clang-format": "^1.4.0", - "detox": "18.19.0", + "detox": "18.22.0", "eslint": "7.3.0", "eslint-config-prettier": "6.11.0", "eslint-plugin-prettier": "3.1.4", "github-release-notes": "https://github.com/yogevbd/github-release-notes/tarball/e601b3dba72dcd6cba323c1286ea6dd0c0110b58", "husky": "4.2.5", "identity-obj-proxy": "3.0.0", - "jest": "26.1.0", - "jest-circus": "26.1.0", + "jest": "27.2.4", + "jest-circus": "27.2.4", "lint-staged": "10.2.11", - "metro-react-native-babel-preset": "0.59.0", + "metro-react-native-babel-preset": "0.66.2", "prettier": "2.1.2", - "react": "16.13.1", - "react-native": "0.63.2", - "react-native-fast-image": "^8.3.4", - "react-native-gesture-handler": "^1.6.1", - "react-native-reanimated": "^1.9.0", + "react": "17.0.2", + "react-native": "0.66.0", + "react-native-fast-image": "^8.5.11", + "react-native-gesture-handler": "^1.10.3", + "react-native-reanimated": "2.3.0-beta.2", + "react-native-redash": "14.2.4", "react-native-ui-lib": "5.11.0", "react-redux": "5.x.x", - "react-test-renderer": "16.13.1", + "react-test-renderer": "17.0.2", "redux": "3.x.x", "semver": "5.x.x", "shell-utils": "1.x.x", @@ -137,6 +138,9 @@ "react-native-navigation": "/lib/src", "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/playground/img/layouts@2x.png" }, + "transformIgnorePatterns": [ + "node_modules/(?!(@react-native|react-native|react-native-animatable|react-native-reanimated|react-native-ui-lib)/)" + ], "collectCoverageFrom": [ "lib/src/**/*.ts", "lib/src/**/*.tsx", @@ -145,6 +149,7 @@ "!lib/dist/Navigation.js", "!lib/dist/adapters/**/*", "!lib/dist/interfaces/**/*", + "!lib/src/interfaces/**/*", "!lib/dist/**/*.test.*", "!integration/**/*.test.*", "!integration/*.test.*", @@ -257,4 +262,4 @@ } } } -} \ No newline at end of file +} diff --git a/playground/.gitignore b/playground/.gitignore index d9d6e0e6776..05b68425aee 100644 --- a/playground/.gitignore +++ b/playground/.gitignore @@ -162,6 +162,7 @@ android/captures/ # Intellij *.iml +*.hprof # Keystore files *.jks @@ -211,4 +212,4 @@ android/app/libs android/keystores/debug.keystore # Snapshot tests diffs -ios/SnapshotTests/FailureDiffs/ \ No newline at end of file +ios/SnapshotTests/FailureDiffs/ diff --git a/playground/android/app/build.gradle b/playground/android/app/build.gradle index 7581e6895af..f616a629a40 100644 --- a/playground/android/app/build.gradle +++ b/playground/android/app/build.gradle @@ -1,39 +1,32 @@ apply plugin: "com.android.application" -def enableHermes = false project.ext.react = [ - root : "../../../", - entryFile: "index.js", - bundleAssetName: "index.android.bundle", - bundleInAlpha: true, - bundleInBeta: true, - enableHermes: enableHermes, - hermesFlagsDebug:['-Xes6-proxy','-output-source-map'], - hermesFlagsRelease:['-output-source-map'], - hermesCommand: "../../../node_modules/hermes-engine/%OS-BIN%/hermesc", + root : "../../../", + cliPath : "node_modules/react-native/cli.js", + entryFile : "index.js", + bundleAssetName : "index.android.bundle", + bundleInAlpha : true, + bundleInBeta : true, + enableHermes : true, + hermesFlagsDebug : ['-Xes6-proxy', '-output-source-map'], + hermesFlagsRelease: ['-output-source-map'], + hermesCommand : "../../../node_modules/hermes-engine/%OS-BIN%/hermesc", ] -def jscFlavor = 'org.webkit:android-jsc:+' - apply from: "../../../node_modules/react-native/react.gradle" android { - compileSdkVersion 29 - ndkVersion "20.1.5948944" - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + compileSdkVersion 30 + ndkVersion "21.4.7075529" defaultConfig { applicationId "com.reactnativenavigation.playground" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 1 versionName "1.0" ndk { - abiFilters "armeabi-v7a", "x86", 'x86_64' + abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } testBuildType System.getProperty('testBuildType', 'debug') @@ -56,20 +49,15 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.google.android.material:material:1.0.0' - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.4.0' //noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' implementation project(':react-native-fast-image') - if (enableHermes) { - def hermesPath = "../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") - } else { - implementation jscFlavor - } + def hermesPath = "../../../node_modules/hermes-engine/android/"; + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") //noinspection GradleDynamicVersion implementation project(':react-native-navigation') @@ -80,7 +68,7 @@ dependencies { task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile + from configurations.implementation into 'libs' } diff --git a/playground/android/app/src/main/AndroidManifest.xml b/playground/android/app/src/main/AndroidManifest.xml index 292a7424c8e..9d4a4a0a8cd 100644 --- a/playground/android/app/src/main/AndroidManifest.xml +++ b/playground/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,8 @@ - + + + if (project.hasProperty("android")) { + android { + compileSdkVersion compileSdkVersion + buildToolsVersion "$buildToolsVersion" + } + } + } + } + repositories { google() @@ -13,8 +28,8 @@ buildscript { mavenCentral() } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath 'com.android.tools.build:gradle:4.0.1' + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + classpath('com.android.tools.build:gradle:7.0.2') // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -24,6 +39,7 @@ buildscript { allprojects { repositories { maven { url 'https://www.jitpack.io' } + maven { url 'https://maven.google.com' } google() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm diff --git a/playground/android/gradle/wrapper/gradle-wrapper.properties b/playground/android/gradle/wrapper/gradle-wrapper.properties index be60575e053..10f126bc99c 100644 --- a/playground/android/gradle/wrapper/gradle-wrapper.properties +++ b/playground/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip diff --git a/playground/android/gradlew b/playground/android/gradlew index 77564ddb2c8..2fe81a7d95e 100755 --- a/playground/android/gradlew +++ b/playground/android/gradlew @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` 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" ;; + 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 @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # 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" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" \ No newline at end of file +exec "$JAVACMD" "$@" diff --git a/playground/android/gradlew.bat b/playground/android/gradlew.bat index f6d5974e72f..5dd299de97c 100644 --- a/playground/android/gradlew.bat +++ b/playground/android/gradlew.bat @@ -13,15 +13,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +38,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +48,13 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/playground/android/settings.gradle b/playground/android/settings.gradle index 6d3c62b7824..1e5bd8505d4 100644 --- a/playground/android/settings.gradle +++ b/playground/android/settings.gradle @@ -1,5 +1,5 @@ rootProject.name = 'Playground' -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' include ':react-native-navigation' diff --git a/playground/ios/Podfile b/playground/ios/Podfile index 171efbaaf2b..b350e9e8376 100644 --- a/playground/ios/Podfile +++ b/playground/ios/Podfile @@ -3,10 +3,12 @@ require_relative '../../node_modules/@react-native-community/cli-platform-ios/na platform :ios, '11.0' -def all_pods +def all_pods config = use_native_modules! - use_react_native!(:path => config[:reactNativePath]) - + use_react_native!( + :path => config[:reactNativePath], + :hermes_enabled => true + ) pod 'ReactNativeNavigation', :path => '../../' pod 'HMSegmentedControl' end @@ -28,4 +30,9 @@ end target 'SnapshotTests' do all_pods pod 'OCMock' -end \ No newline at end of file +end + +post_install do |installer| + react_native_post_install(installer) + __apply_Xcode_12_5_M1_post_install_workaround(installer) +end diff --git a/playground/ios/playground.xcodeproj/project.pbxproj b/playground/ios/playground.xcodeproj/project.pbxproj index c868209e629..4cc48e8212a 100644 --- a/playground/ios/playground.xcodeproj/project.pbxproj +++ b/playground/ios/playground.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -467,6 +467,7 @@ 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 4B4DD2714D02BEBC8F96EAD1 /* [CP] Copy Pods Resources */, + 25FDA01D0599E8F8B8062C1B /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -486,6 +487,7 @@ 507C80D72429111F00F765F7 /* Frameworks */, 507C80D82429111F00F765F7 /* Resources */, AB86EBB5F0AF15B43F3472FD /* [CP] Copy Pods Resources */, + DC0F0857169E6ADF23C88B28 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -506,6 +508,7 @@ 50996C5A23AA46DD00008F89 /* Frameworks */, 50996C5B23AA46DD00008F89 /* Resources */, EB65541BD6775B84E7C8AEDD /* [CP] Copy Pods Resources */, + 290B14947FB8DCCF300049AA /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -526,6 +529,7 @@ E58D2618238587F4003F36BA /* Frameworks */, E58D2619238587F4003F36BA /* Resources */, 8A0391DE1BA0B3DE9D40DE96 /* [CP] Copy Pods Resources */, + B5ED7EFE2EFED057B172BCA1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -570,7 +574,7 @@ }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "playground" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 12.0"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( @@ -662,18 +666,51 @@ 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; }; + 25FDA01D0599E8F8B8062C1B /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 290B14947FB8DCCF300049AA /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 4B4DD2714D02BEBC8F96EAD1 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-playground/Pods-playground-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -729,13 +766,12 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -747,19 +783,35 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; + B5ED7EFE2EFED057B172BCA1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NavigationTests/Pods-NavigationTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; D80DD80E880A67F5575078C4 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -782,18 +834,34 @@ 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; }; + DC0F0857169E6ADF23C88B28 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SnapshotTests/Pods-SnapshotTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; EB65541BD6775B84E7C8AEDD /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-resources-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NavigationIOS12Tests/Pods-NavigationIOS12Tests-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -952,7 +1020,14 @@ ); INFOPLIST_FILE = playground/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1000,7 +1075,14 @@ ); INFOPLIST_FILE = playground/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1029,7 +1111,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = SnapshotTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = rn.SnapshotTests; @@ -1056,7 +1146,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = SnapshotTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = rn.SnapshotTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1080,7 +1178,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NavigationIOS12Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = rn.NavigationIOS12Tests; @@ -1106,7 +1212,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NavigationIOS12Tests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = rn.NavigationIOS12Tests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1147,6 +1261,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -1202,6 +1317,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 i386"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -1235,7 +1351,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NavigationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.wix.NavigationTests; @@ -1263,7 +1387,15 @@ GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NavigationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ( + "$(SDKROOT)/usr/lib/swift", + "$(inherited)", + ); MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.wix.NavigationTests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/scripts/test-unit.js b/scripts/test-unit.js index f24b27b2f36..94f9241dfbc 100644 --- a/scripts/test-unit.js +++ b/scripts/test-unit.js @@ -13,11 +13,10 @@ function run() { } function runAndroidUnitTests() { - const conf = release ? 'testReactNative63ReleaseUnitTest' : 'testReactNative63DebugUnitTest'; + const conf = release ? 'testReleaseUnitTest' : 'testDebugUnitTest'; if (android && process.env.JENKINS_CI) { const sdkmanager = '/usr/local/share/android-sdk/tools/bin/sdkmanager'; exec.execSync(`yes | ${sdkmanager} --licenses`); - // exec.execSync(`echo y | ${sdkmanager} --update && echo y | ${sdkmanager} --licenses`); } exec.execSync(`cd lib/android && ./gradlew ${conf}`); }