[Android] ScreenFragment wraps content in FrameLayout (clipChildren=true), unlike ScreenStackFragment which uses CoordinatorLayout (clipChildren=false)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in android/src/main/java/com/swmansion/rnscreens/ScreenFragment.kt at the ScreensFrameLayout inner class, then compare its container behavior with ScreensCoordinatorLayout.kt. Verify the Android reproduction with matching tab and stack screens, and confirm that child shadows and other overflow render without clipping after the container behavior is aligned.
Written by the indexing model from the issue text.
Description
Description
[!NOTE]
This issue was drafted by Claude Code under my supervision.
On Android, screens rendered via ScreenFragment (used by tab and drawer navigators) clip child overflow, including box-shadow and elevation shadows, while screens rendered via ScreenStackFragment (native stack) do not. Identical React Native markup produces different visual results depending on the navigator type.
This is the root cause behind #2669 and #2478. The suggested workaround of wrapping content in <View collapsable={false} style={{ flex: 1 }}> works but shouldn't be necessary.
Root Cause
ScreenFragment and ScreenStackFragment wrap screen content in different native Android containers with different clipChildren defaults:
| Fragment | Wrapper | Extends | clipChildren default |
|---|---|---|---|
ScreenFragment |
ScreensFrameLayout |
FrameLayout |
true |
ScreenStackFragment |
ScreensCoordinatorLayout |
CoordinatorLayout |
false |
FrameLayout defaults to clipChildren = true, clipping any child content that overflows its bounds. CoordinatorLayout defaults to clipChildren = false (by design, to support FABs, snackbars, etc.), so stack screens don't have this issue.
Relevant code
ScreenFragment.kt—ScreensFrameLayoutinner
class (extendsFrameLayout, no
clipChildrenoverride)- [
ScreensCoordinatorLayout.kt](https://github.com/software-mansion/react-native-screens/blob/main/android/src/main/java/com/swmansion/rnscreens/stack/views/ScreensCoordinato
rLayout.kt) (extendsCoordinatorLayout, inheritsclipChildren = false)
Reproduction
- Create a tab navigator with a screen containing an absolutely positioned circular button with
box-shadow(e.g. near the top of the screen) - Create a stack navigator with identical screen content
- Compare on Android — the tab screen clips the shadow to a rectangle, the stack screen renders it correctly as a circle following
borderRadius
Suggested Fix
Set clipChildren = false on ScreensFrameLayout to match the CoordinatorLayout behavior:
private class ScreensFrameLayout(context: Context) : FrameLayout(context) {
init {
clipChildren = false
}
override fun clearFocus() {
if (visibility != INVISIBLE) {
super.clearFocus()
}
}
}
Environment
- react-native-screens: 4.16.0 (also confirmed still present on main)
- React Native: 0.81.5 (new architecture / Fabric)
- Android
- Expo SDK 54
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 714
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 62
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from software-mansion/react-native-screens
-
cr:missing-repro cr:platform:android platform:android repro-provided
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
software-mansion/react-native-screens#4699 · 1 comment ·
-
missing-repro platform:ios
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
software-mansion/react-native-screens#4168 · 10 comments · 2 reactions ·
-
cr:missing-repro cr:platform:ios missing-repro platform:ios
software-mansion/react-native-screens#4671 · 3 comments · 1 assignee ·
-
cr:missing-info cr:missing-repro cr:platform:android missing-info missing-repro platform:android
software-mansion/react-native-screens#4664 · 3 comments · 1 assignee ·
-
area:stack-v4 area:stack-v5 area:tabs cr:platform:android cr:repro-provided platform:android repro-provided
Difficulty 4/5 3-5 days Newbie friendliness 48/100
software-mansion/react-native-screens#4612 · 3 comments ·
All issues in software-mansion/react-native-screens
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100