react-native-screens 4.10.0-beta.0 → 4.10.0-beta.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.
|
@@ -85,10 +85,7 @@ class ScreenStackFragment :
|
|
|
85
85
|
return container
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
private
|
|
89
|
-
lazy(LazyThreadSafetyMode.NONE) {
|
|
90
|
-
DimmingViewManager(screen.reactContext, screen)
|
|
91
|
-
}
|
|
88
|
+
private var dimmingDelegate: DimmingViewManager? = null
|
|
92
89
|
|
|
93
90
|
private var sheetDelegate: SheetDelegate? = null
|
|
94
91
|
|
|
@@ -299,8 +296,9 @@ class ScreenStackFragment :
|
|
|
299
296
|
sheetDelegate = SheetDelegate(screen)
|
|
300
297
|
|
|
301
298
|
assert(view == coordinatorLayout)
|
|
302
|
-
dimmingDelegate
|
|
303
|
-
dimmingDelegate.
|
|
299
|
+
val dimmingDelegate = requireDimmingDelegate(forceCreation = true)
|
|
300
|
+
dimmingDelegate.onViewHierarchyCreated(screen, coordinatorLayout)
|
|
301
|
+
dimmingDelegate.onBehaviourAttached(screen, screen.sheetBehavior!!)
|
|
304
302
|
|
|
305
303
|
val container = screen.container!!
|
|
306
304
|
coordinatorLayout.measure(
|
|
@@ -330,7 +328,7 @@ class ScreenStackFragment :
|
|
|
330
328
|
}
|
|
331
329
|
|
|
332
330
|
val animatorSet = AnimatorSet()
|
|
333
|
-
val dimmingDelegate =
|
|
331
|
+
val dimmingDelegate = requireDimmingDelegate()
|
|
334
332
|
|
|
335
333
|
if (enter) {
|
|
336
334
|
val alphaAnimator =
|
|
@@ -718,6 +716,14 @@ class ScreenStackFragment :
|
|
|
718
716
|
screenStack.dismiss(this)
|
|
719
717
|
}
|
|
720
718
|
|
|
719
|
+
private fun requireDimmingDelegate(forceCreation: Boolean = false): DimmingViewManager {
|
|
720
|
+
if (dimmingDelegate == null || forceCreation) {
|
|
721
|
+
dimmingDelegate?.invalidate(screen.sheetBehavior)
|
|
722
|
+
dimmingDelegate = DimmingViewManager(screen.reactContext, screen)
|
|
723
|
+
}
|
|
724
|
+
return dimmingDelegate!!
|
|
725
|
+
}
|
|
726
|
+
|
|
721
727
|
private class ScreensCoordinatorLayout(
|
|
722
728
|
context: Context,
|
|
723
729
|
private val fragment: ScreenStackFragment,
|
|
@@ -42,7 +42,7 @@ class DimmingViewManager(
|
|
|
42
42
|
screen: Screen,
|
|
43
43
|
behavior: BottomSheetBehavior<Screen>,
|
|
44
44
|
) {
|
|
45
|
-
behavior.addBottomSheetCallback(requireBottomSheetCallback(screen))
|
|
45
|
+
behavior.addBottomSheetCallback(requireBottomSheetCallback(screen, forceCreation = true))
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -50,6 +50,10 @@ class DimmingViewManager(
|
|
|
50
50
|
*/
|
|
51
51
|
fun willDimForDetentIndex(screen: Screen, index: Int) = index > screen.sheetLargestUndimmedDetentIndex
|
|
52
52
|
|
|
53
|
+
fun invalidate(behavior: BottomSheetBehavior<Screen>?) {
|
|
54
|
+
dimmingViewCallback?.let { callback -> behavior?.removeBottomSheetCallback(callback) }
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
/**
|
|
54
58
|
* This bottom sheet callback is responsible for animating alpha of the dimming view.
|
|
55
59
|
*/
|
|
@@ -161,8 +165,8 @@ class DimmingViewManager(
|
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
|
|
164
|
-
private fun requireBottomSheetCallback(screen: Screen): BottomSheetCallback {
|
|
165
|
-
if (dimmingViewCallback == null) {
|
|
168
|
+
private fun requireBottomSheetCallback(screen: Screen, forceCreation: Boolean = false): BottomSheetCallback {
|
|
169
|
+
if (dimmingViewCallback == null || forceCreation) {
|
|
166
170
|
dimmingViewCallback = AnimateDimmingViewCallback(screen, dimmingView, maxAlpha)
|
|
167
171
|
}
|
|
168
172
|
return dimmingViewCallback!!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "4.10.0-beta.
|
|
3
|
+
"version": "4.10.0-beta.1",
|
|
4
4
|
"description": "Native navigation primitives for your React Native app.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn && yarn build && cd ../)",
|