react-native-navigation 7.42.0 → 99.99.1
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/CHANGELOG.md +1 -1854
- package/lib/android/app/src/main/java/com/reactnativenavigation/FeatureToggles.kt +60 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +13 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt +19 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +16 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +7 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +37 -13
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +24 -11
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +13 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarController.kt +9 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarPresenter.kt +9 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/{TopBarAnimator.kt → TopBarAppearanceAnimator.kt} +4 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarCollapseBehavior.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +122 -27
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +79 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +5 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/{BaseViewAnimator.kt → BaseViewAppearanceAnimator.kt} +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ColorAnimator.kt +22 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/DefaultViewAnimatorCreator.kt +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewAnimatorCreator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewBkgColorProperty.kt +17 -0
- package/lib/dist/src/commands/OptionsProcessor.js +8 -1
- package/lib/dist/src/interfaces/Options.d.ts +33 -3
- package/lib/ios/BottomTabsBasePresenter.m +1 -1
- package/lib/ios/RNNConvert.h +0 -1
- package/lib/ios/RNNConvert.m +3 -8
- package/lib/ios/RNNStackPresenter.m +1 -1
- package/lib/src/commands/OptionsProcessor.ts +13 -2
- package/lib/src/interfaces/Options.ts +38 -3
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
package com.reactnativenavigation
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.VisibleForTesting
|
|
4
|
+
|
|
5
|
+
enum class RNNToggles {
|
|
6
|
+
TOP_BAR_COLOR_ANIMATION,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
private val ToggleDefaults = mapOf(
|
|
10
|
+
RNNToggles.TOP_BAR_COLOR_ANIMATION to false
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
object RNNFeatureToggles {
|
|
14
|
+
private var init = false
|
|
15
|
+
private var toggles = mutableMapOf<RNNToggles, Boolean>()
|
|
16
|
+
|
|
17
|
+
@JvmStatic
|
|
18
|
+
fun init() {
|
|
19
|
+
assertNotInitialized()
|
|
20
|
+
|
|
21
|
+
init = true
|
|
22
|
+
toggles = ToggleDefaults.toMutableMap()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@JvmStatic
|
|
26
|
+
fun init(overrides: Map<RNNToggles, Boolean>) {
|
|
27
|
+
init()
|
|
28
|
+
this.toggles.putAll(overrides)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@JvmStatic
|
|
32
|
+
fun init(vararg overrides: Pair<RNNToggles, Boolean>) {
|
|
33
|
+
init(mapOf(*overrides))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@JvmStatic
|
|
37
|
+
fun isEnabled(toggleName: RNNToggles): Boolean {
|
|
38
|
+
assertInitialized()
|
|
39
|
+
return toggles.getOrElse(toggleName) { false }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@VisibleForTesting
|
|
43
|
+
@JvmStatic
|
|
44
|
+
fun clear() {
|
|
45
|
+
init = false
|
|
46
|
+
toggles.clear()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private fun assertNotInitialized() {
|
|
50
|
+
if (init) {
|
|
51
|
+
throw IllegalStateException("FeatureToggles already initialized")
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private fun assertInitialized() {
|
|
56
|
+
if (!init) {
|
|
57
|
+
throw IllegalStateException("FeatureToggles not initialized")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -9,6 +9,7 @@ import com.facebook.soloader.SoLoader;
|
|
|
9
9
|
import com.reactnativenavigation.react.ReactGateway;
|
|
10
10
|
import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentCreator;
|
|
11
11
|
|
|
12
|
+
import java.util.Collections;
|
|
12
13
|
import java.io.IOException;
|
|
13
14
|
import java.util.HashMap;
|
|
14
15
|
import java.util.Map;
|
|
@@ -17,14 +18,23 @@ import androidx.annotation.NonNull;
|
|
|
17
18
|
|
|
18
19
|
public abstract class NavigationApplication extends Application implements ReactApplication {
|
|
19
20
|
|
|
20
|
-
private ReactGateway reactGateway;
|
|
21
21
|
public static NavigationApplication instance;
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
private final Map<String, ExternalComponentCreator> externalComponents = new HashMap<>();
|
|
24
|
+
private ReactGateway reactGateway;
|
|
25
|
+
|
|
26
|
+
public NavigationApplication() {
|
|
27
|
+
this(Collections.emptyMap());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public NavigationApplication(Map<RNNToggles, Boolean> featureToggleOverrides) {
|
|
31
|
+
instance = this;
|
|
32
|
+
RNNFeatureToggles.init(featureToggleOverrides);
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
@Override
|
|
25
36
|
public void onCreate() {
|
|
26
37
|
super.onCreate();
|
|
27
|
-
instance = this;
|
|
28
38
|
try {
|
|
29
39
|
SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
|
|
30
40
|
} catch (IOException e) {
|
package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt
CHANGED
|
@@ -50,9 +50,9 @@ class ValueAnimationOptions {
|
|
|
50
50
|
to += this.to[animationValueAccessor!!(view)]
|
|
51
51
|
}
|
|
52
52
|
val animator = ObjectAnimator.ofFloat(view,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
animProp,
|
|
54
|
+
from,
|
|
55
|
+
to
|
|
56
56
|
)
|
|
57
57
|
animator.interpolator = interpolator
|
|
58
58
|
if (duration.hasValue()) animator.duration = duration.get().toLong()
|
package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.reactnativenavigation.utils
|
|
2
|
+
|
|
3
|
+
import android.animation.Animator
|
|
4
|
+
|
|
5
|
+
open class StubAnimationListener: Animator.AnimatorListener {
|
|
6
|
+
override fun onAnimationStart(animation: Animator) {}
|
|
7
|
+
override fun onAnimationEnd(animation: Animator) {}
|
|
8
|
+
override fun onAnimationCancel(animation: Animator) {}
|
|
9
|
+
override fun onAnimationRepeat(animation: Animator) {}
|
|
10
|
+
|
|
11
|
+
companion object {
|
|
12
|
+
@JvmStatic
|
|
13
|
+
fun onAnimatorEnd(onEnd: (animation: Animator) -> Unit) = object: StubAnimationListener() {
|
|
14
|
+
override fun onAnimationEnd(animation: Animator) {
|
|
15
|
+
onEnd(animation)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -121,19 +121,25 @@ object SystemUiUtils {
|
|
|
121
121
|
@ColorInt color: Int,
|
|
122
122
|
translucent: Boolean
|
|
123
123
|
) {
|
|
124
|
-
val opaqueColor =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
124
|
+
val opaqueColor =
|
|
125
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
126
|
+
Color.BLACK
|
|
127
|
+
} else {
|
|
128
|
+
val colorAlpha = Color.alpha(color)
|
|
129
|
+
val alpha = if (translucent && colorAlpha == 255) STATUS_BAR_HEIGHT_TRANSLUCENCY else colorAlpha/255.0f
|
|
130
|
+
val red: Int = Color.red(color)
|
|
131
|
+
val green: Int = Color.green(color)
|
|
132
|
+
val blue: Int = Color.blue(color)
|
|
133
|
+
Color.argb(ceil(alpha * 255).toInt(), red, green, blue)
|
|
134
|
+
}
|
|
134
135
|
window?.statusBarColor = opaqueColor
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
@JvmStatic
|
|
139
|
+
fun getStatusBarColor(window: Window?): Int? {
|
|
140
|
+
return window?.statusBarColor
|
|
141
|
+
}
|
|
142
|
+
|
|
137
143
|
@JvmStatic
|
|
138
144
|
fun hideStatusBar(window: Window?, view: View) {
|
|
139
145
|
window?.let {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.bottomtabs
|
|
2
2
|
|
|
3
|
-
import com.reactnativenavigation.views.animations.
|
|
3
|
+
import com.reactnativenavigation.views.animations.BaseViewAppearanceAnimator
|
|
4
4
|
import com.reactnativenavigation.views.bottomtabs.BottomTabs
|
|
5
5
|
|
|
6
|
-
class BottomTabsAnimator(view: BottomTabs? = null) :
|
|
6
|
+
class BottomTabsAnimator(view: BottomTabs? = null) : BaseViewAppearanceAnimator<BottomTabs>(HideDirection.Down, view) {
|
|
7
7
|
override fun onShowAnimationEnd() {
|
|
8
8
|
view.restoreBottomNavigation(false)
|
|
9
9
|
}
|
|
@@ -2,30 +2,23 @@ package com.reactnativenavigation.viewcontrollers.child;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.res.Configuration;
|
|
5
|
-
import android.os.Build;
|
|
6
|
-
import android.util.Log;
|
|
7
5
|
import android.view.View;
|
|
8
6
|
import android.view.ViewGroup;
|
|
9
|
-
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.CallSuper;
|
|
9
|
+
import androidx.core.view.ViewCompat;
|
|
10
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
10
11
|
|
|
11
12
|
import com.reactnativenavigation.options.Options;
|
|
12
|
-
import com.reactnativenavigation.utils.LogKt;
|
|
13
|
-
import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
14
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
15
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.NoOpYellowBoxDelegate;
|
|
16
13
|
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
14
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.NoOpYellowBoxDelegate;
|
|
15
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
17
16
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
18
17
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay;
|
|
19
18
|
import com.reactnativenavigation.views.component.Component;
|
|
20
19
|
|
|
21
|
-
import androidx.annotation.CallSuper;
|
|
22
|
-
import androidx.core.graphics.Insets;
|
|
23
|
-
import androidx.core.view.ViewCompat;
|
|
24
|
-
import androidx.core.view.WindowCompat;
|
|
25
|
-
import androidx.core.view.WindowInsetsCompat;
|
|
26
|
-
|
|
27
20
|
public abstract class ChildController<T extends ViewGroup> extends ViewController<T> {
|
|
28
|
-
|
|
21
|
+
protected final Presenter presenter;
|
|
29
22
|
private final ChildControllersRegistry childRegistry;
|
|
30
23
|
|
|
31
24
|
public ChildControllersRegistry getChildRegistry() {
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.component;
|
|
2
2
|
|
|
3
|
+
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
4
|
+
|
|
5
|
+
import android.animation.Animator;
|
|
3
6
|
import android.app.Activity;
|
|
4
7
|
import android.content.res.Configuration;
|
|
5
8
|
import android.view.View;
|
|
6
9
|
|
|
7
|
-
import com.reactnativenavigation.utils.LogKt;
|
|
8
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
9
|
-
import com.reactnativenavigation.options.Options;
|
|
10
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
11
|
-
import com.reactnativenavigation.utils.SystemUiUtils;
|
|
12
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator;
|
|
13
|
-
import com.reactnativenavigation.viewcontrollers.child.ChildController;
|
|
14
|
-
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
15
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
16
|
-
import com.reactnativenavigation.views.component.ComponentLayout;
|
|
17
|
-
|
|
18
10
|
import androidx.annotation.NonNull;
|
|
11
|
+
import androidx.annotation.Nullable;
|
|
19
12
|
import androidx.core.graphics.Insets;
|
|
20
13
|
import androidx.core.view.ViewCompat;
|
|
21
14
|
import androidx.core.view.WindowInsetsCompat;
|
|
22
15
|
|
|
23
|
-
import
|
|
16
|
+
import com.reactnativenavigation.options.Options;
|
|
17
|
+
import com.reactnativenavigation.utils.SystemUiUtils;
|
|
18
|
+
import com.reactnativenavigation.viewcontrollers.child.ChildController;
|
|
19
|
+
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
20
|
+
import com.reactnativenavigation.viewcontrollers.stack.statusbar.StatusBarController;
|
|
21
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
22
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator;
|
|
23
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
24
|
+
import com.reactnativenavigation.views.component.ComponentLayout;
|
|
24
25
|
|
|
25
|
-
public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
26
|
+
public class ComponentViewController extends ChildController<ComponentLayout> implements StatusBarController {
|
|
26
27
|
private final String componentName;
|
|
27
28
|
private final ComponentPresenter presenter;
|
|
28
29
|
private final ReactViewCreator viewCreator;
|
|
@@ -64,6 +65,29 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
64
65
|
presenter.setDefaultOptions(defaultOptions);
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
@Override
|
|
69
|
+
public StatusBarController getStatusBarController() {
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Nullable
|
|
74
|
+
@Override
|
|
75
|
+
public Animator getStatusBarPushAnimation(@NonNull Options appearingOptions) {
|
|
76
|
+
if (super.presenter != null) {
|
|
77
|
+
return super.presenter.getStatusBarPushAnimation(appearingOptions);
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Nullable
|
|
83
|
+
@Override
|
|
84
|
+
public Animator getStatusBarPopAnimation(@NonNull Options appearingOptions, @NonNull Options disappearingOptions) {
|
|
85
|
+
if (super.presenter != null) {
|
|
86
|
+
return super.presenter.getStatusBarPopAnimation(appearingOptions, disappearingOptions);
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
67
91
|
@Override
|
|
68
92
|
public ScrollEventListener getScrollEventListener() {
|
|
69
93
|
return perform(view, null, ComponentLayout::getScrollEventListener);
|
|
@@ -159,16 +159,19 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
159
159
|
listener.onError("A stack can't contain two children with the same id: " + child.getId());
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
|
|
163
|
+
final ViewController<?> toRemove = pushChildToStack(child);
|
|
164
|
+
|
|
165
|
+
if (!isViewCreated()) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
|
|
167
169
|
Options resolvedOptions = resolveCurrentOptions(presenter.getDefaultOptions());
|
|
168
|
-
|
|
170
|
+
updateChildLayout(child, resolvedOptions);
|
|
171
|
+
|
|
169
172
|
if (toRemove != null) {
|
|
170
|
-
StackAnimationOptions
|
|
171
|
-
if (
|
|
173
|
+
StackAnimationOptions animOptions = resolvedOptions.animations.push;
|
|
174
|
+
if (animOptions.enabled.isTrueOrUndefined()) {
|
|
172
175
|
animator.push(
|
|
173
176
|
child,
|
|
174
177
|
toRemove,
|
|
@@ -195,7 +198,17 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
195
198
|
listener.onSuccess(toAdd.getId());
|
|
196
199
|
}
|
|
197
200
|
|
|
198
|
-
private
|
|
201
|
+
private ViewController<?> pushChildToStack(ViewController<?> child) {
|
|
202
|
+
final ViewController<?> toRemove = stack.peek();
|
|
203
|
+
|
|
204
|
+
if (size() > 0) backButtonHelper.addToPushedChild(child);
|
|
205
|
+
|
|
206
|
+
child.setParentController(this);
|
|
207
|
+
stack.push(child.getId(), child);
|
|
208
|
+
return toRemove;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private void updateChildLayout(ViewController<?> child, Options resolvedOptions) {
|
|
199
212
|
child.setWaitForRender(resolvedOptions.animations.push.waitForRender);
|
|
200
213
|
if (size() == 1) presenter.applyInitialChildLayoutOptions(resolvedOptions);
|
|
201
214
|
getView().addView(child.getView(), getView().getChildCount() - 1, matchParentWithBehaviour(new StackBehaviour(this)));
|
|
@@ -222,7 +235,7 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
222
235
|
child.setParentController(this);
|
|
223
236
|
stack.push(child.getId(), child);
|
|
224
237
|
Options resolvedOptions = resolveCurrentOptions(presenter.getDefaultOptions());
|
|
225
|
-
|
|
238
|
+
updateChildLayout(child, resolvedOptions);
|
|
226
239
|
|
|
227
240
|
CommandListener listenerAdapter = new CommandListenerAdapter() {
|
|
228
241
|
@Override
|
|
@@ -316,7 +329,7 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
316
329
|
appearing,
|
|
317
330
|
disappearing,
|
|
318
331
|
disappearingOptions,
|
|
319
|
-
presenter.getAdditionalPopAnimations(appearingOptions, disappearingOptions),
|
|
332
|
+
presenter.getAdditionalPopAnimations(appearingOptions, disappearingOptions, appearing),
|
|
320
333
|
() -> finishPopping(appearing, disappearing, listener)
|
|
321
334
|
);
|
|
322
335
|
} else {
|
|
@@ -233,7 +233,7 @@ public class StackPresenter {
|
|
|
233
233
|
|
|
234
234
|
topBar.setBorderHeight(topBarOptions.borderHeight.get(0d));
|
|
235
235
|
topBar.setBorderColor(topBarOptions.borderColor.get(DEFAULT_BORDER_COLOR));
|
|
236
|
-
|
|
236
|
+
topBarController.setBackgroundColor(topBarOptions, Color.WHITE);
|
|
237
237
|
|
|
238
238
|
if (topBarOptions.background.component.hasValue()) {
|
|
239
239
|
View createdComponent = findBackgroundComponent(topBarOptions.background.component);
|
|
@@ -417,18 +417,23 @@ public class StackPresenter {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
public List<Animator> getAdditionalPushAnimations(
|
|
420
|
+
public List<Animator> getAdditionalPushAnimations(
|
|
421
|
+
StackController stack,
|
|
422
|
+
ViewController<?> appearingCtrl,
|
|
421
423
|
Options appearingOptions) {
|
|
422
424
|
return CollectionUtils.asList(
|
|
423
|
-
topBarController.getPushAnimation(appearingOptions,
|
|
424
|
-
|
|
425
|
-
perform(bottomTabsController, null, btc -> btc.getPushAnimation(appearingOptions))
|
|
425
|
+
topBarController.getPushAnimation(appearingOptions, getTopBarTranslationAnimationDelta(stack, appearingCtrl)),
|
|
426
|
+
perform(appearingCtrl.getStatusBarController(), null, sbc -> sbc.getStatusBarPushAnimation(appearingOptions)),
|
|
427
|
+
perform(bottomTabsController, null, btc -> btc.getPushAnimation(appearingOptions))
|
|
428
|
+
);
|
|
426
429
|
}
|
|
427
430
|
|
|
428
|
-
public List<Animator> getAdditionalPopAnimations(Options appearingOptions, Options disappearingOptions) {
|
|
431
|
+
public List<Animator> getAdditionalPopAnimations(Options appearingOptions, Options disappearingOptions, ViewController<?> appearingCtrl) {
|
|
429
432
|
return CollectionUtils.asList(
|
|
430
433
|
topBarController.getPopAnimation(appearingOptions, disappearingOptions),
|
|
431
|
-
perform(
|
|
434
|
+
perform(appearingCtrl.getStatusBarController(), null, sbc -> sbc.getStatusBarPopAnimation(appearingOptions, disappearingOptions)),
|
|
435
|
+
perform(bottomTabsController, null, btc -> btc.getPopAnimation(appearingOptions, disappearingOptions))
|
|
436
|
+
);
|
|
432
437
|
}
|
|
433
438
|
|
|
434
439
|
public List<Animator> getAdditionalSetRootAnimations(StackController stack, ViewController<?> appearing,
|
|
@@ -618,9 +623,7 @@ public class StackPresenter {
|
|
|
618
623
|
if (resolveOptions.subtitle.font.hasValue()) {
|
|
619
624
|
topBar.setSubtitleTypeface(typefaceLoader, resolveOptions.subtitle.font);
|
|
620
625
|
}
|
|
621
|
-
|
|
622
|
-
if (topBarOptions.background.color.hasValue())
|
|
623
|
-
topBar.setBackgroundColor(topBarOptions.background.color.get());
|
|
626
|
+
topBarController.setBackgroundColor(topBarOptions);
|
|
624
627
|
|
|
625
628
|
if (topBarOptions.background.component.hasValue()) {
|
|
626
629
|
if (backgroundControllers.containsKey(component)) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package com.reactnativenavigation.viewcontrollers.stack.statusbar
|
|
2
|
+
|
|
3
|
+
import android.animation.Animator
|
|
4
|
+
import com.reactnativenavigation.options.Options
|
|
5
|
+
|
|
6
|
+
interface StatusBarController {
|
|
7
|
+
fun getStatusBarPushAnimation(appearingOptions: Options): Animator?
|
|
8
|
+
fun getStatusBarPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator?
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package com.reactnativenavigation.viewcontrollers.stack.statusbar
|
|
2
|
+
|
|
3
|
+
import android.animation.Animator
|
|
4
|
+
import com.reactnativenavigation.options.Options
|
|
5
|
+
|
|
6
|
+
interface StatusBarPresenter {
|
|
7
|
+
fun getStatusBarPushAnimation(appearingOptions: Options): Animator?
|
|
8
|
+
fun getStatusBarPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator?
|
|
9
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.stack.topbar
|
|
2
2
|
|
|
3
|
-
import com.reactnativenavigation.views.animations.
|
|
3
|
+
import com.reactnativenavigation.views.animations.BaseViewAppearanceAnimator
|
|
4
4
|
import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class TopBarAppearanceAnimator @JvmOverloads constructor(view: TopBar? = null)
|
|
7
|
+
: BaseViewAppearanceAnimator<TopBar>(HideDirection.Up, view) {
|
|
8
|
+
|
|
7
9
|
@Suppress("UNUSED_PARAMETER")
|
|
8
10
|
fun hideOnScroll(translationStart: Float, translationEndDy: Float) {
|
|
9
11
|
// NOOP for now - this entire mechanism needs to be reimplemented as it relies on bridge events which are obsolete in TurboModules config
|
|
@@ -7,7 +7,7 @@ import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
|
7
7
|
|
|
8
8
|
class TopBarCollapseBehavior(private val topBar: TopBar) : ScrollEventListener.OnScrollListener, ScrollEventListener.OnDragListener {
|
|
9
9
|
private var scrollEventListener: ScrollEventListener? = null
|
|
10
|
-
private val animator:
|
|
10
|
+
private val animator: TopBarAppearanceAnimator = TopBarAppearanceAnimator(topBar)
|
|
11
11
|
|
|
12
12
|
fun enableCollapse(scrollEventListener: ScrollEventListener?) {
|
|
13
13
|
this.scrollEventListener = scrollEventListener
|