react-native-navigation 7.42.0-snapshot.1529 → 7.99.1-testbla
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/Mock/Components/ComponentScreen.tsx +15 -29
- package/lib/Mock/Components/LayoutComponent.tsx +2 -2
- package/lib/Mock/index.js +2 -2
- package/lib/android/app/build.gradle +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +4 -20
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +2 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +10 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -6
- 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 +14 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +13 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +11 -24
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +10 -13
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/{TopBarAppearanceAnimator.kt → TopBarAnimator.kt} +2 -4
- 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 +27 -122
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt +4 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +6 -79
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/{BaseViewAppearanceAnimator.kt → BaseViewAnimator.kt} +4 -4
- 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/element/animators/BackgroundColorAnimator.kt +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorEvaluator.kt +2 -4
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +6 -6
- package/lib/dist/Mock/Application.d.ts +6 -4
- package/lib/dist/Mock/Components/BottomTabs.d.ts +13 -9
- package/lib/dist/Mock/Components/ComponentScreen.d.ts +7 -5
- package/lib/dist/Mock/Components/ComponentScreen.js +3 -10
- package/lib/dist/Mock/Components/LayoutComponent.d.ts +13 -9
- package/lib/dist/Mock/Components/Modals.d.ts +13 -9
- package/lib/dist/Mock/Components/NavigationButton.d.ts +15 -11
- package/lib/dist/Mock/Components/Overlays.d.ts +13 -9
- package/lib/dist/Mock/Components/Stack.d.ts +13 -9
- package/lib/dist/Mock/Components/TopBar.d.ts +9 -7
- package/lib/dist/Mock/connect.js +1 -2
- package/lib/dist/Mock/index.js +2 -2
- package/lib/dist/src/adapters/NativeEventsReceiver.js +1 -1
- package/lib/dist/src/adapters/TouchablePreview.d.ts +2 -2
- package/lib/dist/src/commands/LayoutType.js +1 -1
- package/lib/dist/src/commands/OptionsProcessor.js +1 -8
- package/lib/dist/src/components/Modal.d.ts +1 -1
- package/lib/dist/src/interfaces/CommandName.js +1 -1
- package/lib/dist/src/interfaces/Options.d.ts +3 -33
- package/lib/dist/src/interfaces/Options.js +2 -2
- package/lib/dist/src/types.d.ts +0 -1
- package/lib/ios/BottomTabsBasePresenter.m +2 -3
- package/lib/ios/RNNAppDelegate.mm +2 -1
- package/lib/ios/RNNConvert.h +0 -2
- package/lib/ios/RNNConvert.m +0 -4
- package/lib/ios/RNNStackPresenter.m +2 -3
- package/lib/src/adapters/NativeEventsReceiver.ts +3 -3
- package/lib/src/adapters/TouchablePreview.tsx +3 -3
- package/lib/src/commands/OptionsProcessor.ts +2 -13
- package/lib/src/interfaces/Options.ts +3 -38
- package/package.json +31 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/FeatureToggles.kt +0 -60
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt +0 -19
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarController.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarPresenter.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ColorAnimator.kt +0 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewBkgColorProperty.kt +0 -17
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.stack.topbar
|
|
2
2
|
|
|
3
3
|
import android.animation.Animator
|
|
4
|
-
import android.animation.AnimatorSet
|
|
5
4
|
import android.content.Context
|
|
6
|
-
import android.graphics.drawable.ColorDrawable
|
|
7
5
|
import android.view.MenuItem
|
|
8
6
|
import android.view.View
|
|
9
|
-
import androidx.core.animation.addListener
|
|
10
7
|
import androidx.viewpager.widget.ViewPager
|
|
11
|
-
import com.reactnativenavigation.RNNFeatureToggles
|
|
12
|
-
import com.reactnativenavigation.RNNToggles.TOP_BAR_COLOR_ANIMATION
|
|
13
8
|
import com.reactnativenavigation.options.Alignment
|
|
14
9
|
import com.reactnativenavigation.options.AnimationOptions
|
|
15
10
|
import com.reactnativenavigation.options.Options
|
|
16
|
-
import com.reactnativenavigation.options.TopBarOptions
|
|
17
|
-
import com.reactnativenavigation.options.animations.ViewAnimationOptions
|
|
18
11
|
import com.reactnativenavigation.utils.CollectionUtils.forEachIndexed
|
|
19
12
|
import com.reactnativenavigation.utils.ViewUtils
|
|
20
13
|
import com.reactnativenavigation.utils.resetViewProperties
|
|
21
14
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.button.ButtonController
|
|
22
15
|
import com.reactnativenavigation.viewcontrollers.stack.topbar.title.TitleBarReactViewController
|
|
23
|
-
import com.reactnativenavigation.views.animations.ColorAnimator
|
|
24
16
|
import com.reactnativenavigation.views.stack.StackLayout
|
|
25
17
|
import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
26
18
|
import com.reactnativenavigation.views.stack.topbar.titlebar.ButtonBar
|
|
27
19
|
|
|
28
20
|
|
|
29
|
-
open class TopBarController(
|
|
30
|
-
private val appearAnimator: TopBarAppearanceAnimator = TopBarAppearanceAnimator(),
|
|
31
|
-
private val colorAnimator: ColorAnimator = ColorAnimator(),
|
|
32
|
-
) {
|
|
21
|
+
open class TopBarController(private val animator: TopBarAnimator = TopBarAnimator()) {
|
|
33
22
|
lateinit var view: TopBar
|
|
34
23
|
private lateinit var leftButtonBar: ButtonBar
|
|
35
24
|
private lateinit var rightButtonBar: ButtonBar
|
|
36
25
|
|
|
37
|
-
private var hasPendingColorAnim = false
|
|
38
26
|
|
|
39
27
|
val height: Int
|
|
40
28
|
get() = view.height
|
|
@@ -43,89 +31,46 @@ open class TopBarController(
|
|
|
43
31
|
val leftButtonCount: Int
|
|
44
32
|
get() = leftButtonBar.buttonCount
|
|
45
33
|
|
|
34
|
+
fun getRightButton(index: Int): MenuItem = rightButtonBar.getButton(index)
|
|
35
|
+
|
|
46
36
|
fun createView(context: Context, parent: StackLayout): TopBar {
|
|
47
37
|
if (!::view.isInitialized) {
|
|
48
38
|
view = createTopBar(context, parent)
|
|
49
39
|
leftButtonBar = view.leftButtonBar
|
|
50
40
|
rightButtonBar = view.rightButtonBar
|
|
51
|
-
|
|
41
|
+
animator.bindView(view)
|
|
52
42
|
}
|
|
53
43
|
return view
|
|
54
44
|
}
|
|
55
45
|
|
|
56
|
-
fun
|
|
57
|
-
|
|
58
|
-
fun clearTopTabs() = view.clearTopTabs()
|
|
59
|
-
|
|
60
|
-
fun setBackgroundColor(topBarOptions: TopBarOptions, defaultColor: Int) {
|
|
61
|
-
val color = topBarOptions.background.color
|
|
62
|
-
|
|
63
|
-
if (!hasPendingColorAnim) {
|
|
64
|
-
view.setBackgroundColor(color.get(defaultColor)!!)
|
|
65
|
-
}
|
|
46
|
+
protected open fun createTopBar(context: Context, stackLayout: StackLayout): TopBar {
|
|
47
|
+
return TopBar(context)
|
|
66
48
|
}
|
|
67
49
|
|
|
68
|
-
fun
|
|
69
|
-
val color = topBarOptions.background.color
|
|
70
|
-
|
|
71
|
-
if (color.hasValue() && !hasPendingColorAnim) {
|
|
72
|
-
view.setBackgroundColor(color.get())
|
|
73
|
-
}
|
|
74
|
-
}
|
|
50
|
+
fun initTopTabs(viewPager: ViewPager?) = view.initTopTabs(viewPager)
|
|
75
51
|
|
|
76
|
-
fun
|
|
52
|
+
fun clearTopTabs() = view.clearTopTabs()
|
|
77
53
|
|
|
78
54
|
fun getPushAnimation(appearingOptions: Options, additionalDy: Float = 0f): Animator? {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
getAppearancePushAnimation(topBarOptions, topBarAnimOptions, additionalDy),
|
|
86
|
-
getBkgColorAnimation(topBarOptions)?.apply {
|
|
87
|
-
hasPendingColorAnim = true
|
|
88
|
-
|
|
89
|
-
addListener(onEnd = {
|
|
90
|
-
hasPendingColorAnim = false
|
|
91
|
-
})
|
|
92
|
-
},
|
|
93
|
-
).filterNotNull().let {
|
|
94
|
-
return if (it.isNotEmpty()) {
|
|
95
|
-
AnimatorSet().apply { playTogether(it) }
|
|
96
|
-
} else {
|
|
97
|
-
null
|
|
98
|
-
}
|
|
99
|
-
}
|
|
55
|
+
if (appearingOptions.topBar.animate.isFalse) return null
|
|
56
|
+
return animator.getPushAnimation(
|
|
57
|
+
appearingOptions.animations.push.topBar,
|
|
58
|
+
appearingOptions.topBar.visible,
|
|
59
|
+
additionalDy
|
|
60
|
+
)
|
|
100
61
|
}
|
|
101
62
|
|
|
102
63
|
fun getPopAnimation(appearingOptions: Options, disappearingOptions: Options): Animator? {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
mutableListOf(
|
|
109
|
-
getAppearancePopAnimation(topBarOptions, topBarAnimOptions),
|
|
110
|
-
getBkgColorAnimation(topBarOptions)?.apply {
|
|
111
|
-
hasPendingColorAnim = true
|
|
112
|
-
|
|
113
|
-
addListener(onEnd = {
|
|
114
|
-
hasPendingColorAnim = false
|
|
115
|
-
})
|
|
116
|
-
},
|
|
117
|
-
).filterNotNull().let {
|
|
118
|
-
return if (it.isNotEmpty()) {
|
|
119
|
-
AnimatorSet().apply { playTogether(it) }
|
|
120
|
-
} else {
|
|
121
|
-
null
|
|
122
|
-
}
|
|
123
|
-
}
|
|
64
|
+
if (appearingOptions.topBar.animate.isFalse) return null
|
|
65
|
+
return animator.getPopAnimation(
|
|
66
|
+
disappearingOptions.animations.pop.topBar,
|
|
67
|
+
appearingOptions.topBar.visible
|
|
68
|
+
)
|
|
124
69
|
}
|
|
125
70
|
|
|
126
71
|
fun getSetStackRootAnimation(appearingOptions: Options, additionalDy: Float = 0f): Animator? {
|
|
127
72
|
if (appearingOptions.topBar.animate.isFalse) return null
|
|
128
|
-
return
|
|
73
|
+
return animator.getSetStackRootAnimation(
|
|
129
74
|
appearingOptions.animations.setStackRoot.topBar,
|
|
130
75
|
appearingOptions.topBar.visible,
|
|
131
76
|
additionalDy
|
|
@@ -133,23 +78,23 @@ open class TopBarController(
|
|
|
133
78
|
}
|
|
134
79
|
|
|
135
80
|
fun show() {
|
|
136
|
-
if (ViewUtils.isVisible(view) ||
|
|
81
|
+
if (ViewUtils.isVisible(view) || animator.isAnimatingShow()) return
|
|
137
82
|
view.resetViewProperties()
|
|
138
83
|
view.visibility = View.VISIBLE
|
|
139
84
|
}
|
|
140
85
|
|
|
141
86
|
fun showAnimate(options: AnimationOptions, additionalDy: Float) {
|
|
142
|
-
if (ViewUtils.isVisible(view) ||
|
|
143
|
-
|
|
87
|
+
if (ViewUtils.isVisible(view) || animator.isAnimatingShow()) return
|
|
88
|
+
animator.show(options, additionalDy)
|
|
144
89
|
}
|
|
145
90
|
|
|
146
91
|
fun hide() {
|
|
147
|
-
if (!
|
|
92
|
+
if (!animator.isAnimatingHide()) view.visibility = View.GONE
|
|
148
93
|
}
|
|
149
94
|
|
|
150
95
|
fun hideAnimate(options: AnimationOptions, additionalDy: Float) {
|
|
151
|
-
if (!ViewUtils.isVisible(view) ||
|
|
152
|
-
|
|
96
|
+
if (!ViewUtils.isVisible(view) || animator.isAnimatingHide()) return
|
|
97
|
+
animator.hide(options, additionalDy)
|
|
153
98
|
}
|
|
154
99
|
|
|
155
100
|
fun setTitleComponent(component: TitleBarReactViewController) {
|
|
@@ -181,44 +126,4 @@ open class TopBarController(
|
|
|
181
126
|
toRemove.forEach { view.removeLeftButton(it) }
|
|
182
127
|
forEachIndexed(toAdd) { b: ButtonController, i: Int -> b.addToMenu(leftButtonBar, i * 10) }
|
|
183
128
|
}
|
|
184
|
-
|
|
185
|
-
protected open fun createTopBar(context: Context, stackLayout: StackLayout): TopBar {
|
|
186
|
-
return TopBar(context)
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
private fun getBkgColorAnimation(topBarOptions: TopBarOptions): Animator? {
|
|
190
|
-
val targetColor = topBarOptions.background.color
|
|
191
|
-
|
|
192
|
-
if (targetColor.hasValue()
|
|
193
|
-
&& view.background is ColorDrawable
|
|
194
|
-
&& RNNFeatureToggles.isEnabled(TOP_BAR_COLOR_ANIMATION)) {
|
|
195
|
-
return colorAnimator.getAnimation(
|
|
196
|
-
view,
|
|
197
|
-
(view.background as ColorDrawable).color,
|
|
198
|
-
targetColor.get()
|
|
199
|
-
)
|
|
200
|
-
}
|
|
201
|
-
return null
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
private fun getAppearancePushAnimation(topBarOptions: TopBarOptions, topBarAnimOptions: ViewAnimationOptions, additionalDy: Float) =
|
|
205
|
-
if (!topBarOptions.animate.isFalse) {
|
|
206
|
-
appearAnimator.getPushAnimation(
|
|
207
|
-
topBarAnimOptions,
|
|
208
|
-
topBarOptions.visible,
|
|
209
|
-
additionalDy,
|
|
210
|
-
)
|
|
211
|
-
} else {
|
|
212
|
-
null
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
private fun getAppearancePopAnimation(topBarOptions: TopBarOptions, topBarAnimOptions: ViewAnimationOptions) =
|
|
216
|
-
if (!topBarOptions.animate.isFalse) {
|
|
217
|
-
appearAnimator.getPopAnimation(
|
|
218
|
-
topBarAnimOptions,
|
|
219
|
-
topBarOptions.visible,
|
|
220
|
-
)
|
|
221
|
-
} else {
|
|
222
|
-
null
|
|
223
|
-
}
|
|
224
|
-
}
|
|
129
|
+
}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.viewcontroller
|
|
2
2
|
|
|
3
|
-
import android.annotation.SuppressLint
|
|
4
3
|
import com.facebook.react.ReactInstanceManager
|
|
5
4
|
import com.facebook.react.modules.i18nmanager.I18nUtil
|
|
6
5
|
import com.reactnativenavigation.options.Options
|
|
7
6
|
|
|
8
7
|
class LayoutDirectionApplier {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
val currentContext = root.view?.context ?: return
|
|
12
|
-
|
|
13
|
-
if (options.layout.direction.hasValue()) {
|
|
8
|
+
fun apply(root: ViewController<*>, options: Options, instanceManager: ReactInstanceManager) {
|
|
9
|
+
if (options.layout.direction.hasValue() && instanceManager.currentReactContext != null) {
|
|
14
10
|
root.activity.window.decorView.layoutDirection = options.layout.direction.get()
|
|
15
|
-
I18nUtil.
|
|
16
|
-
I18nUtil.
|
|
11
|
+
I18nUtil.getInstance().allowRTL(instanceManager.currentReactContext, options.layout.direction.isRtl)
|
|
12
|
+
I18nUtil.getInstance().forceRTL(instanceManager.currentReactContext, options.layout.direction.isRtl)
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.viewcontroller;
|
|
2
2
|
|
|
3
|
-
import static com.reactnativenavigation.utils.StubAnimationListener.onAnimatorEnd;
|
|
4
|
-
|
|
5
|
-
import android.animation.Animator;
|
|
6
|
-
import android.animation.ValueAnimator;
|
|
7
3
|
import android.app.Activity;
|
|
8
4
|
import android.graphics.Color;
|
|
9
5
|
import android.graphics.drawable.ColorDrawable;
|
|
@@ -14,11 +10,6 @@ import android.view.ViewGroup;
|
|
|
14
10
|
import android.view.ViewGroup.MarginLayoutParams;
|
|
15
11
|
import android.view.Window;
|
|
16
12
|
|
|
17
|
-
import androidx.annotation.NonNull;
|
|
18
|
-
|
|
19
|
-
import com.reactnativenavigation.RNNFeatureToggles;
|
|
20
|
-
import com.reactnativenavigation.RNNToggles;
|
|
21
|
-
import com.reactnativenavigation.options.AnimationOptions;
|
|
22
13
|
import com.reactnativenavigation.options.NavigationBarOptions;
|
|
23
14
|
import com.reactnativenavigation.options.Options;
|
|
24
15
|
import com.reactnativenavigation.options.OrientationOptions;
|
|
@@ -26,31 +17,18 @@ import com.reactnativenavigation.options.StatusBarOptions;
|
|
|
26
17
|
import com.reactnativenavigation.options.StatusBarOptions.TextColorScheme;
|
|
27
18
|
import com.reactnativenavigation.options.layout.LayoutInsets;
|
|
28
19
|
import com.reactnativenavigation.options.params.Bool;
|
|
29
|
-
import com.reactnativenavigation.options.params.ThemeColour;
|
|
30
20
|
import com.reactnativenavigation.utils.SystemUiUtils;
|
|
31
|
-
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
32
21
|
import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
33
|
-
import com.reactnativenavigation.viewcontrollers.
|
|
34
|
-
import com.reactnativenavigation.views.animations.ColorAnimator;
|
|
35
|
-
|
|
36
|
-
import org.jetbrains.annotations.NotNull;
|
|
37
|
-
import org.jetbrains.annotations.Nullable;
|
|
22
|
+
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
38
23
|
|
|
39
|
-
public class Presenter
|
|
24
|
+
public class Presenter {
|
|
40
25
|
private final Activity activity;
|
|
41
|
-
private final ColorAnimator colorAnimator;
|
|
42
|
-
|
|
43
26
|
private Options defaultOptions;
|
|
44
|
-
private Boolean hasPendingColorAnim = false;
|
|
45
27
|
|
|
46
28
|
public Presenter(Activity activity, Options defaultOptions) {
|
|
47
|
-
this(activity, defaultOptions, new ColorAnimator());
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public Presenter(Activity activity, Options defaultOptions, ColorAnimator colorAnimator) {
|
|
51
29
|
this.activity = activity;
|
|
52
|
-
this.colorAnimator = colorAnimator;
|
|
53
30
|
this.defaultOptions = defaultOptions;
|
|
31
|
+
|
|
54
32
|
}
|
|
55
33
|
|
|
56
34
|
public void setDefaultOptions(Options defaultOptions) {
|
|
@@ -128,56 +106,12 @@ public class Presenter implements StatusBarPresenter {
|
|
|
128
106
|
|
|
129
107
|
private void applyStatusBarOptions(ViewController viewController, Options options) {
|
|
130
108
|
StatusBarOptions statusBar = options.copy().withDefaultOptions(defaultOptions).statusBar;
|
|
131
|
-
|
|
132
|
-
if (!hasPendingColorAnim) {
|
|
133
|
-
setStatusBarBackgroundColor(statusBar);
|
|
134
|
-
}
|
|
109
|
+
setStatusBarBackgroundColor(statusBar);
|
|
135
110
|
setTextColorScheme(statusBar);
|
|
136
111
|
setTranslucent(statusBar);
|
|
137
112
|
setStatusBarVisible(viewController, statusBar.visible);
|
|
138
113
|
}
|
|
139
114
|
|
|
140
|
-
@Nullable
|
|
141
|
-
@Override
|
|
142
|
-
public Animator getStatusBarPushAnimation(@NotNull Options appearingOptions) {
|
|
143
|
-
StatusBarOptions statusBarOptions = appearingOptions.statusBar;
|
|
144
|
-
return getStatusBarColorAnimation(statusBarOptions);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
@androidx.annotation.Nullable
|
|
148
|
-
@Override
|
|
149
|
-
public Animator getStatusBarPopAnimation(@NonNull Options appearingOptions, @NonNull Options disappearingOptions) {
|
|
150
|
-
StatusBarOptions statusBarOptions = appearingOptions.statusBar;
|
|
151
|
-
return getStatusBarColorAnimation(statusBarOptions);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private Animator getStatusBarColorAnimation(StatusBarOptions statusBarOptions) {
|
|
155
|
-
if (RNNFeatureToggles.isEnabled(RNNToggles.TOP_BAR_COLOR_ANIMATION)) {
|
|
156
|
-
ThemeColour targetColor = statusBarOptions.backgroundColor;
|
|
157
|
-
|
|
158
|
-
if (targetColor.hasValue()) {
|
|
159
|
-
boolean translucent = statusBarOptions.translucent.isTrue();
|
|
160
|
-
ValueAnimator animator = colorAnimator.getAnimation(
|
|
161
|
-
getCurrentStatusBarBackgroundColor(),
|
|
162
|
-
targetColor.get()
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
animator.addUpdateListener(animation ->
|
|
166
|
-
setStatusBarBackgroundColor((int) animation.getAnimatedValue(), translucent));
|
|
167
|
-
|
|
168
|
-
animator.addListener(onAnimatorEnd(animation -> {
|
|
169
|
-
hasPendingColorAnim = false;
|
|
170
|
-
return null;
|
|
171
|
-
}));
|
|
172
|
-
|
|
173
|
-
hasPendingColorAnim = true;
|
|
174
|
-
return animator;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
hasPendingColorAnim = false;
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
115
|
private void setTranslucent(StatusBarOptions options) {
|
|
182
116
|
Window window = activity.getWindow();
|
|
183
117
|
if (options.translucent.isTrue()) {
|
|
@@ -199,14 +133,11 @@ public class Presenter implements StatusBarPresenter {
|
|
|
199
133
|
private void setStatusBarBackgroundColor(StatusBarOptions statusBar) {
|
|
200
134
|
if (statusBar.backgroundColor.canApplyValue()) {
|
|
201
135
|
final int statusBarBackgroundColor = getStatusBarBackgroundColor(statusBar);
|
|
202
|
-
|
|
136
|
+
SystemUiUtils.setStatusBarColor(activity.getWindow(), statusBarBackgroundColor,
|
|
137
|
+
statusBar.translucent.isTrue());
|
|
203
138
|
}
|
|
204
139
|
}
|
|
205
140
|
|
|
206
|
-
private void setStatusBarBackgroundColor(int color, Boolean translucent) {
|
|
207
|
-
SystemUiUtils.setStatusBarColor(activity.getWindow(), color, translucent);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
141
|
private boolean isDarkTextColorScheme(StatusBarOptions statusBar) {
|
|
211
142
|
if (statusBar.textColorScheme == TextColorScheme.Dark) {
|
|
212
143
|
return true;
|
|
@@ -222,10 +153,6 @@ public class Presenter implements StatusBarPresenter {
|
|
|
222
153
|
return statusBar.backgroundColor.get(defaultColor);
|
|
223
154
|
}
|
|
224
155
|
|
|
225
|
-
private int getCurrentStatusBarBackgroundColor() {
|
|
226
|
-
return SystemUiUtils.getStatusBarColor(activity.getWindow());
|
|
227
|
-
}
|
|
228
|
-
|
|
229
156
|
private void setTextColorScheme(StatusBarOptions statusBar) {
|
|
230
157
|
final View view = activity.getWindow().getDecorView();
|
|
231
158
|
//View.post is a Workaround, added to solve internal Samsung
|
|
@@ -35,7 +35,7 @@ public class RootPresenter {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public void setRoot(ViewController appearingRoot, ViewController<?> disappearingRoot, Options defaultOptions, CommandListener listener, ReactInstanceManager reactInstanceManager) {
|
|
38
|
-
layoutDirectionApplier.apply(appearingRoot, defaultOptions);
|
|
38
|
+
layoutDirectionApplier.apply(appearingRoot, defaultOptions, reactInstanceManager);
|
|
39
39
|
rootLayout.addView(appearingRoot.getView(), matchParentWithBehaviour(new BehaviourDelegate(appearingRoot)));
|
|
40
40
|
Options options = appearingRoot.resolveCurrentOptions(defaultOptions);
|
|
41
41
|
AnimationOptions enter = options.animations.setRoot.getEnter();
|
|
@@ -27,7 +27,6 @@ import com.reactnativenavigation.utils.UiThread;
|
|
|
27
27
|
import com.reactnativenavigation.utils.UiUtils;
|
|
28
28
|
import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
29
29
|
import com.reactnativenavigation.viewcontrollers.stack.StackController;
|
|
30
|
-
import com.reactnativenavigation.viewcontrollers.stack.statusbar.StatusBarController;
|
|
31
30
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay;
|
|
32
31
|
import com.reactnativenavigation.views.BehaviourAdapter;
|
|
33
32
|
import com.reactnativenavigation.views.component.Component;
|
|
@@ -92,10 +91,6 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
|
|
|
92
91
|
options = initialOptions.copy();
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
public StatusBarController getStatusBarController() {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
94
|
public void setWaitForRender(Bool waitForRender) {
|
|
100
95
|
this.waitForRender = waitForRender;
|
|
101
96
|
}
|
|
@@ -12,7 +12,7 @@ import com.reactnativenavigation.options.animations.ViewAnimationOptions
|
|
|
12
12
|
import com.reactnativenavigation.options.params.Bool
|
|
13
13
|
import com.reactnativenavigation.utils.resetViewProperties
|
|
14
14
|
|
|
15
|
-
open class
|
|
15
|
+
open class BaseViewAnimator<T : View>(
|
|
16
16
|
private val hideDirection: HideDirection,
|
|
17
17
|
view: T? = null,
|
|
18
18
|
private val defaultAnimatorCreator: ViewAnimatorCreator = DefaultViewAnimatorCreator()
|
|
@@ -90,16 +90,16 @@ open class BaseViewAppearanceAnimator<T : View>(
|
|
|
90
90
|
|
|
91
91
|
fun isAnimatingShow() = showAnimator.isRunning
|
|
92
92
|
|
|
93
|
-
fun getPushAnimation(
|
|
93
|
+
fun getPushAnimation(animation: ViewAnimationOptions, visible: Bool, additionalDy: Float = 0f): Animator? {
|
|
94
94
|
if (isOrWillBeVisible && visible.isFalse) {
|
|
95
95
|
showAnimator.cancel()
|
|
96
|
-
hideAnimator =
|
|
96
|
+
hideAnimator = animation.exit.getAnimation(view, defaultAnimatorCreator.getHideAnimator(view, hideDirection, additionalDy))
|
|
97
97
|
return hideAnimator
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
if (isOrWillBeHidden && visible.isTrueOrUndefined) {
|
|
101
101
|
hideAnimator.cancel()
|
|
102
|
-
showAnimator =
|
|
102
|
+
showAnimator = animation.enter.getAnimation(view, defaultAnimatorCreator.getShowAnimator(view, hideDirection, additionalDy))
|
|
103
103
|
return showAnimator
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -13,11 +13,11 @@ class DefaultViewAnimatorCreator : ViewAnimatorCreator {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
override fun getShowAnimator(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
view: View,
|
|
17
|
+
hideDirection: BaseViewAnimator.HideDirection,
|
|
18
|
+
translationStart: Float
|
|
19
19
|
): Animator {
|
|
20
|
-
val direction = if (hideDirection ==
|
|
20
|
+
val direction = if (hideDirection == BaseViewAnimator.HideDirection.Up) 1 else -1
|
|
21
21
|
return ObjectAnimator.ofFloat(
|
|
22
22
|
view,
|
|
23
23
|
View.TRANSLATION_Y,
|
|
@@ -30,11 +30,11 @@ class DefaultViewAnimatorCreator : ViewAnimatorCreator {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
override fun getHideAnimator(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
view: View,
|
|
34
|
+
hideDirection: BaseViewAnimator.HideDirection,
|
|
35
|
+
additionalDy: Float
|
|
36
36
|
): Animator {
|
|
37
|
-
val direction = if (hideDirection ==
|
|
37
|
+
val direction = if (hideDirection == BaseViewAnimator.HideDirection.Up) -1 else 1
|
|
38
38
|
return ObjectAnimator.ofFloat(
|
|
39
39
|
view,
|
|
40
40
|
View.TRANSLATION_Y,
|
|
@@ -4,6 +4,6 @@ import android.animation.Animator
|
|
|
4
4
|
import android.view.View
|
|
5
5
|
|
|
6
6
|
interface ViewAnimatorCreator {
|
|
7
|
-
fun getShowAnimator(view: View, hideDirection:
|
|
8
|
-
fun getHideAnimator(view: View, hideDirection:
|
|
7
|
+
fun getShowAnimator(view: View, hideDirection: BaseViewAnimator.HideDirection, translationStart: Float): Animator
|
|
8
|
+
fun getHideAnimator(view: View, hideDirection: BaseViewAnimator.HideDirection, additionalDy: Float): Animator
|
|
9
9
|
}
|
|
@@ -4,23 +4,21 @@ import android.animation.Animator
|
|
|
4
4
|
import android.animation.ObjectAnimator
|
|
5
5
|
import android.view.View
|
|
6
6
|
import android.view.ViewGroup
|
|
7
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
8
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
9
7
|
import com.facebook.react.views.text.ReactTextView
|
|
8
|
+
import com.facebook.react.views.view.ReactViewBackgroundDrawable
|
|
10
9
|
import com.reactnativenavigation.options.SharedElementTransitionOptions
|
|
11
10
|
import com.reactnativenavigation.utils.*
|
|
12
11
|
|
|
13
|
-
@OptIn(UnstableReactNativeAPI::class)
|
|
14
12
|
class BackgroundColorAnimator(from: View, to: View) : PropertyAnimatorCreator<ViewGroup>(from, to) {
|
|
15
13
|
override fun shouldAnimateProperty(fromChild: ViewGroup, toChild: ViewGroup): Boolean {
|
|
16
|
-
return fromChild.background is
|
|
17
|
-
toChild.background is
|
|
14
|
+
return fromChild.background is ReactViewBackgroundDrawable &&
|
|
15
|
+
toChild.background is ReactViewBackgroundDrawable && (fromChild.background as ReactViewBackgroundDrawable).color != (toChild.background as ReactViewBackgroundDrawable).color
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
override fun excludedViews() = listOf(ReactTextView::class.java)
|
|
21
19
|
|
|
22
20
|
override fun create(options: SharedElementTransitionOptions): Animator {
|
|
23
|
-
val backgroundColorEvaluator = BackgroundColorEvaluator(to.background as
|
|
21
|
+
val backgroundColorEvaluator = BackgroundColorEvaluator(to.background as ReactViewBackgroundDrawable)
|
|
24
22
|
val fromColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(from))
|
|
25
23
|
val toColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(to))
|
|
26
24
|
|
|
@@ -2,13 +2,11 @@ package com.reactnativenavigation.views.element.animators
|
|
|
2
2
|
|
|
3
3
|
import android.animation.TypeEvaluator
|
|
4
4
|
import androidx.core.graphics.ColorUtils
|
|
5
|
-
import com.facebook.react.
|
|
6
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
5
|
+
import com.facebook.react.views.view.ReactViewBackgroundDrawable
|
|
7
6
|
|
|
8
|
-
class BackgroundColorEvaluator
|
|
7
|
+
class BackgroundColorEvaluator(private val background: ReactViewBackgroundDrawable) : TypeEvaluator<DoubleArray> {
|
|
9
8
|
private val color = DoubleArray(3)
|
|
10
9
|
|
|
11
|
-
@OptIn(UnstableReactNativeAPI::class)
|
|
12
10
|
override fun evaluate(ratio: Float, from: DoubleArray, to: DoubleArray): DoubleArray {
|
|
13
11
|
ColorUtils.blendLAB(from, to, ratio.toDouble(), color)
|
|
14
12
|
background.color = com.reactnativenavigation.utils.ColorUtils.labToColor(color)
|
|
@@ -49,17 +49,17 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
|
49
49
|
updateFirstChildView()
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent) {
|
|
52
|
+
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent?) {
|
|
53
53
|
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
54
54
|
}
|
|
55
|
-
override fun onChildStartedNativeGesture(androidEvent: MotionEvent) {
|
|
55
|
+
override fun onChildStartedNativeGesture(androidEvent: MotionEvent?) {
|
|
56
56
|
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
57
57
|
}
|
|
58
|
-
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent) {
|
|
58
|
+
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent?) {
|
|
59
59
|
mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
60
60
|
}
|
|
61
61
|
override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}
|
|
62
|
-
private fun getEventDispatcher(): EventDispatcher {
|
|
62
|
+
private fun getEventDispatcher(): EventDispatcher? {
|
|
63
63
|
val reactContext: ReactContext = this.getReactContext()
|
|
64
64
|
return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
|
|
65
65
|
}
|
|
@@ -73,12 +73,12 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
|
73
73
|
return this.context as ReactContext
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
|
|
76
|
+
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {
|
|
77
77
|
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
78
78
|
return super.onInterceptTouchEvent(event)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
override fun onTouchEvent(event: MotionEvent): Boolean {
|
|
81
|
+
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
|
82
82
|
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
83
83
|
super.onTouchEvent(event)
|
|
84
84
|
return true
|
|
@@ -4,11 +4,13 @@ interface ApplicationProps {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const Application: {
|
|
6
6
|
new (props: ApplicationProps): {
|
|
7
|
-
render():
|
|
8
|
-
context:
|
|
7
|
+
render(): JSX.Element;
|
|
8
|
+
context: any;
|
|
9
9
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ApplicationProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
10
10
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
11
|
-
readonly props: Readonly<ApplicationProps
|
|
11
|
+
readonly props: Readonly<ApplicationProps> & Readonly<{
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
}>;
|
|
12
14
|
state: Readonly<{}>;
|
|
13
15
|
refs: {
|
|
14
16
|
[key: string]: React.ReactInstance;
|
|
@@ -26,6 +28,6 @@ export declare const Application: {
|
|
|
26
28
|
componentWillUpdate?(nextProps: Readonly<ApplicationProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
27
29
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ApplicationProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
28
30
|
};
|
|
29
|
-
contextType?: React.Context<any
|
|
31
|
+
contextType?: React.Context<any>;
|
|
30
32
|
};
|
|
31
33
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentProps } from '../ComponentProps';
|
|
3
3
|
export declare const BottomTabs: {
|
|
4
|
-
new (props: ComponentProps): {
|
|
5
|
-
render():
|
|
6
|
-
context:
|
|
4
|
+
new (props: Readonly<ComponentProps>): {
|
|
5
|
+
render(): JSX.Element[];
|
|
6
|
+
context: any;
|
|
7
7
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
8
8
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
9
|
-
readonly props: Readonly<ComponentProps
|
|
9
|
+
readonly props: Readonly<ComponentProps> & Readonly<{
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}>;
|
|
10
12
|
state: Readonly<{}>;
|
|
11
13
|
refs: {
|
|
12
14
|
[key: string]: React.ReactInstance;
|
|
@@ -24,12 +26,14 @@ export declare const BottomTabs: {
|
|
|
24
26
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
25
27
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
26
28
|
};
|
|
27
|
-
new (props: ComponentProps, context
|
|
28
|
-
render():
|
|
29
|
-
context:
|
|
29
|
+
new (props: ComponentProps, context?: any): {
|
|
30
|
+
render(): JSX.Element[];
|
|
31
|
+
context: any;
|
|
30
32
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
31
33
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
32
|
-
readonly props: Readonly<ComponentProps
|
|
34
|
+
readonly props: Readonly<ComponentProps> & Readonly<{
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}>;
|
|
33
37
|
state: Readonly<{}>;
|
|
34
38
|
refs: {
|
|
35
39
|
[key: string]: React.ReactInstance;
|
|
@@ -47,5 +51,5 @@ export declare const BottomTabs: {
|
|
|
47
51
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
48
52
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
49
53
|
};
|
|
50
|
-
contextType?: React.Context<any
|
|
54
|
+
contextType?: React.Context<any>;
|
|
51
55
|
};
|