react-native-navigation 8.8.2-snapshot.2425 → 8.8.2-snapshot.2427
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/android/src/main/java/com/reactnativenavigation/hierarchy/root/RootAnimator.kt +5 -2
- package/android/src/main/java/com/reactnativenavigation/react/NavigationTurboModule.kt +5 -0
- package/android/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerBuilder.java +2 -1
- package/android/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +2 -1
- package/android/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +11 -1
- package/android/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController
|
|
|
10
10
|
open class RootAnimator {
|
|
11
11
|
|
|
12
12
|
open fun setRoot(appearing: ViewController<*>, disappearing: ViewController<*>?, setRoot: TransitionAnimationOptions, onAnimationEnd: ()->Unit) {
|
|
13
|
+
if (appearing.isDestroyed) {
|
|
14
|
+
onAnimationEnd()
|
|
15
|
+
return
|
|
16
|
+
}
|
|
13
17
|
appearing.view.visibility = View.VISIBLE
|
|
14
18
|
|
|
15
19
|
if (!setRoot.hasValue() || (!setRoot.enter.hasAnimation() && !setRoot.exit.hasAnimation())) {
|
|
@@ -22,10 +26,9 @@ open class RootAnimator {
|
|
|
22
26
|
val appearingAnimation = if (setRoot.enter.hasAnimation()) {
|
|
23
27
|
setRoot.enter.getAnimation(appearing.view)
|
|
24
28
|
} else null
|
|
25
|
-
val disappearingAnimation = if (disappearing != null && setRoot.exit.hasAnimation()) {
|
|
29
|
+
val disappearingAnimation = if (disappearing != null && !disappearing.isDestroyed && setRoot.exit.hasAnimation()) {
|
|
26
30
|
setRoot.exit.getAnimation(disappearing.view)
|
|
27
31
|
} else null
|
|
28
|
-
|
|
29
32
|
when {
|
|
30
33
|
appearingAnimation != null && disappearingAnimation != null -> animationSet.playTogether(appearingAnimation, disappearingAnimation)
|
|
31
34
|
appearingAnimation != null -> animationSet.play(appearingAnimation)
|
|
@@ -84,6 +84,11 @@ class NavigationTurboModule(
|
|
|
84
84
|
handle {
|
|
85
85
|
Log.d("NavigationTurboModule", "setRoot handle ${Thread.currentThread()}")
|
|
86
86
|
val viewController = layoutFactory.create(layoutTree)
|
|
87
|
+
val activity = currentActivity
|
|
88
|
+
if (activity == null) {
|
|
89
|
+
promise.reject("ACTIVITY_NULL", "Activity is null")
|
|
90
|
+
return@handle
|
|
91
|
+
}
|
|
87
92
|
navigator()?.setRoot(
|
|
88
93
|
viewController,
|
|
89
94
|
NativeCommandListener("setRoot", commandId, promise, eventEmitter, now)
|
|
@@ -7,6 +7,7 @@ import com.reactnativenavigation.options.Options;
|
|
|
7
7
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
8
8
|
import com.reactnativenavigation.react.events.EventEmitter;
|
|
9
9
|
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
10
|
+
import com.reactnativenavigation.NavigationApplication;
|
|
10
11
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
11
12
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.TopBarController;
|
|
12
13
|
|
|
@@ -32,7 +33,7 @@ public class StackControllerBuilder {
|
|
|
32
33
|
this.activity = activity;
|
|
33
34
|
this.eventEmitter = eventEmitter;
|
|
34
35
|
presenter = new Presenter(activity, new Options());
|
|
35
|
-
animator = new StackAnimator(activity);
|
|
36
|
+
animator = new StackAnimator(activity != null ? activity : NavigationApplication.instance);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
public StackControllerBuilder setEventEmitter(EventEmitter eventEmitter) {
|
|
@@ -65,7 +65,7 @@ public class Presenter {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
private void applyOrientation(OrientationOptions options) {
|
|
68
|
-
activity.setRequestedOrientation(options.getValue());
|
|
68
|
+
if (activity != null) activity.setRequestedOrientation(options.getValue());
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
private void applyViewOptions(ViewController view, Options options) {
|
|
@@ -127,6 +127,7 @@ public class Presenter {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
private void applyNavigationBarVisibility(NavigationBarOptions options) {
|
|
130
|
+
if (activity == null) return;
|
|
130
131
|
View decorView = activity.getWindow().getDecorView();
|
|
131
132
|
if (options.isVisible.isTrueOrUndefined()) {
|
|
132
133
|
SystemUiUtils.showNavigationBar(activity.getWindow(), decorView);
|
|
@@ -36,6 +36,10 @@ public class RootPresenter {
|
|
|
36
36
|
|
|
37
37
|
public void setRoot(ViewController appearingRoot, ViewController<?> disappearingRoot, Options defaultOptions, CommandListener listener) {
|
|
38
38
|
layoutDirectionApplier.apply(appearingRoot, defaultOptions);
|
|
39
|
+
if (appearingRoot.isDestroyed()) {
|
|
40
|
+
listener.onError("Could not set root - appearingRoot is already destroyed");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
39
43
|
rootLayout.addView(appearingRoot.getView(), matchParentWithBehaviour(new BehaviourDelegate(appearingRoot)));
|
|
40
44
|
Options options = appearingRoot.resolveCurrentOptions(defaultOptions);
|
|
41
45
|
AnimationOptions enter = options.animations.setRoot.getEnter();
|
|
@@ -60,6 +64,10 @@ public class RootPresenter {
|
|
|
60
64
|
CommandListener listener,
|
|
61
65
|
Options options)
|
|
62
66
|
{
|
|
67
|
+
if (root.isDestroyed()) {
|
|
68
|
+
listener.onError("Could not set root - root is already destroyed");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
63
71
|
AnimationOptions exit = options.animations.setRoot.getExit();
|
|
64
72
|
AnimationOptions enter = options.animations.setRoot.getEnter();
|
|
65
73
|
if ((enter.enabled.isTrueOrUndefined() && enter.hasAnimation())
|
|
@@ -68,7 +76,9 @@ public class RootPresenter {
|
|
|
68
76
|
disappearingRoot,
|
|
69
77
|
options.animations.setRoot,
|
|
70
78
|
() -> {
|
|
71
|
-
|
|
79
|
+
if (!root.isDestroyed()) {
|
|
80
|
+
listener.onSuccess(root.getId());
|
|
81
|
+
}
|
|
72
82
|
return Unit.INSTANCE;
|
|
73
83
|
});
|
|
74
84
|
} else {
|
|
@@ -235,7 +235,7 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
|
|
|
235
235
|
public T getView() {
|
|
236
236
|
if (view == null) {
|
|
237
237
|
if (isDestroyed) {
|
|
238
|
-
throw new RuntimeException("Tried to create view after it has already been destroyed");
|
|
238
|
+
throw new RuntimeException("Tried to create view for " + getClass().getSimpleName() + " (id: " + id + ") after it has already been destroyed");
|
|
239
239
|
}
|
|
240
240
|
view = createView();
|
|
241
241
|
view.setOnHierarchyChangeListener(this);
|
package/package.json
CHANGED