Skip to content

[Android] ScreenFragment wraps content in FrameLayout (clipChildren=true), unlike ScreenStackFragment which uses CoordinatorLayout (clipChildren=false) #3784

@dgrcode

Description

@dgrcode

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

Reproduction

  1. Create a tab navigator with a screen containing an absolutely positioned circular button with box-shadow (e.g. near the top of the screen)
  2. Create a stack navigator with identical screen content
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:stack-v4Issue related to Native Stack v4 implementationplatform:androidIssue related to Android part of the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions