diff --git a/lib/android/app/build.gradle b/lib/android/app/build.gradle index 0e033eda296..59723b25c85 100644 --- a/lib/android/app/build.gradle +++ b/lib/android/app/build.gradle @@ -18,22 +18,24 @@ def safeExtGet(prop, fallback) { } def safeExtGetFallbackLowerBound(prop, fallback) { - Math.max(safeExtGet(prop,fallback),fallback) + Math.max(safeExtGet(prop, fallback), fallback) } -def DEFAULT_COMPILE_SDK_VERSION = 33 -def DEFAULT_MIN_SDK_VERSION = 21 -def DEFAULT_TARGET_SDK_VERSION = 33 +def DEFAULT_COMPILE_SDK_VERSION = 35 +def DEFAULT_MIN_SDK_VERSION = 24 +def DEFAULT_TARGET_SDK_VERSION = 35 def DEFAULT_KOTLIN_VERSION = "1.5.31" def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8' +def DEFAULT_BUILD_TOOLS_VERSION = "35.0.0" def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION) -def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB ) +def kotlinStdlib = safeExtGet('RNNKotlinStdlib', DEFAULT_KOTLIN_STDLIB) def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2') +def _buildToolsVersion = safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) android { namespace 'com.reactnativenavigation' compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) - buildToolsVersion = "34.0.0" + buildToolsVersion = _buildToolsVersion defaultConfig { minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION) targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) @@ -73,126 +75,12 @@ android { } } compileOptions { - if (reactNativeMinorVersion() >= 73) { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } else { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - if (reactNativeMinorVersion() >= 73) { - jvmTarget = JavaVersion.VERSION_17 - } else { - jvmTarget = JavaVersion.VERSION_11 - } + jvmTarget = JavaVersion.VERSION_17 } - - 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") - } - reactNative68 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "68") - } - reactNative71 { - dimension "RNN.reactNativeVersion" - buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "71") - } - } - - def flavor = resolveFlavor() - variantFilter { variant -> - def names = variant.flavors*.name - if (!names.contains(flavor)) { - setIgnore(true) - } - } -} - -int reactNativeMinorVersion() { - List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson()) - reactNativeVersionComponents[1].toInteger() -} - -String resolveFlavor() { - List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson()) - Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger() - Integer reactNativePatchComponent = reactNativeVersionComponents[2].toInteger() - - if (reactNativeMinorComponent >= 71) { - return "reactNative71" - } else if (reactNativeMinorComponent >= 68) { - return "reactNative68" - } else 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('.') } dependencies { @@ -214,7 +102,7 @@ dependencies { //noinspection GradleDynamicVersion implementation 'com.facebook.react:react-native:+' - if("Playground".toLowerCase() == rootProject.name.toLowerCase()){ + if ("Playground".toLowerCase() == rootProject.name.toLowerCase()) { // tests only for our playground testImplementation 'junit:junit:4.13.2' testImplementation "org.robolectric:robolectric:4.7.2" diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java b/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java index ec92edb5790..eb1906ea9a4 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java @@ -53,7 +53,7 @@ public void onCreate() { * @return a singleton {@link ReactGateway} */ protected ReactGateway createReactGateway() { - return new ReactGateway(getReactHost(), getReactNativeHost()); + return new ReactGateway(getReactHost()); } public ReactGateway getReactGateway() { 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 100% 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 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 deleted file mode 100644 index b7786f564ff..00000000000 --- a/lib/android/app/src/main/java/com/reactnativenavigation/react/DevPermissionRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.react; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.content.Intent; -import android.os.Build; -import android.provider.Settings; -import android.util.Log; -import android.widget.Toast; - -import com.facebook.react.common.ReactConstants; -import com.reactnativenavigation.BuildConfig; - -public class DevPermissionRequest { - - private final boolean isDebug; - - public DevPermissionRequest(boolean isDebug) { - this.isDebug = isDebug; - } - - public boolean shouldAskPermission(Activity activity) { - return isDebug && - Build.VERSION.SDK_INT >= 23 && - BuildConfig.REACT_NATVE_VERSION_MINOR <= 51 && - !Settings.canDrawOverlays(activity); - } - - @TargetApi(23) - public void askPermission(Activity activity) { - if (shouldAskPermission(activity)) { - Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); - serviceIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(serviceIntent); - String msg = "Overlay permissions needs to be granted in order for react native apps to run in dev mode"; - Log.w(ReactConstants.TAG, "======================================\n\n"); - Log.w(ReactConstants.TAG, msg); - Log.w(ReactConstants.TAG, "\n\n======================================"); - Toast.makeText(activity, msg, Toast.LENGTH_LONG).show(); - } - } -} 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/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java index a18dd199498..a0adee4889f 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java @@ -11,13 +11,11 @@ public class NavigationReactInitializer implements ReactInstanceManager.ReactInstanceEventListener { private final ReactHost reactHost; - private final DevPermissionRequest devPermissionRequest; private boolean waitingForAppLaunchEvent = true; private boolean isActivityReadyForUi = false; - NavigationReactInitializer(ReactHost reactHost, boolean isDebug) { + NavigationReactInitializer(ReactHost reactHost) { this.reactHost = reactHost; - this.devPermissionRequest = new DevPermissionRequest(isDebug); } void onActivityCreated() { @@ -26,13 +24,10 @@ void onActivityCreated() { } void onActivityResumed(NavigationActivity activity) { - if (devPermissionRequest.shouldAskPermission(activity)) { - devPermissionRequest.askPermission(activity); - } else { + reactHost.onHostResume(activity, activity); isActivityReadyForUi = true; prepareReactApp(); - } } void onActivityPaused(NavigationActivity activity) { diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactNativeHost.java similarity index 100% rename from lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactNativeHost.java diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java similarity index 92% rename from lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java rename to lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java index 3346050245a..0734312b9c9 100644 --- a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactGateway.java @@ -16,9 +16,9 @@ public class ReactGateway { private final NavigationReactInitializer initializer; private final JsDevReloadHandler jsDevReloadHandler; - public ReactGateway(ReactHost host, ReactNativeHost reactNativeHost) { + public ReactGateway(ReactHost host) { this.host = host; - initializer = new NavigationReactInitializer(host, reactNativeHost.getUseDeveloperSupport()); + initializer = new NavigationReactInitializer(host); jsDevReloadHandler = new JsDevReloadHandler(host.getDevSupportManager()); if (host instanceof BundleDownloadListenerProvider) { ((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler); 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/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt b/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt similarity index 100% rename from lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt rename to lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/utils/MotionEvent.kt b/lib/android/app/src/main/java/com/reactnativenavigation/utils/MotionEvent.kt index fb03abb075d..1a9b320e0ae 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/utils/MotionEvent.kt +++ b/lib/android/app/src/main/java/com/reactnativenavigation/utils/MotionEvent.kt @@ -9,14 +9,9 @@ import com.reactnativenavigation.BuildConfig val hitRect = Rect() fun MotionEvent.coordinatesInsideView(view: View?): Boolean { - if (BuildConfig.REACT_NATVE_VERSION_MINOR < 71) { - view ?: return false - view.getHitRect(hitRect) - return hitRect.contains(x.toInt(), y.toInt()) - } else { - val viewGroup = (view as? ViewGroup)?.getChildAt(0) as? ViewGroup ?: view + val viewGroup = (view as? ViewGroup)?.getChildAt(0) as? ViewGroup ?: view + + viewGroup?.getHitRect(hitRect) + return hitRect.contains(x.toInt(), y.toInt()) - viewGroup?.getHitRect(hitRect) - return hitRect.contains(x.toInt(), y.toInt()) - } } \ No newline at end of file diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt similarity index 100% rename from lib/android/app/src/reactNative71/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt rename to lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java similarity index 100% rename from lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java rename to lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt similarity index 100% rename from lib/android/app/src/reactNative71/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt rename to lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt 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 088c16e359a..00000000000 --- a/lib/android/app/src/reactNative51/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 com.facebook.hermes.reactexecutor.HermesExecutorFactory; - -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(new HermesExecutorFactory()) - .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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ 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/reactNative51/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative51/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative51/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ 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/reactNative55/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative55/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative55/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ 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/reactNative56/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative56/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative56/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file 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/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative57/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative57/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file 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/reactNative57_5/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file 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/reactNative60/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative60/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative60/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/ReactGateway.java b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 035ec31b2c5..00000000000 --- a/lib/android/app/src/reactNative62/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/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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file 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/reactNative62/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative62/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative62/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} 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/NavigationReactNativeHost.java b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 9b1bd158f3a..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,66 +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; - -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/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/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index da7d5b1b4f9..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,81 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative63/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative63/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} diff --git a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/options/parsers/ColorParser.kt b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/options/parsers/ColorParser.kt deleted file mode 100644 index 857af348911..00000000000 --- a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/options/parsers/ColorParser.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.reactnativenavigation.options.parsers - -import android.content.Context -import com.facebook.react.bridge.ColorPropConverter -import com.reactnativenavigation.options.params.Colour -import com.reactnativenavigation.options.params.DontApplyColour -import com.reactnativenavigation.options.params.NullColor -import com.reactnativenavigation.options.params.ReactPlatformColor -import org.json.JSONObject - -object ColorParser { - private const val KEY_RESOURCE_PATHS = "resource_paths" - private const val VAL_NO_COLOR = "NoColor" - - @JvmStatic - fun parse(context: Context?, json: JSONObject, colorName: String?): Colour { - if (json.has(KEY_RESOURCE_PATHS)) { - return ReactPlatformColor(JSONParser.convert(json)) - } - return when (val color = json.opt(colorName)) { - null, VAL_NO_COLOR -> { - DontApplyColour() - } - is Int -> { - Colour(json.optInt(colorName)) - } - is JSONObject -> { - ColorPropConverter.getColor(color, context)?.let { - Colour(it) - } ?: NullColor() - } - else -> { - NullColor() - } - } - - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index d5ad33c75c5..00000000000 --- a/lib/android/app/src/reactNative68/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/reactNative68/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index feb40fb680e..00000000000 --- a/lib/android/app/src/reactNative68/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/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java deleted file mode 100644 index 9b1bd158f3a..00000000000 --- a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +++ /dev/null @@ -1,66 +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; - -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/reactNative68/java/com/reactnativenavigation/react/ReactGateway.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/ReactGateway.java deleted file mode 100644 index 035ec31b2c5..00000000000 --- a/lib/android/app/src/reactNative68/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/reactNative68/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index f30f66b91b6..00000000000 --- a/lib/android/app/src/reactNative68/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/reactNative68/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt deleted file mode 100644 index ea8516fee7f..00000000000 --- a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +++ /dev/null @@ -1,87 +0,0 @@ -package com.reactnativenavigation.react.modal - -import android.content.Context -import android.view.MotionEvent -import android.view.View -import com.facebook.react.bridge.* -import com.facebook.react.uimanager.* -import com.facebook.react.uimanager.events.EventDispatcher -import com.facebook.react.views.view.ReactViewGroup - - -class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{ - private var hasAdjustedSize = false - private var viewWidth = 0 - private var viewHeight = 0 - private val mJSTouchDispatcher = JSTouchDispatcher(this) - - override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { - super.onSizeChanged(w, h, oldw, oldh) - viewWidth = w - viewHeight = h - this.updateFirstChildView() - } - private fun updateFirstChildView() { - if (this.childCount > 0) { - hasAdjustedSize = false - val viewTag = getChildAt(0).id - val reactContext: ReactContext = this.getReactContext() - reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) { - override fun runGuarded() { - val uiManager = this@ModalContentLayout.getReactContext().getNativeModule( - UIManagerModule::class.java - ) as UIManagerModule - uiManager.updateNodeSize( - viewTag, - this@ModalContentLayout.viewWidth, - this@ModalContentLayout.viewHeight - ) - } - }) - } else { - hasAdjustedSize = true - } - } - - override fun addView(child: View?, index: Int, params: LayoutParams?) { - super.addView(child, index, params) - if (hasAdjustedSize) { - updateFirstChildView() - } - } - override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent?) { - mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher()) - } - override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {} - private fun getEventDispatcher(): EventDispatcher? { - val reactContext: ReactContext = this.getReactContext() - return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher - } - - - override fun handleException(t: Throwable?) { - getReactContext().handleException(RuntimeException(t)) - } - - private fun getReactContext(): ReactContext { - return this.context as ReactContext - } - - override fun onInterceptTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - return super.onInterceptTouchEvent(event) - } - - override fun onTouchEvent(event: MotionEvent?): Boolean { - mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher()) - super.onTouchEvent(event) - return true - } - -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt deleted file mode 100644 index 62fac1b7cc6..00000000000 --- a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegate.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.reactnativenavigation.viewcontrollers.viewcontroller - -import android.content.Context -import android.view.View -import android.view.ViewGroup -import androidx.annotation.RestrictTo -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()) - - var parent: ViewGroup? = null - private set - @get:RestrictTo(RestrictTo.Scope.TESTS) - val yellowBoxes: List - get() = yellowBoxViews - - private var isDestroyed = false - private val yellowBoxViews = ArrayList() - - open fun onChildViewAdded(parent: View, child: View?) { - if (!context.isDebug()) return - if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent) - } - - fun onYellowBoxAdded(parent: View) { - if (isDestroyed) return - this.parent = parent as ViewGroup - for (i in 1 until parent.childCount) { - yellowBoxViews.add(parent[i]) - parent.removeView(parent[i]) - parent.addView(View(context), i) - } - } - - fun destroy() { - isDestroyed = true - if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) } - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index 3cd7dae3763..00000000000 --- a/lib/android/app/src/reactNative68/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/reactNative68/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt b/lib/android/app/src/reactNative68/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt deleted file mode 100644 index 416c804a3ab..00000000000 --- a/lib/android/app/src/reactNative68/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleBarReactView.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.reactnativenavigation.views.stack.topbar.titlebar - -import android.annotation.SuppressLint -import android.content.Context -import androidx.core.view.children -import com.facebook.react.ReactInstanceManager -import com.reactnativenavigation.react.ReactView - -@SuppressLint("ViewConstructor") -class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceManager?, componentId: String?, - componentName: String?) : ReactView(context, reactInstanceManager, componentId, componentName) { - var centered: Boolean = false - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(interceptReactRootViewMeasureSpec(widthMeasureSpec), heightMeasureSpec) - } - - private fun interceptReactRootViewMeasureSpec(widthMeasureSpec: Int): Int { - // This is a HACK. - // ReactRootView has problematic behavior when setting width to WRAP_CONTENT, - // It's causing infinite measurements, that hung up the UI. - // Intercepting largest child by width, and use its width as (parent) ReactRootView width fixed that. - // See for more details https://github.com/wix/react-native-navigation/pull/7096 - var measuredWidth = 0; - this.children.forEach { - if (it.measuredWidth > measuredWidth) { - measuredWidth = it.measuredWidth - } - } - return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else - widthMeasureSpec - } -} diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/options/parsers/ColorParser.kt b/lib/android/app/src/reactNative71/java/com/reactnativenavigation/options/parsers/ColorParser.kt deleted file mode 100644 index 857af348911..00000000000 --- a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/options/parsers/ColorParser.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.reactnativenavigation.options.parsers - -import android.content.Context -import com.facebook.react.bridge.ColorPropConverter -import com.reactnativenavigation.options.params.Colour -import com.reactnativenavigation.options.params.DontApplyColour -import com.reactnativenavigation.options.params.NullColor -import com.reactnativenavigation.options.params.ReactPlatformColor -import org.json.JSONObject - -object ColorParser { - private const val KEY_RESOURCE_PATHS = "resource_paths" - private const val VAL_NO_COLOR = "NoColor" - - @JvmStatic - fun parse(context: Context?, json: JSONObject, colorName: String?): Colour { - if (json.has(KEY_RESOURCE_PATHS)) { - return ReactPlatformColor(JSONParser.convert(json)) - } - return when (val color = json.opt(colorName)) { - null, VAL_NO_COLOR -> { - DontApplyColour() - } - is Int -> { - Colour(json.optInt(colorName)) - } - is JSONObject -> { - ColorPropConverter.getColor(color, context)?.let { - Colour(it) - } ?: NullColor() - } - else -> { - NullColor() - } - } - - } -} \ No newline at end of file diff --git a/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java b/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java deleted file mode 100644 index d5ad33c75c5..00000000000 --- a/lib/android/app/src/reactNative71/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/reactNative71/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java b/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java deleted file mode 100644 index feb40fb680e..00000000000 --- a/lib/android/app/src/reactNative71/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/reactNative71/java/com/reactnativenavigation/react/ReloadHandlerFacade.java b/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReloadHandlerFacade.java deleted file mode 100644 index f30f66b91b6..00000000000 --- a/lib/android/app/src/reactNative71/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/reactNative71/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java b/lib/android/app/src/reactNative71/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java deleted file mode 100644 index 3cd7dae3763..00000000000 --- a/lib/android/app/src/reactNative71/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/package-lock.json b/package-lock.json index 9b95e658c29..9c4d21a603e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-native-navigation", - "version": "8.1.0-alpha", + "version": "8.1.0-rc01", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "react-native-navigation", - "version": "8.1.0-alpha", + "version": "8.1.0-rc01", "license": "MIT", "dependencies": { "hoist-non-react-statics": "3.x.x", @@ -15486,7 +15486,7 @@ }, "node_modules/npm/node_modules/lodash._baseindexof": { "version": "3.1.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT" }, @@ -15502,19 +15502,19 @@ }, "node_modules/npm/node_modules/lodash._bindcallback": { "version": "3.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/lodash._cacheindexof": { "version": "3.0.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/lodash._createcache": { "version": "3.1.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -15529,7 +15529,7 @@ }, "node_modules/npm/node_modules/lodash._getnative": { "version": "3.9.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT" }, @@ -15547,7 +15547,7 @@ }, "node_modules/npm/node_modules/lodash.restparam": { "version": "3.6.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT" }, diff --git a/playground/android/build.gradle b/playground/android/build.gradle index f851a530228..3f28b9fd98d 100644 --- a/playground/android/build.gradle +++ b/playground/android/build.gradle @@ -2,14 +2,14 @@ buildscript { ext { - kotlinVersion = "1.9.24" + kotlinVersion = "2.0.21" RNNKotlinVersion = kotlinVersion detoxKotlinVersion = kotlinVersion compileSdkVersion = 35 buildToolsVersion = "35.0.0" minSdkVersion = 24 - targetSdkVersion = 34 - ndkVersion = "26.1.10909125" + targetSdkVersion = 35 + ndkVersion = "27.1.12297006" } repositories { diff --git a/scripts/test-unit.js b/scripts/test-unit.js index b2e02655880..214728ada25 100644 --- a/scripts/test-unit.js +++ b/scripts/test-unit.js @@ -13,7 +13,7 @@ function run() { } function runAndroidUnitTests() { - const conf = release ? 'testReactNative71ReleaseUnitTest' : 'testReactNative71DebugUnitTest'; + 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`);