Skip to content

Upgrade playground react-native's version to 0.66 #7034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e0517c8
Upgrade playground react-native version to 0.64
yogevbd Mar 15, 2021
423c792
dummy commit to solve some jenkins problem
Apr 7, 2021
d3204eb
dummy
igorgn Apr 7, 2021
3bb8d64
Merge branch 'master' into RN64
swabbass Jun 1, 2021
ae2e8b3
move flavored code to main src
swabbass Jun 1, 2021
56605dd
drop flavors in gradle
swabbass Jun 1, 2021
8a30693
enable hermes by default
swabbass Jun 1, 2021
ef1c97f
remove jsc
swabbass Jun 1, 2021
e30f70f
kotlin 1.4
swabbass Jun 1, 2021
167b72b
reimport color parser
swabbass Jun 1, 2021
a329e4a
refactor removed REACT_NATVE_VERSION_MINOR
swabbass Jun 1, 2021
2e667b2
use Hermes as default
swabbass Jun 1, 2021
6a2c9e7
Allow draw over on android
swabbass Jun 1, 2021
9763b9f
Merge branch 'master' into RN64
swabbass Jun 1, 2021
f6dc994
remove flavor in testing
swabbass Jun 1, 2021
313e8d4
fix unit test
swabbass Jun 1, 2021
288bfae
Update test-unit.js
swabbass Jun 1, 2021
1b1f3b9
Merge branch 'master' into RN64
yogevbd Jul 7, 2021
7a5602c
Merge branch 'master' into RN64
yogevbd Jul 22, 2021
7e978f6
Merge branch 'master' into RN64
yogevbd Jul 24, 2021
44c3990
Fix js tests
yogevbd Jul 26, 2021
1bfcc0f
Merge branch 'master' into RN64
yogevbd Jul 26, 2021
5757294
Fix android build
yogevbd Jul 26, 2021
f1bac36
Merge branch 'RN64' of github.com:wix/react-native-navigation into RN64
yogevbd Jul 26, 2021
c9cd9a6
Fix android e2e
yogevbd Jul 27, 2021
85e7d38
fix build and bundling
swabbass Jul 27, 2021
cc5a515
Update AndroidManifest.xml
swabbass Jul 27, 2021
a1f2362
wait till react view rendered and then send event to component
swabbass Jul 28, 2021
f579c51
set lower bound for android sdk
swabbass Jul 28, 2021
836911c
upgrade android support components
swabbass Jul 28, 2021
42d725f
wait for stack to be shown to send didAppear
swabbass Jul 28, 2021
6bd794b
Merge branch 'master' into RN64
swabbass Oct 1, 2021
29451a0
Update react-native to 0.65.1 (#7278)
svbutko Oct 1, 2021
0c5d02e
Remove redundant Android's reactNativeXY versions
svbutko Oct 1, 2021
43c7326
Replace ColorParser.java with ColorParser.kt
svbutko Oct 1, 2021
f90e26a
Downgrade ndk version to the RN's one
svbutko Oct 1, 2021
7bada49
Enable useAndroidX and enableJetifier
svbutko Oct 1, 2021
ead6a58
Replace soon-to-be deprecated setupTestFrameworkScriptFile by setupFi…
svbutko Oct 1, 2021
843b278
Change configuration to from implementation
svbutko Oct 1, 2021
cfc13ba
Update React Native to 0.66.0
svbutko Oct 2, 2021
2d49961
Merge branch 'master' into RN64
svbutko Oct 4, 2021
8e33cad
Merge branch 'master' into RN64
svbutko Oct 4, 2021
ff013dd
Merge branch 'master' into RN64
svbutko Oct 5, 2021
e91ea53
Merge branch 'master' into RN64
svbutko Oct 5, 2021
18c6fbf
Merge branch 'master' into RN64
svbutko Oct 5, 2021
bd6c1b6
Merge branch 'master' into RN64
swabbass Oct 5, 2021
34a3b0a
Merge branch 'master' into RN64
swabbass Oct 6, 2021
eca97bb
AGP 7
swabbass Oct 6, 2021
5b7279b
remove kotlin exts
swabbass Oct 6, 2021
143be6e
fix deprecations
swabbass Oct 6, 2021
35fe097
update reanimated for rn66
swabbass Oct 6, 2021
59496d3
upgrade reanimated
swabbass Oct 7, 2021
35fad79
fix release android builds
swabbass Oct 7, 2021
10cb2d1
Merge branch 'master' into RN64
swabbass Oct 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autolink/postlink/gradleLinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var path = require('./path');
var fs = require('fs');
var { warnn, errorn, logn, infon, debugn } = require('./log');
var { insertString } = require('./stringUtils');
var DEFAULT_KOTLIN_VERSION = '1.4.31';
var DEFAULT_KOTLIN_VERSION = '1.5.31';
// This should be the minSdkVersion required for RNN.
var DEFAULT_MIN_SDK_VERSION = 21;

Expand Down
1 change: 1 addition & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'react-native-gesture-handler/jestSetup';
const { mockDetox } = require('detox-testing-library-rnn-adapter');

mockDetox(() => require('./playground/index'));
Expand Down
123 changes: 20 additions & 103 deletions lib/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import groovy.json.JsonSlurper
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

apply plugin: 'com.android.library'
Expand All @@ -9,19 +8,26 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def DEFAULT_COMPILE_SDK_VERSION = 29
def DEFAULT_MIN_SDK_VERSION = 19
def DEFAULT_TARGET_SDK_VERSION = 29
def kotlinVersion = rootProject.ext.get("RNNKotlinVersion")
def kotlinStdlib = safeExtGet('RNNKotlinStdlib', 'kotlin-stdlib-jdk8')
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.4.3')
def safeExtGetFallbackLowerBound(prop, fallback) {
Math.max(safeExtGet(prop,fallback),fallback)
}


def DEFAULT_COMPILE_SDK_VERSION = 30
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 30
def DEFAULT_KOTLIN_VERSION = "1.5.31"
def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8'
def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION)
def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')

android {
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
minSdkVersion safeExtGetFallbackLowerBound('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
targetSdkVersion safeExtGetFallbackLowerBound('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
versionCode 1
versionName "1.0"
}
Expand Down Expand Up @@ -69,94 +75,6 @@ android {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

flavorDimensions "RNN.reactNativeVersion"
productFlavors {
reactNative51 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "51")
}
reactNative55 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "55")
}
reactNative56 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "56")
}
reactNative57 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "57")
}
reactNative57_5 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "57")
}
reactNative60 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "60")
}
reactNative62 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "62")
}
reactNative63 {
dimension "RNN.reactNativeVersion"
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "63")
}
}

def flavor = resolveFlavor()
variantFilter { variant ->
def names = variant.flavors*.name
if (!names.contains(flavor)) {
setIgnore(true)
}
}
}

String resolveFlavor() {
List reactNativeVersionComponents = reactNativeVersionComponents(findReactNativePackageJson())
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()
Integer reactNativePatchComponent = reactNativeVersionComponents[2].toInteger()

if (reactNativeMinorComponent >= 63) {
return "reactNative63"
} else if (reactNativeMinorComponent >= 62) {
return "reactNative62"
} else if (reactNativeMinorComponent >= 60) {
return "reactNative60"
} else if (reactNativeMinorComponent >= 57 && reactNativePatchComponent >= 5) {
return "reactNative57_5"
} else if (reactNativeMinorComponent >= 57) {
return "reactNative57"
} else if (reactNativeMinorComponent >= 56) {
return "reactNative56"
} else if (reactNativeMinorComponent >= 55) {
return "reactNative55"
} else if (reactNativeMinorComponent >= 51) {
return "reactNative51"
}
}


Object findReactNativePackageJson() {
def searchPath = 'node_modules/react-native/package.json'
def projectDir = project.projectDir.toString() + '/'
def rnPackageJsonFile = new File(projectDir + searchPath)
while (!rnPackageJsonFile.exists()) {
searchPath = '../' + searchPath
rnPackageJsonFile = new File(projectDir + searchPath)
}
return rnPackageJsonFile
}

List reactNativeVersionComponents(rnPackageJsonFile) {
def packageSlurper = new JsonSlurper()
def reactNativePackageJson = packageSlurper.parseText(rnPackageJsonFile.text)
def reactNativeVersion = reactNativePackageJson.version

return reactNativeVersion.tokenize('-')[0].tokenize('.')
}

allprojects { p ->
Expand All @@ -170,17 +88,16 @@ allprojects { p ->
}

dependencies {
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.core:core-ktx:1.6.0"
implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesCore"
implementation "androidx.constraintlayout:constraintlayout:2.0.4"

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'com.google.android.material:material:1.4.0'

implementation 'com.github.wix-playground:ahbottomnavigation:3.3.0'
// implementation project(':AHBottomNavigation')
implementation 'com.github.wix-playground:reflow-animator:1.0.6'
implementation 'com.github.clans:fab:1.6.4'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.reactnativenavigation.options

import android.content.Context
import com.reactnativenavigation.options.animations.ViewAnimationOptions
import com.reactnativenavigation.options.params.*
import com.reactnativenavigation.options.parsers.BoolParser
import com.reactnativenavigation.options.parsers.ColorParser
import com.reactnativenavigation.options.parsers.FractionParser
import org.json.JSONObject


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ object ColorParser {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public DevPermissionRequest(boolean isDebug) {
public boolean shouldAskPermission(Activity activity) {
return isDebug &&
Build.VERSION.SDK_INT >= 23 &&
BuildConfig.REACT_NATVE_VERSION_MINOR <= 51 &&
!Settings.canDrawOverlays(activity);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.reactnativenavigation.react;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactInstanceManagerBuilder;
Expand All @@ -8,10 +12,6 @@
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 {

Expand Down Expand Up @@ -40,7 +40,7 @@ protected ReactInstanceManager createReactInstanceManager() {
.setJSMainModulePath(getJSMainModuleName())
.setUseDeveloperSupport(getUseDeveloperSupport())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setJavaScriptExecutorFactory(new HermesExecutorFactory())
.setUIImplementationProvider(getUIImplementationProvider())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
.setJSIModulesPackage(getJSIModulePackage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import android.content.Intent;
import android.content.res.Configuration;

import androidx.annotation.NonNull;

import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.NavigationActivity;

import androidx.annotation.NonNull;

public class ReactGateway {

private final ReactNativeHost host;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.reactnativenavigation.options.ModalPresentationStyle;
import com.reactnativenavigation.options.Options;
import com.reactnativenavigation.react.CommandListener;
import com.reactnativenavigation.react.CommandListenerAdapter;
import com.reactnativenavigation.utils.ContextKt;
import com.reactnativenavigation.utils.ScreenAnimationListener;
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;

Expand Down Expand Up @@ -45,15 +47,14 @@ void showModal(ViewController<?> appearing, ViewController<?> disappearing, Comm
listener.onError("Can not show modal before activity is created");
return;
}

Options options = appearing.resolveCurrentOptions(defaultOptions);

AnimationOptions enterAnimationOptions = options.animations.showModal.getEnter();
appearing.setWaitForRender(enterAnimationOptions.waitForRender);
modalsLayout.setVisibility(View.VISIBLE);
modalsLayout.addView(appearing.getView(), matchParentLP());

if (enterAnimationOptions.enabled.isTrueOrUndefined()) {
if ( enterAnimationOptions.enabled.isTrueOrUndefined()) {
if (enterAnimationOptions.shouldWaitForRender().isTrue()) {
appearing.addOnAppearedListener(() -> modalAnimator.show(appearing, disappearing, options.animations.showModal, createListener(appearing, disappearing, listener)));
} else {
Expand Down Expand Up @@ -90,10 +91,12 @@ public void onCancel() {
}

private void onShowModalEnd(ViewController toAdd, @Nullable ViewController toRemove, CommandListener listener) {
toAdd.onViewDidAppear();
if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) {
toRemove.detachView();
}
toAdd.addOnAppearedListener(()->{
toAdd.onViewDidAppear();
if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) {
toRemove.detachView();
}
});
listener.onSuccess(toAdd.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ public void push(ViewController child, CommandListener listener) {
presenter.getAdditionalPushAnimations(this, child, resolvedOptions),
() -> onPushAnimationComplete(child, toRemove, listener));
} else {
child.onViewDidAppear();
getView().removeView(toRemove.getView());
listener.onSuccess(child.getId());
onPushAnimationComplete(child, toRemove, listener);
}
} else {
listener.onSuccess(child.getId());
Expand All @@ -191,8 +189,10 @@ public void destroy() {
}

private void onPushAnimationComplete(ViewController toAdd, ViewController toRemove, CommandListener listener) {
toAdd.onViewDidAppear();
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
toAdd.addOnAppearedListener(() -> {
toAdd.onViewDidAppear();
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
});
listener.onSuccess(toAdd.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import androidx.core.view.get
import com.reactnativenavigation.utils.isDebug
import java.util.*

open class YellowBoxDelegate(private val context: Context, private val yellowBoxHelper: YellowBoxHelper = YellowBoxHelper()) {
constructor(context: Context) : this(context, YellowBoxHelper())

open class YellowBoxDelegate(private val context: Context) {

var parent: ViewGroup? = null
private set

@get:RestrictTo(RestrictTo.Scope.TESTS)
val yellowBoxes: List<View>
get() = yellowBoxViews
Expand All @@ -22,7 +23,7 @@ open class YellowBoxDelegate(private val context: Context, private val yellowBox

open fun onChildViewAdded(parent: View, child: View?) {
if (!context.isDebug()) return
if (yellowBoxHelper.isYellowBox(parent, child)) onYellowBoxAdded(parent)
if (isYellowBox(parent, child)) onYellowBoxAdded(parent)
}

fun onYellowBoxAdded(parent: View) {
Expand All @@ -39,4 +40,9 @@ open class YellowBoxDelegate(private val context: Context, private val yellowBox
isDestroyed = true
if (yellowBoxViews.isNotEmpty()) yellowBoxViews.forEach { parent?.addView(it) }
}

fun isYellowBox(parent: View?, child: View?): Boolean {
return parent is ViewGroup &&
child is ViewGroup && parent.indexOfChild(child) >= 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ class TitleBarReactView(context: Context?, reactInstanceManager: ReactInstanceMa
// 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
}
}
val measuredWidth = this.children.maxByOrNull { it.measuredWidth }?.measuredWidth?:0
return if (measuredWidth > 0) MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY) else
widthMeasureSpec
}
Expand Down

This file was deleted.

Loading