react-native-screens 3.34.0 → 3.35.0-rc.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/android/build.gradle +6 -34
- package/android/src/main/java/com/swmansion/rnscreens/Screen.kt +2 -0
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt +6 -9
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt +6 -1
- package/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfigViewManager.kt +7 -0
- package/android/src/main/java/com/swmansion/rnscreens/utils/ScreenDummyLayoutHelper.kt +45 -8
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerDelegate.java +3 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackHeaderConfigManagerInterface.java +1 -0
- package/ios/RNSConvert.h +2 -0
- package/ios/RNSConvert.mm +65 -0
- package/ios/RNSScreen.mm +13 -9
- package/ios/RNSScreenStackHeaderConfig.h +1 -1
- package/ios/RNSScreenStackHeaderConfig.mm +4 -4
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js.map +1 -1
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts +2 -0
- package/lib/typescript/fabric/ScreenStackHeaderConfigNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +23 -0
package/android/build.gradle
CHANGED
|
@@ -55,32 +55,6 @@ def safeAppExtGet(prop, fallback) {
|
|
|
55
55
|
appProject?.ext?.has(prop) ? appProject.ext.get(prop) : fallback
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
def resolveReactNativeDirectory() {
|
|
59
|
-
def reactNativeLocation = safeAppExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
|
|
60
|
-
if (reactNativeLocation != null) {
|
|
61
|
-
return file(reactNativeLocation)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
def reactNativeFromAppNodeModules = file("${projectDir}/../../react-native")
|
|
65
|
-
if (!isRunningInContextOfScreensRepo() && reactNativeFromAppNodeModules.exists()) {
|
|
66
|
-
return reactNativeFromAppNodeModules
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
|
|
70
|
-
if (reactNativeFromProjectNodeModules.exists()) {
|
|
71
|
-
return reactNativeFromProjectNodeModules
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
throw new GradleException(
|
|
75
|
-
"[RNScreens] Unable to resolve react-native location in node_modules. You should add project extension property (in `app/build.gradle`) `REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
80
|
-
def reactProperties = new Properties()
|
|
81
|
-
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
82
|
-
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
83
|
-
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
84
58
|
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
|
|
85
59
|
|
|
86
60
|
android {
|
|
@@ -118,14 +92,12 @@ android {
|
|
|
118
92
|
}
|
|
119
93
|
}
|
|
120
94
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
path "CMakeLists.txt"
|
|
128
|
-
}
|
|
95
|
+
buildFeatures {
|
|
96
|
+
prefab true
|
|
97
|
+
}
|
|
98
|
+
externalNativeBuild {
|
|
99
|
+
cmake {
|
|
100
|
+
path "CMakeLists.txt"
|
|
129
101
|
}
|
|
130
102
|
}
|
|
131
103
|
lintOptions {
|
|
@@ -127,6 +127,8 @@ class Screen(
|
|
|
127
127
|
)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
fun isTransparent(): Boolean = stackPresentation === StackPresentation.TRANSPARENT_MODAL
|
|
131
|
+
|
|
130
132
|
private fun hasWebView(viewGroup: ViewGroup): Boolean {
|
|
131
133
|
for (i in 0 until viewGroup.childCount) {
|
|
132
134
|
val child = viewGroup.getChildAt(i)
|
|
@@ -97,14 +97,14 @@ class ScreenStack(
|
|
|
97
97
|
var visibleBottom: ScreenFragmentWrapper? = null // this is only set if newTop has TRANSPARENT_MODAL presentation mode
|
|
98
98
|
isDetachingCurrentScreen = false // we reset it so the previous value is not used by mistake
|
|
99
99
|
for (i in screenWrappers.indices.reversed()) {
|
|
100
|
-
val
|
|
101
|
-
if (!dismissedWrappers.contains(
|
|
100
|
+
val screenWrapper = getScreenFragmentWrapperAt(i)
|
|
101
|
+
if (!dismissedWrappers.contains(screenWrapper)) {
|
|
102
102
|
if (newTop == null) {
|
|
103
|
-
newTop =
|
|
103
|
+
newTop = screenWrapper
|
|
104
104
|
} else {
|
|
105
|
-
visibleBottom =
|
|
105
|
+
visibleBottom = screenWrapper
|
|
106
106
|
}
|
|
107
|
-
if (!isTransparent(
|
|
107
|
+
if (!screenWrapper.screen.isTransparent()) {
|
|
108
108
|
break
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -258,7 +258,7 @@ class ScreenStack(
|
|
|
258
258
|
private fun turnOffA11yUnderTransparentScreen(visibleBottom: ScreenFragmentWrapper?) {
|
|
259
259
|
if (screenWrappers.size > 1 && visibleBottom != null) {
|
|
260
260
|
topScreenWrapper?.let {
|
|
261
|
-
if (isTransparent(
|
|
261
|
+
if (it.screen.isTransparent()) {
|
|
262
262
|
val screenFragmentsBeneathTop = screenWrappers.slice(0 until screenWrappers.size - 1).asReversed()
|
|
263
263
|
// go from the top of the stack excluding the top screen
|
|
264
264
|
for (fragmentWrapper in screenFragmentsBeneathTop) {
|
|
@@ -363,9 +363,6 @@ class ScreenStack(
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
companion object {
|
|
366
|
-
private fun isTransparent(fragmentWrapper: ScreenFragmentWrapper): Boolean =
|
|
367
|
-
fragmentWrapper.screen.stackPresentation === Screen.StackPresentation.TRANSPARENT_MODAL
|
|
368
|
-
|
|
369
366
|
private fun needsDrawReordering(fragmentWrapper: ScreenFragmentWrapper): Boolean =
|
|
370
367
|
// On Android sdk 33 and above the animation is different and requires draw reordering.
|
|
371
368
|
// For React Native 0.70 and lower versions, `Build.VERSION_CODES.TIRAMISU` is not defined yet.
|
|
@@ -154,7 +154,12 @@ class ScreenStackFragment :
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
override fun onPrepareOptionsMenu(menu: Menu) {
|
|
157
|
-
|
|
157
|
+
// If the screen is a transparent modal with hidden header we don't want to update the toolbar
|
|
158
|
+
// menu because it may erase the menu of the previous screen (which is still visible in these
|
|
159
|
+
// circumstances). See here: https://github.com/software-mansion/react-native-screens/issues/2271
|
|
160
|
+
if (!screen.isTransparent() || screen.headerConfig?.isHeaderHidden == false) {
|
|
161
|
+
updateToolbarMenu(menu)
|
|
162
|
+
}
|
|
158
163
|
return super.onPrepareOptionsMenu(menu)
|
|
159
164
|
}
|
|
160
165
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
package com.swmansion.rnscreens.utils
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
4
5
|
import android.util.Log
|
|
5
6
|
import android.view.View
|
|
6
7
|
import androidx.appcompat.widget.Toolbar
|
|
7
8
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
9
|
+
import com.facebook.jni.annotations.DoNotStrip
|
|
8
10
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
9
11
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
10
12
|
import com.facebook.react.uimanager.PixelUtil
|
|
@@ -18,6 +20,7 @@ import java.lang.ref.WeakReference
|
|
|
18
20
|
* See https://github.com/software-mansion/react-native-screens/pull/2169
|
|
19
21
|
* for more detailed description of the issue this code solves.
|
|
20
22
|
*/
|
|
23
|
+
@DoNotStrip
|
|
21
24
|
internal class ScreenDummyLayoutHelper(
|
|
22
25
|
reactContext: ReactApplicationContext,
|
|
23
26
|
) : LifecycleEventListener {
|
|
@@ -46,7 +49,7 @@ internal class ScreenDummyLayoutHelper(
|
|
|
46
49
|
try {
|
|
47
50
|
System.loadLibrary(LIBRARY_NAME)
|
|
48
51
|
} catch (e: UnsatisfiedLinkError) {
|
|
49
|
-
Log.w(TAG, "Failed to load $LIBRARY_NAME")
|
|
52
|
+
Log.w(TAG, "[RNScreens] Failed to load $LIBRARY_NAME library.")
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
weakInstance = WeakReference(this)
|
|
@@ -57,9 +60,13 @@ internal class ScreenDummyLayoutHelper(
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
63
|
+
* Tries to initialize dummy view hierarchy with CoordinatorLayout, AppBarLayout and dummy View.
|
|
61
64
|
* We utilize this to compute header height (app bar layout height) from C++ layer when its needed.
|
|
62
65
|
*
|
|
66
|
+
* This method might fail in case there is activity attached to the react context.
|
|
67
|
+
*
|
|
68
|
+
* This method is called from various threads!
|
|
69
|
+
*
|
|
63
70
|
* @return boolean whether the layout was initialised or not
|
|
64
71
|
*/
|
|
65
72
|
private fun maybeInitDummyLayoutWithHeader(reactContext: ReactApplicationContext): Boolean {
|
|
@@ -67,6 +74,7 @@ internal class ScreenDummyLayoutHelper(
|
|
|
67
74
|
return true
|
|
68
75
|
}
|
|
69
76
|
|
|
77
|
+
// Possible data race here - activity is injected into context on UI thread.
|
|
70
78
|
if (!reactContext.hasCurrentActivity()) {
|
|
71
79
|
return false
|
|
72
80
|
}
|
|
@@ -74,8 +82,25 @@ internal class ScreenDummyLayoutHelper(
|
|
|
74
82
|
// We need to use activity here, as react context does not have theme attributes required by
|
|
75
83
|
// AppBarLayout attached leading to crash.
|
|
76
84
|
val contextWithTheme =
|
|
77
|
-
requireNotNull(reactContext.currentActivity) { "[RNScreens] Attempt to use context detached from activity" }
|
|
85
|
+
requireNotNull(reactContext.currentActivity) { "[RNScreens] Attempt to use context detached from activity. This could happen only due to race-condition." }
|
|
86
|
+
|
|
87
|
+
synchronized(this) {
|
|
88
|
+
// The layout could have been initialised when this thread waited for access to critical section.
|
|
89
|
+
if (isLayoutInitialized) {
|
|
90
|
+
return true
|
|
91
|
+
}
|
|
92
|
+
initDummyLayoutWithHeader(contextWithTheme)
|
|
93
|
+
}
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
78
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Initialises the dummy layout. This method is **not** thread-safe.
|
|
99
|
+
*
|
|
100
|
+
* @param contextWithTheme this function expects the context to have theme attributes required
|
|
101
|
+
* to initialize the AppBarLayout.
|
|
102
|
+
*/
|
|
103
|
+
private fun initDummyLayoutWithHeader(contextWithTheme: Context) {
|
|
79
104
|
coordinatorLayout = CoordinatorLayout(contextWithTheme)
|
|
80
105
|
|
|
81
106
|
appBarLayout =
|
|
@@ -119,7 +144,6 @@ internal class ScreenDummyLayoutHelper(
|
|
|
119
144
|
}
|
|
120
145
|
|
|
121
146
|
isLayoutInitialized = true
|
|
122
|
-
return true
|
|
123
147
|
}
|
|
124
148
|
|
|
125
149
|
/**
|
|
@@ -129,6 +153,7 @@ internal class ScreenDummyLayoutHelper(
|
|
|
129
153
|
* @param fontSize font size value as passed from JS
|
|
130
154
|
* @return header height in dp as consumed by Yoga
|
|
131
155
|
*/
|
|
156
|
+
@DoNotStrip
|
|
132
157
|
private fun computeDummyLayout(
|
|
133
158
|
fontSize: Int,
|
|
134
159
|
isTitleEmpty: Boolean,
|
|
@@ -141,7 +166,7 @@ internal class ScreenDummyLayoutHelper(
|
|
|
141
166
|
// is still null at this execution point. We don't wanna crash in such case, thus returning zeroed height.
|
|
142
167
|
Log.e(
|
|
143
168
|
TAG,
|
|
144
|
-
"[RNScreens] Failed to late-init layout while computing header height. This is a race-condition-bug in react-native-screens, please file an issue at https://github.com/software-mansion/react-native-screens/issues"
|
|
169
|
+
"[RNScreens] Failed to late-init layout while computing header height. This is most likely a race-condition-bug in react-native-screens, please file an issue at https://github.com/software-mansion/react-native-screens/issues"
|
|
145
170
|
)
|
|
146
171
|
return 0.0f
|
|
147
172
|
}
|
|
@@ -210,22 +235,34 @@ internal class ScreenDummyLayoutHelper(
|
|
|
210
235
|
// dummy view hierarchy.
|
|
211
236
|
private var weakInstance = WeakReference<ScreenDummyLayoutHelper>(null)
|
|
212
237
|
|
|
238
|
+
@DoNotStrip
|
|
213
239
|
@JvmStatic
|
|
214
240
|
fun getInstance(): ScreenDummyLayoutHelper? = weakInstance.get()
|
|
215
241
|
}
|
|
216
242
|
|
|
243
|
+
// This value is fetched / stored from UI and background thread. Volatile here ensures
|
|
244
|
+
// that updates are visible to the other thread.
|
|
245
|
+
@Volatile
|
|
217
246
|
private var isLayoutInitialized = false
|
|
218
247
|
|
|
219
248
|
override fun onHostResume() {
|
|
220
249
|
// This is the earliest we have guarantee that the context has a reference to an activity.
|
|
221
250
|
val reactContext = requireReactContext { "[RNScreens] ReactContext missing in onHostResume! This should not happen." }
|
|
222
|
-
|
|
223
|
-
|
|
251
|
+
|
|
252
|
+
// There are some exotic edge cases where activity might not be present in context
|
|
253
|
+
// at this point, e.g. when reloading RN in development after an error was reported with redbox.
|
|
254
|
+
if (maybeInitDummyLayoutWithHeader(reactContext)) {
|
|
255
|
+
reactContext.removeLifecycleEventListener(this)
|
|
256
|
+
} else {
|
|
257
|
+
Log.w(TAG, "[RNScreens] Failed to initialise dummy layout in onHostResume.")
|
|
258
|
+
}
|
|
224
259
|
}
|
|
225
260
|
|
|
226
261
|
override fun onHostPause() = Unit
|
|
227
262
|
|
|
228
|
-
override fun onHostDestroy()
|
|
263
|
+
override fun onHostDestroy() {
|
|
264
|
+
reactContextRef.get()?.removeLifecycleEventListener(this)
|
|
265
|
+
}
|
|
229
266
|
}
|
|
230
267
|
|
|
231
268
|
private data class CacheKey(
|
|
@@ -100,6 +100,9 @@ public class RNSScreenStackHeaderConfigManagerDelegate<T extends View, U extends
|
|
|
100
100
|
case "backButtonInCustomView":
|
|
101
101
|
mViewManager.setBackButtonInCustomView(view, value == null ? false : (boolean) value);
|
|
102
102
|
break;
|
|
103
|
+
case "blurEffect":
|
|
104
|
+
mViewManager.setBlurEffect(view, (String) value);
|
|
105
|
+
break;
|
|
103
106
|
case "topInsetEnabled":
|
|
104
107
|
mViewManager.setTopInsetEnabled(view, value == null ? false : (boolean) value);
|
|
105
108
|
break;
|
|
@@ -39,5 +39,6 @@ public interface RNSScreenStackHeaderConfigManagerInterface<T extends View> {
|
|
|
39
39
|
void setBackButtonDisplayMode(T view, @Nullable String value);
|
|
40
40
|
void setHideBackButton(T view, boolean value);
|
|
41
41
|
void setBackButtonInCustomView(T view, boolean value);
|
|
42
|
+
void setBlurEffect(T view, @Nullable String value);
|
|
42
43
|
void setTopInsetEnabled(T view, boolean value);
|
|
43
44
|
}
|
package/ios/RNSConvert.h
CHANGED
|
@@ -40,6 +40,8 @@ namespace react = facebook::react;
|
|
|
40
40
|
|
|
41
41
|
+ (RNSSearchBarPlacement)RNSScreenSearchBarPlacementFromCppEquivalent:(react::RNSSearchBarPlacement)placement;
|
|
42
42
|
|
|
43
|
+
+ (UIBlurEffectStyle)UIBlurEffectStyleFromCppEquivalent:(react::RNSScreenStackHeaderConfigBlurEffect)blurEffect;
|
|
44
|
+
|
|
43
45
|
@end
|
|
44
46
|
|
|
45
47
|
#endif // RCT_NEW_ARCH_ENABLED
|
package/ios/RNSConvert.mm
CHANGED
|
@@ -177,6 +177,71 @@
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
+ (UIBlurEffectStyle)UIBlurEffectStyleFromCppEquivalent:(react::RNSScreenStackHeaderConfigBlurEffect)blurEffect
|
|
181
|
+
{
|
|
182
|
+
#if !TARGET_OS_TV && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
|
|
183
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
|
184
|
+
if (@available(iOS 13.0, *)) {
|
|
185
|
+
switch (blurEffect) {
|
|
186
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::ExtraLight:
|
|
187
|
+
return UIBlurEffectStyleExtraLight;
|
|
188
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Light:
|
|
189
|
+
return UIBlurEffectStyleLight;
|
|
190
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Dark:
|
|
191
|
+
return UIBlurEffectStyleDark;
|
|
192
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Regular:
|
|
193
|
+
return UIBlurEffectStyleRegular;
|
|
194
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Prominent:
|
|
195
|
+
return UIBlurEffectStyleProminent;
|
|
196
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemUltraThinMaterial:
|
|
197
|
+
return UIBlurEffectStyleSystemUltraThinMaterial;
|
|
198
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThinMaterial:
|
|
199
|
+
return UIBlurEffectStyleSystemThinMaterial;
|
|
200
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemMaterial:
|
|
201
|
+
return UIBlurEffectStyleSystemMaterial;
|
|
202
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThickMaterial:
|
|
203
|
+
return UIBlurEffectStyleSystemThickMaterial;
|
|
204
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemChromeMaterial:
|
|
205
|
+
return UIBlurEffectStyleSystemChromeMaterial;
|
|
206
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemUltraThinMaterialLight:
|
|
207
|
+
return UIBlurEffectStyleSystemUltraThinMaterialLight;
|
|
208
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThinMaterialLight:
|
|
209
|
+
return UIBlurEffectStyleSystemThinMaterialLight;
|
|
210
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemMaterialLight:
|
|
211
|
+
return UIBlurEffectStyleSystemMaterialLight;
|
|
212
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThickMaterialLight:
|
|
213
|
+
return UIBlurEffectStyleSystemThickMaterialLight;
|
|
214
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemChromeMaterialLight:
|
|
215
|
+
return UIBlurEffectStyleSystemChromeMaterialLight;
|
|
216
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemUltraThinMaterialDark:
|
|
217
|
+
return UIBlurEffectStyleSystemUltraThinMaterialDark;
|
|
218
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThinMaterialDark:
|
|
219
|
+
return UIBlurEffectStyleSystemThinMaterialDark;
|
|
220
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemMaterialDark:
|
|
221
|
+
return UIBlurEffectStyleSystemMaterialDark;
|
|
222
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemThickMaterialDark:
|
|
223
|
+
return UIBlurEffectStyleSystemThickMaterialDark;
|
|
224
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::SystemChromeMaterialDark:
|
|
225
|
+
return UIBlurEffectStyleSystemChromeMaterialDark;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
#endif
|
|
229
|
+
|
|
230
|
+
switch (blurEffect) {
|
|
231
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Light:
|
|
232
|
+
return UIBlurEffectStyleLight;
|
|
233
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Dark:
|
|
234
|
+
return UIBlurEffectStyleDark;
|
|
235
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Regular:
|
|
236
|
+
return UIBlurEffectStyleRegular;
|
|
237
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::Prominent:
|
|
238
|
+
return UIBlurEffectStyleProminent;
|
|
239
|
+
case react::RNSScreenStackHeaderConfigBlurEffect::ExtraLight:
|
|
240
|
+
default:
|
|
241
|
+
return UIBlurEffectStyleExtraLight;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
180
245
|
@end
|
|
181
246
|
|
|
182
247
|
#endif // RCT_NEW_ARCH_ENABLED
|
package/ios/RNSScreen.mm
CHANGED
|
@@ -514,14 +514,6 @@ namespace react = facebook::react;
|
|
|
514
514
|
#endif
|
|
515
515
|
}
|
|
516
516
|
|
|
517
|
-
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
|
|
518
|
-
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
|
519
|
-
- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)presentationController
|
|
520
|
-
{
|
|
521
|
-
[self notifyGestureCancel];
|
|
522
|
-
}
|
|
523
|
-
#endif
|
|
524
|
-
|
|
525
517
|
- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController
|
|
526
518
|
{
|
|
527
519
|
// We need to call both "cancel" and "reset" here because RN's gesture recognizer
|
|
@@ -546,12 +538,24 @@ namespace react = facebook::react;
|
|
|
546
538
|
- (BOOL)presentationControllerShouldDismiss:(UIPresentationController *)presentationController
|
|
547
539
|
{
|
|
548
540
|
if (_preventNativeDismiss) {
|
|
549
|
-
[self notifyDismissCancelledWithDismissCount:1];
|
|
550
541
|
return NO;
|
|
551
542
|
}
|
|
552
543
|
return _gestureEnabled;
|
|
553
544
|
}
|
|
554
545
|
|
|
546
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
|
|
547
|
+
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
|
548
|
+
- (void)presentationControllerDidAttemptToDismiss:(UIPresentationController *)presentationController
|
|
549
|
+
{
|
|
550
|
+
// NOTE(kkafar): We should consider depracating the use of gesture cancel here & align
|
|
551
|
+
// with usePreventRemove API of react-navigation v7.
|
|
552
|
+
[self notifyGestureCancel];
|
|
553
|
+
if (_preventNativeDismiss) {
|
|
554
|
+
[self notifyDismissCancelledWithDismissCount:1];
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
#endif
|
|
558
|
+
|
|
555
559
|
- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController
|
|
556
560
|
{
|
|
557
561
|
if ([_reactSuperview respondsToSelector:@selector(presentationControllerDidDismiss:)]) {
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
28
28
|
@property (nonatomic) BOOL show;
|
|
29
29
|
#else
|
|
30
|
-
@property (nonatomic) UIBlurEffectStyle blurEffect;
|
|
31
30
|
@property (nonatomic) BOOL hide;
|
|
32
31
|
#endif
|
|
33
32
|
|
|
@@ -56,6 +55,7 @@
|
|
|
56
55
|
@property (nonatomic) BOOL backButtonInCustomView;
|
|
57
56
|
@property (nonatomic) UISemanticContentAttribute direction;
|
|
58
57
|
@property (nonatomic) UINavigationItemBackButtonDisplayMode backButtonDisplayMode;
|
|
58
|
+
@property (nonatomic) UIBlurEffectStyle blurEffect;
|
|
59
59
|
|
|
60
60
|
+ (void)willShowViewController:(UIViewController *)vc
|
|
61
61
|
animated:(BOOL)animated
|
|
@@ -383,13 +383,9 @@ namespace react = facebook::react;
|
|
|
383
383
|
appearance.backgroundColor = config.backgroundColor;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
// TODO: implement blurEffect on Fabric
|
|
387
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
388
|
-
#else
|
|
389
386
|
if (config.blurEffect) {
|
|
390
387
|
appearance.backgroundEffect = [UIBlurEffect effectWithStyle:config.blurEffect];
|
|
391
388
|
}
|
|
392
|
-
#endif
|
|
393
389
|
|
|
394
390
|
if (config.hideShadow) {
|
|
395
391
|
appearance.shadowColor = nil;
|
|
@@ -904,6 +900,10 @@ static RCTResizeMode resizeModeFromCppEquiv(react::ImageResizeMode resizeMode)
|
|
|
904
900
|
_color = RCTUIColorFromSharedColor(newScreenProps.color);
|
|
905
901
|
_backgroundColor = RCTUIColorFromSharedColor(newScreenProps.backgroundColor);
|
|
906
902
|
|
|
903
|
+
if (newScreenProps.blurEffect != oldScreenProps.blurEffect) {
|
|
904
|
+
_blurEffect = [RNSConvert UIBlurEffectStyleFromCppEquivalent:newScreenProps.blurEffect];
|
|
905
|
+
}
|
|
906
|
+
|
|
907
907
|
[self updateViewControllerIfNeeded];
|
|
908
908
|
|
|
909
909
|
if (needsNavigationControllerLayout) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["fabric/ScreenStackHeaderConfigNativeComponent.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAU7F;AAEA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","obj","__esModule","default","_default","exports","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["fabric/ScreenStackHeaderConfigNativeComponent.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAU7F;AAEA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GA6De,IAAAG,+BAAsB,EACnC,4BAA4B,EAC5B,CAAC,CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../../src","sources":["fabric/ScreenStackHeaderConfigNativeComponent.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;;AAU5F;;AAEA;;
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent"],"sourceRoot":"../../../src","sources":["fabric/ScreenStackHeaderConfigNativeComponent.ts"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,yDAAyD;;AAU5F;;AAEA;;AA6DA,eAAeA,sBAAsB,CACnC,4BAA4B,EAC5B,CAAC,CACH,CAAC"}
|
|
@@ -5,6 +5,7 @@ type DirectionType = 'rtl' | 'ltr';
|
|
|
5
5
|
type OnAttachedEvent = Readonly<{}>;
|
|
6
6
|
type OnDetachedEvent = Readonly<{}>;
|
|
7
7
|
type BackButtonDisplayMode = 'minimal' | 'default' | 'generic';
|
|
8
|
+
type BlurEffect = 'extraLight' | 'light' | 'dark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
8
9
|
export interface NativeProps extends ViewProps {
|
|
9
10
|
onAttached?: DirectEventHandler<OnAttachedEvent>;
|
|
10
11
|
onDetached?: DirectEventHandler<OnDetachedEvent>;
|
|
@@ -34,6 +35,7 @@ export interface NativeProps extends ViewProps {
|
|
|
34
35
|
backButtonDisplayMode?: WithDefault<BackButtonDisplayMode, 'default'>;
|
|
35
36
|
hideBackButton?: boolean;
|
|
36
37
|
backButtonInCustomView?: boolean;
|
|
38
|
+
blurEffect?: WithDefault<BlurEffect, 'extraLight'>;
|
|
37
39
|
topInsetEnabled?: boolean;
|
|
38
40
|
}
|
|
39
41
|
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenStackHeaderConfigNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/fabric/ScreenStackHeaderConfigNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAGnC,KAAK,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,UAAU,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjD,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB,CAAC,EAAE,UAAU,CAAC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,WAAW,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IACtE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ScreenStackHeaderConfigNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/fabric/ScreenStackHeaderConfigNativeComponent.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,kBAAkB,EACnB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,aAAa,GAAG,KAAK,GAAG,KAAK,CAAC;AAGnC,KAAK,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEpC,KAAK,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/D,KAAK,UAAU,GACX,YAAY,GACZ,OAAO,GACP,MAAM,GACN,SAAS,GACT,WAAW,GACX,yBAAyB,GACzB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,sBAAsB,GACtB,8BAA8B,GAC9B,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,2BAA2B,GAC3B,6BAA6B,GAC7B,wBAAwB,GACxB,oBAAoB,GACpB,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,UAAU,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACjD,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,KAAK,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,SAAS,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yBAAyB,CAAC,EAAE,UAAU,CAAC;IACvC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,CAAC,EAAE,WAAW,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IACtE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAEnD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;;AAED,wBAGE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screens",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.0-rc.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)",
|
|
@@ -15,6 +15,28 @@ type OnDetachedEvent = Readonly<{}>;
|
|
|
15
15
|
|
|
16
16
|
type BackButtonDisplayMode = 'minimal' | 'default' | 'generic';
|
|
17
17
|
|
|
18
|
+
type BlurEffect =
|
|
19
|
+
| 'extraLight'
|
|
20
|
+
| 'light'
|
|
21
|
+
| 'dark'
|
|
22
|
+
| 'regular'
|
|
23
|
+
| 'prominent'
|
|
24
|
+
| 'systemUltraThinMaterial'
|
|
25
|
+
| 'systemThinMaterial'
|
|
26
|
+
| 'systemMaterial'
|
|
27
|
+
| 'systemThickMaterial'
|
|
28
|
+
| 'systemChromeMaterial'
|
|
29
|
+
| 'systemUltraThinMaterialLight'
|
|
30
|
+
| 'systemThinMaterialLight'
|
|
31
|
+
| 'systemMaterialLight'
|
|
32
|
+
| 'systemThickMaterialLight'
|
|
33
|
+
| 'systemChromeMaterialLight'
|
|
34
|
+
| 'systemUltraThinMaterialDark'
|
|
35
|
+
| 'systemThinMaterialDark'
|
|
36
|
+
| 'systemMaterialDark'
|
|
37
|
+
| 'systemThickMaterialDark'
|
|
38
|
+
| 'systemChromeMaterialDark';
|
|
39
|
+
|
|
18
40
|
export interface NativeProps extends ViewProps {
|
|
19
41
|
onAttached?: DirectEventHandler<OnAttachedEvent>;
|
|
20
42
|
onDetached?: DirectEventHandler<OnDetachedEvent>;
|
|
@@ -44,6 +66,7 @@ export interface NativeProps extends ViewProps {
|
|
|
44
66
|
backButtonDisplayMode?: WithDefault<BackButtonDisplayMode, 'default'>;
|
|
45
67
|
hideBackButton?: boolean;
|
|
46
68
|
backButtonInCustomView?: boolean;
|
|
69
|
+
blurEffect?: WithDefault<BlurEffect, 'extraLight'>;
|
|
47
70
|
// TODO: implement this props on iOS
|
|
48
71
|
topInsetEnabled?: boolean;
|
|
49
72
|
}
|