You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(iOS, Stack): Deduplicate contentStyle on Screen and ScreenContentWrapper (#3228)
## Description
This PR addresses an issue with the support for LiquidGlass FormSheets
on iOS, as detailed in this blog post
https://nilcoalescing.com/blog/LiquidGlassSheetsWithNavigationStackAndForm/.
Previously, the implementation of the `contentStyle` option led to the
background color overlapping. Specifically, with the low opacity styles
were duplicated for `Screen` and `ScreenContentWrapper`, which caused
visual issues in the content area.
To resolve this, I’ve separated the handling of `contentStyle`
properties on iOS, which requires applying background color at the level
of `Screen` component due to the safe area insets:
- The `backgroundColor` is now applied **only** at the RNSScreen level
to achieve the desired LiquidGlass translucent effect without
interfering with content rendering.
- The remaining `contentStyle` properties are applied under the
`ScreenContentWrapper`, which is semantically more appropriate.
This results in a more accurate and visually correct rendering of
translucent backgrounds on iOS FormSheets using LiquidGlass.
## Changes
- Separated `contentStyle` to props that should be applied on the
`Screen` and `ScreenContentWrapper` level.
## Screenshots / GIFs
Here you can add screenshots / GIFs documenting your change.
You can add before / after section if you're changing some behavior.
### Before
https://github.com/user-attachments/assets/7b65fa0f-e478-44d0-a6b6-eb8f60f8461a
### After
https://github.com/user-attachments/assets/c6ec1d34-1459-435b-ac16-886ef9d4a6c8
## Test code and steps to reproduce
Added a new example to `TestFormSheet`
## Checklist
- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes
I'm leaving some follow-up issues and ideas that came during the
implementation of this PR.
More important:
-
software-mansion/react-native-screens-labs#452
- it makes more sense to apply some other styles on the `Screen` level
due to the safe area on iOS - like borders or filters - we should
revisit it and define how the props should be split between `Screen` and
`ScreenContentWrapper`
-
software-mansion/react-native-screens-labs#441
- setting fixed size based on the maximum detent would have 2
significant benefits: we'd have the same model for both Android and iOS
and we'd resolve the problem of flickering content on resize without
synchronous updates - it has a potential, tested along with this PR, but
we're suffering from the lack of API on iOS 15 or lower - APIs for
resolving detens is available from iOS 16, what is currently a blocker
for us, because we cannot predict the target height for `large` detent,
using system detents
Less important:
-
software-mansion/react-native-screens-labs#457
- bug related to the safe area combined with maximum detent on android
-
software-mansion/react-native-screens-labs#458
- bug related to positioning the content with `flex-end` on android
0 commit comments