react-native-navigation 7.30.6-snapshot.847 → 7.30.6-snapshot.852
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/android/app/build.gradle +7 -1
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/options/parsers/ColorParser.kt +38 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +22 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +22 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +65 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java +72 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +22 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +87 -0
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +12 -0
- package/package.json +1 -1
|
@@ -110,6 +110,10 @@ android {
|
|
|
110
110
|
dimension "RNN.reactNativeVersion"
|
|
111
111
|
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "68")
|
|
112
112
|
}
|
|
113
|
+
reactNative71 {
|
|
114
|
+
dimension "RNN.reactNativeVersion"
|
|
115
|
+
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "71")
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
def flavor = resolveFlavor()
|
|
@@ -126,7 +130,9 @@ String resolveFlavor() {
|
|
|
126
130
|
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()
|
|
127
131
|
Integer reactNativePatchComponent = reactNativeVersionComponents[2].toInteger()
|
|
128
132
|
|
|
129
|
-
if (reactNativeMinorComponent >=
|
|
133
|
+
if (reactNativeMinorComponent >= 71) {
|
|
134
|
+
return "reactNative71"
|
|
135
|
+
} else if (reactNativeMinorComponent >= 68) {
|
|
130
136
|
return "reactNative68"
|
|
131
137
|
} else if (reactNativeMinorComponent >= 63) {
|
|
132
138
|
return "reactNative63"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
package com.reactnativenavigation.options.parsers
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.facebook.react.bridge.ColorPropConverter
|
|
5
|
+
import com.reactnativenavigation.options.params.Colour
|
|
6
|
+
import com.reactnativenavigation.options.params.DontApplyColour
|
|
7
|
+
import com.reactnativenavigation.options.params.NullColor
|
|
8
|
+
import com.reactnativenavigation.options.params.ReactPlatformColor
|
|
9
|
+
import org.json.JSONObject
|
|
10
|
+
|
|
11
|
+
object ColorParser {
|
|
12
|
+
private const val KEY_RESOURCE_PATHS = "resource_paths"
|
|
13
|
+
private const val VAL_NO_COLOR = "NoColor"
|
|
14
|
+
|
|
15
|
+
@JvmStatic
|
|
16
|
+
fun parse(context: Context?, json: JSONObject, colorName: String?): Colour {
|
|
17
|
+
if (json.has(KEY_RESOURCE_PATHS)) {
|
|
18
|
+
return ReactPlatformColor(JSONParser.convert(json))
|
|
19
|
+
}
|
|
20
|
+
return when (val color = json.opt(colorName)) {
|
|
21
|
+
null, VAL_NO_COLOR -> {
|
|
22
|
+
DontApplyColour()
|
|
23
|
+
}
|
|
24
|
+
is Int -> {
|
|
25
|
+
Colour(json.optInt(colorName))
|
|
26
|
+
}
|
|
27
|
+
is JSONObject -> {
|
|
28
|
+
ColorPropConverter.getColor(color, context)?.let {
|
|
29
|
+
Colour(it)
|
|
30
|
+
} ?: NullColor()
|
|
31
|
+
}
|
|
32
|
+
else -> {
|
|
33
|
+
NullColor()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.reactnativenavigation.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
|
4
|
+
|
|
5
|
+
import javax.annotation.Nullable;
|
|
6
|
+
|
|
7
|
+
public class DevBundleDownloadListenerAdapter implements DevBundleDownloadListener, NavigationDevBundleDownloadListener {
|
|
8
|
+
@Override
|
|
9
|
+
public void onSuccess() {
|
|
10
|
+
onSuccess();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@Override
|
|
14
|
+
public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
public void onFailure(Exception cause) {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.reactnativenavigation.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
|
4
|
+
|
|
5
|
+
import javax.annotation.Nullable;
|
|
6
|
+
|
|
7
|
+
public class JsDevReloadHandlerFacade implements DevBundleDownloadListener, NavigationDevBundleDownloadListener {
|
|
8
|
+
@Override
|
|
9
|
+
public void onSuccess() {
|
|
10
|
+
onSuccess();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@Override
|
|
14
|
+
public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
public void onFailure(Exception cause) {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
package com.reactnativenavigation.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.infer.annotation.Assertions;
|
|
4
|
+
import com.facebook.react.ReactInstanceManager;
|
|
5
|
+
import com.facebook.react.ReactInstanceManagerBuilder;
|
|
6
|
+
import com.facebook.react.ReactNativeHost;
|
|
7
|
+
import com.facebook.react.ReactPackage;
|
|
8
|
+
import com.facebook.react.common.LifecycleState;
|
|
9
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
|
10
|
+
import com.reactnativenavigation.NavigationApplication;
|
|
11
|
+
|
|
12
|
+
import androidx.annotation.NonNull;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
|
|
15
|
+
public abstract class NavigationReactNativeHost extends ReactNativeHost implements BundleDownloadListenerProvider {
|
|
16
|
+
|
|
17
|
+
private @Nullable NavigationDevBundleDownloadListener bundleListener;
|
|
18
|
+
private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() {
|
|
19
|
+
@Override
|
|
20
|
+
public void onSuccess() {
|
|
21
|
+
if (bundleListener != null) {
|
|
22
|
+
bundleListener.onSuccess();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
public NavigationReactNativeHost(NavigationApplication application) {
|
|
28
|
+
super(application);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) {
|
|
33
|
+
bundleListener = listener;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected ReactInstanceManager createReactInstanceManager() {
|
|
37
|
+
ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
|
|
38
|
+
.setApplication(getApplication())
|
|
39
|
+
.setJSMainModulePath(getJSMainModuleName())
|
|
40
|
+
.setUseDeveloperSupport(getUseDeveloperSupport())
|
|
41
|
+
.setRedBoxHandler(getRedBoxHandler())
|
|
42
|
+
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
|
|
43
|
+
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
|
|
44
|
+
.setJSIModulesPackage(getJSIModulePackage())
|
|
45
|
+
.setDevBundleDownloadListener(getDevBundleDownloadListener());
|
|
46
|
+
|
|
47
|
+
for (ReactPackage reactPackage : getPackages()) {
|
|
48
|
+
builder.addPackage(reactPackage);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
String jsBundleFile = getJSBundleFile();
|
|
52
|
+
if (jsBundleFile != null) {
|
|
53
|
+
builder.setJSBundleFile(jsBundleFile);
|
|
54
|
+
} else {
|
|
55
|
+
builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName()));
|
|
56
|
+
}
|
|
57
|
+
return builder.build();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@SuppressWarnings("WeakerAccess")
|
|
61
|
+
@NonNull
|
|
62
|
+
protected DevBundleDownloadListener getDevBundleDownloadListener() {
|
|
63
|
+
return bundleListenerMediator;
|
|
64
|
+
}
|
|
65
|
+
}
|
package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/ReactGateway.java
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
package com.reactnativenavigation.react;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.content.res.Configuration;
|
|
6
|
+
|
|
7
|
+
import com.facebook.react.ReactNativeHost;
|
|
8
|
+
import com.reactnativenavigation.NavigationActivity;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.NonNull;
|
|
11
|
+
|
|
12
|
+
public class ReactGateway {
|
|
13
|
+
|
|
14
|
+
private final ReactNativeHost host;
|
|
15
|
+
private final NavigationReactInitializer initializer;
|
|
16
|
+
private final JsDevReloadHandler jsDevReloadHandler;
|
|
17
|
+
|
|
18
|
+
public ReactGateway(ReactNativeHost host) {
|
|
19
|
+
this.host = host;
|
|
20
|
+
initializer = new NavigationReactInitializer(host.getReactInstanceManager(), host.getUseDeveloperSupport());
|
|
21
|
+
jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager());
|
|
22
|
+
if (host instanceof BundleDownloadListenerProvider) {
|
|
23
|
+
((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public void onActivityCreated(NavigationActivity activity) {
|
|
28
|
+
initializer.onActivityCreated();
|
|
29
|
+
jsDevReloadHandler.setReloadListener(activity);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public void onActivityResumed(NavigationActivity activity) {
|
|
33
|
+
initializer.onActivityResumed(activity);
|
|
34
|
+
jsDevReloadHandler.onActivityResumed(activity);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public boolean onNewIntent(Intent intent) {
|
|
38
|
+
if (host.hasInstance()) {
|
|
39
|
+
host.getReactInstanceManager().onNewIntent(intent);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public void onConfigurationChanged(NavigationActivity activity, @NonNull Configuration newConfig) {
|
|
46
|
+
if (host.hasInstance()) {
|
|
47
|
+
host.getReactInstanceManager().onConfigurationChanged(activity, newConfig);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public void onActivityPaused(NavigationActivity activity) {
|
|
52
|
+
initializer.onActivityPaused(activity);
|
|
53
|
+
jsDevReloadHandler.onActivityPaused(activity);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public void onActivityDestroyed(NavigationActivity activity) {
|
|
57
|
+
jsDevReloadHandler.removeReloadListener(activity);
|
|
58
|
+
initializer.onActivityDestroyed(activity);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public boolean onKeyUp(Activity activity, int keyCode) {
|
|
62
|
+
return jsDevReloadHandler.onKeyUp(activity, keyCode);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public void onBackPressed() {
|
|
66
|
+
host.getReactInstanceManager().onBackPressed();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
70
|
+
host.getReactInstanceManager().onActivityResult(activity, requestCode, resultCode, data);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.reactnativenavigation.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
|
4
|
+
|
|
5
|
+
import javax.annotation.Nullable;
|
|
6
|
+
|
|
7
|
+
public abstract class ReloadHandlerFacade implements DevBundleDownloadListener {
|
|
8
|
+
@Override
|
|
9
|
+
public void onSuccess() {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@Override
|
|
14
|
+
public void onProgress(@Nullable String status, @Nullable Integer done, @Nullable Integer total) {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
public void onFailure(Exception cause) {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
package com.reactnativenavigation.react.modal
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.view.MotionEvent
|
|
5
|
+
import android.view.View
|
|
6
|
+
import com.facebook.react.bridge.*
|
|
7
|
+
import com.facebook.react.uimanager.*
|
|
8
|
+
import com.facebook.react.uimanager.events.EventDispatcher
|
|
9
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
13
|
+
private var hasAdjustedSize = false
|
|
14
|
+
private var viewWidth = 0
|
|
15
|
+
private var viewHeight = 0
|
|
16
|
+
private val mJSTouchDispatcher = JSTouchDispatcher(this)
|
|
17
|
+
|
|
18
|
+
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
|
|
19
|
+
super.onSizeChanged(w, h, oldw, oldh)
|
|
20
|
+
viewWidth = w
|
|
21
|
+
viewHeight = h
|
|
22
|
+
this.updateFirstChildView()
|
|
23
|
+
}
|
|
24
|
+
private fun updateFirstChildView() {
|
|
25
|
+
if (this.childCount > 0) {
|
|
26
|
+
hasAdjustedSize = false
|
|
27
|
+
val viewTag = getChildAt(0).id
|
|
28
|
+
val reactContext: ReactContext = this.getReactContext()
|
|
29
|
+
reactContext.runOnNativeModulesQueueThread(object : GuardedRunnable(reactContext) {
|
|
30
|
+
override fun runGuarded() {
|
|
31
|
+
val uiManager = this@ModalContentLayout.getReactContext().getNativeModule(
|
|
32
|
+
UIManagerModule::class.java
|
|
33
|
+
) as UIManagerModule
|
|
34
|
+
uiManager.updateNodeSize(
|
|
35
|
+
viewTag,
|
|
36
|
+
this@ModalContentLayout.viewWidth,
|
|
37
|
+
this@ModalContentLayout.viewHeight
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
} else {
|
|
42
|
+
hasAdjustedSize = true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override fun addView(child: View?, index: Int, params: LayoutParams?) {
|
|
47
|
+
super.addView(child, index, params)
|
|
48
|
+
if (hasAdjustedSize) {
|
|
49
|
+
updateFirstChildView()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent?) {
|
|
53
|
+
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
54
|
+
}
|
|
55
|
+
override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) {
|
|
56
|
+
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
57
|
+
}
|
|
58
|
+
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent?) {
|
|
59
|
+
mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
60
|
+
}
|
|
61
|
+
override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}
|
|
62
|
+
private fun getEventDispatcher(): EventDispatcher? {
|
|
63
|
+
val reactContext: ReactContext = this.getReactContext()
|
|
64
|
+
return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
override fun handleException(t: Throwable?) {
|
|
69
|
+
getReactContext().handleException(RuntimeException(t))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private fun getReactContext(): ReactContext {
|
|
73
|
+
return this.context as ReactContext
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {
|
|
77
|
+
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
78
|
+
return super.onInterceptTouchEvent(event)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
|
82
|
+
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
83
|
+
super.onTouchEvent(event)
|
|
84
|
+
return true
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.reactnativenavigation.viewcontrollers.viewcontroller;
|
|
2
|
+
|
|
3
|
+
import android.view.View;
|
|
4
|
+
import android.view.ViewGroup;
|
|
5
|
+
|
|
6
|
+
public class YellowBoxHelper {
|
|
7
|
+
boolean isYellowBox(View parent, View child) {
|
|
8
|
+
return parent instanceof ViewGroup &&
|
|
9
|
+
child instanceof ViewGroup &&
|
|
10
|
+
((ViewGroup) parent).indexOfChild(child) >= 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED