Skip to content

Commit 623d565

Browse files
authored
chore: update docs for scrollEdgeEffects, blurEffect and scrollEdgeEffects interaction (#3407)
## Description Describes interaction between `blurEffect` and `scrollEdgeEffects`, adds possible values for `scrollEdgeEffects` to docs, adds `scrollEdgeEffects` to guide for library authors. Adds warning in JS when `blurEffect` and `scrollEdgeEffects` are used on iOS 26+. Part of software-mansion/react-native-screens-labs#551.
1 parent 253b826 commit 623d565

File tree

4 files changed

+73
-4
lines changed

4 files changed

+73
-4
lines changed

guides/GUIDE_FOR_LIBRARY_AUTHORS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,23 @@ Unfortunately the same behavior is not available on iOS since the behavior of na
104104

105105
Defaults to `false`.
106106

107+
### `scrollEdgeEffects` (>= iOS 26 only)
108+
109+
Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen).
110+
Depending on values set, it will blur the scrolling content below certain UI elements (e.g. header items, search bar) for the specified edge of the ScrollView.
111+
When set in nested containers, i.e. ScreenStack inside BottomTabs, or the other way around, the ScrollView will use only the innermost one's config.
112+
113+
Edge effects can be configured for each edge separately. The following values are currently supported:
114+
115+
- `automatic` - the automatic scroll edge effect style,
116+
- `hard` - a scroll edge effect with a hard cutoff and dividing line,
117+
- `soft` - a soft-edged scroll edge effect,
118+
- `hidden` - no scroll edge effect.
119+
120+
Defaults to `automatic` for each edge.
121+
122+
**Note:** Using both `blurEffect` and `scrollEdgeEffects` (>= iOS 26) simultaneously may cause overlapping effects.
123+
107124
### `navigationBarColor` (Android only)
108125

109126
This prop has been **deprecated** due to [edge-to-edge enforcement starting from Android SDK 35](https://developer.android.com/about/versions/15/behavior-changes-15#ux). Setting it has no effect as native code related to this prop has been removed. Kept only for backward compatibility. Will be removed in next major release.
@@ -541,6 +558,8 @@ When set to `false` it works as a "kill switch": it enforces `backButtonDisplayM
541558

542559
Blur effect to be applied to the header. Works with `backgroundColor`'s alpha < 1.
543560

561+
**Note:** Using both `blurEffect` and `scrollEdgeEffects` (>= iOS 26) simultaneously may cause overlapping effects.
562+
544563
### `children`
545564

546565
Pass `ScreenStackHeaderBackButtonImage`, `ScreenStackHeaderRightView`, `ScreenStackHeaderLeftView`, `ScreenStackHeaderCenterView`, `ScreenStackHeaderSearchBarView`.

src/components/ScreenStackItem.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,23 @@ function ScreenStackItem(
7676
headerHiddenPreviousRef.current = headerConfigHiddenWithDefault;
7777
}, [headerConfigHiddenWithDefault, stackPresentationWithDefault]);
7878

79+
const hasEdgeEffects =
80+
rest?.scrollEdgeEffects === undefined ||
81+
Object.values(rest.scrollEdgeEffects).some(
82+
propValue => propValue !== 'hidden',
83+
);
84+
const hasBlurEffect =
85+
headerConfig?.blurEffect !== undefined &&
86+
headerConfig.blurEffect !== 'none';
87+
88+
warnOnce(
89+
hasEdgeEffects &&
90+
hasBlurEffect &&
91+
Platform.OS === 'ios' &&
92+
parseInt(Platform.Version, 10) >= 26,
93+
'[RNScreens] Using both `blurEffect` and `scrollEdgeEffects` simultaneously may cause overlapping effects.',
94+
);
95+
7996
const debugContainerStyle = getPositioningStyle(
8097
sheetAllowedDetents,
8198
stackPresentationWithDefault,

src/components/bottom-tabs/BottomTabsScreen.types.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,26 @@ export interface BottomTabsScreenProps {
503503
overrideScrollViewContentInsetAdjustmentBehavior?: boolean;
504504
/**
505505
* Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen).
506-
* Depending on values set, it will blur the scrolling content below certain UI elements (Header Items, SearchBar)
507-
* for the specifed edge of the ScrollView.
506+
* Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar)
507+
* for the specified edge of the ScrollView.
508508
*
509509
* When set in nested containers, i.e. ScreenStack inside BottomTabs, or the other way around,
510510
* the ScrollView will use only the innermost one's config.
511511
*
512+
* Edge effects can be configured for each edge separately. The following values are currently supported:
513+
*
514+
* - `automatic` - the automatic scroll edge effect style,
515+
* - `hard` - a scroll edge effect with a hard cutoff and dividing line,
516+
* - `soft` - a soft-edged scroll edge effect,
517+
* - `hidden` - no scroll edge effect.
518+
*
519+
* The supported values correspond to the `UIScrollEdgeEffect`'s `style` and `isHidden` props
520+
* in the official UIKit documentation:
521+
*
522+
* @see {@link https://developer.apple.com/documentation/uikit/uiscrolledgeeffect|UIScrollEdgeEffect}
523+
*
524+
* @default `automatic` for each edge
525+
*
512526
* @platform ios
513527
*
514528
* @supported iOS 26 or higher

src/types.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,28 @@ export interface ScreenProps extends ViewProps {
235235
nativeBackButtonDismissalEnabled?: boolean;
236236
/**
237237
* Configures the scroll edge effect for the _content ScrollView_ (the ScrollView that is present in first descendants chain of the Screen).
238-
* Depending on values set, it will blur the scrolling content below certain UI elements (Header Items, SearchBar)
239-
* for the specifed edge of the ScrollView.
238+
* Depending on values set, it will blur the scrolling content below certain UI elements (header items, search bar)
239+
* for the specified edge of the ScrollView.
240240
*
241241
* When set in nested containers, i.e. ScreenStack inside BottomTabs, or the other way around,
242242
* the ScrollView will use only the innermost one's config.
243243
*
244+
* **Note:** Using both `blurEffect` and `scrollEdgeEffects` (>= iOS 26) simultaneously may cause overlapping effects.
245+
*
246+
* Edge effects can be configured for each edge separately. The following values are currently supported:
247+
*
248+
* - `automatic` - the automatic scroll edge effect style,
249+
* - `hard` - a scroll edge effect with a hard cutoff and dividing line,
250+
* - `soft` - a soft-edged scroll edge effect,
251+
* - `hidden` - no scroll edge effect.
252+
*
253+
* The supported values correspond to the `UIScrollEdgeEffect`'s `style` and `isHidden` props
254+
* in the official UIKit documentation:
255+
*
256+
* @see {@link https://developer.apple.com/documentation/uikit/uiscrolledgeeffect|UIScrollEdgeEffect}
257+
*
258+
* @default `automatic` for each edge
259+
*
244260
* @platform ios
245261
*
246262
* @supported iOS 26 or higher
@@ -627,6 +643,9 @@ export interface ScreenStackHeaderConfigProps extends ViewProps {
627643
backTitleVisible?: boolean;
628644
/**
629645
* Blur effect to be applied to the header. Works with backgroundColor's alpha < 1.
646+
*
647+
* **Note:** Using both `blurEffect` and `scrollEdgeEffects` (>= iOS 26) simultaneously may cause overlapping effects.
648+
*
630649
* @platform ios
631650
*/
632651
blurEffect?: BlurEffectTypes;

0 commit comments

Comments
 (0)