Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal Not Covering SafeAreaView and Status Bar on Android in React Native 0.77 #49256

Open
bharath-hba opened this issue Feb 7, 2025 · 3 comments
Labels
Component: Modal Needs: Attention Issues where the author has responded to feedback. Platform: Android Android applications.

Comments

@bharath-hba
Copy link

Description

In React Native 0.77, the Modal component behaves inconsistently across platforms. On iOS, the modal correctly covers the entire screen, including the SafeAreaView and StatusBar. However, on Android, the modal does not cover the StatusBar or respect the SafeAreaView, leaving gaps at the top of the screen.

Steps to reproduce

Create a Modal component with transparent={false}

Example Code

import React from 'react';
import { Modal, View, StyleSheet, Text } from 'react-native';

const TestModal = ({ visible }) => {
    return (
        <Modal
            visible={visible}
            transparent={false}
            animationType="slide"
            statusBarTranslucent={true}
        >
            <View style={styles.container}>
                <View style={styles.content}>
                    <Text>Modal Content</Text>
                </View>
            </View>
        </Modal>
    );
};

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: 'white',
    },
    content: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
    },
});

export default TestModal;

React Native Version

0.77.0

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 15.3
  CPU: (12) arm64 Apple M2 Max
  Memory: 101.53 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.4.0
    path: ~/.nvm/versions/node/v21.4.0/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v21.4.0/bin/npm
  Watchman:
    version: 2024.08.26.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "28"
      - "30"
      - "31"
      - "32"
      - "33"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-32 | Google APIs ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-TiramisuPrivacySandbox | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9619390
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.12
    path: /opt/homebrew/Cellar/openjdk@17/17.0.12/libexec/openjdk.jdk/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.0
    wanted: 0.77.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

WARN: View does not cover the SafeAreaView on Android

Reproducer

https://github.com/bharath-hba/react-native-model-0.77/tree/main/ReproducerApp

Screenshots and Videos

Image

@alanleedev
Copy link
Contributor

@bharath-hba I ran the ReproducerApp on few different emulator and devices but could not reproduce the issue.
Where was the screenshot captured from?

@shubhamguptadream11
Copy link
Collaborator

@bharath-hba I also tried the reproducer you shared, but I'm unable to reproduce the issue on my end. Could you share the device details?

@bharath-hba
Copy link
Author

I've updated my reproducer and I'm using status bar hidden, but I'm encountering an issue—could you please check it, @shubhamguptadream11 and @alanleedev?

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Modal Needs: Attention Issues where the author has responded to feedback. Platform: Android Android applications.
Projects
None yet
Development

No branches or pull requests

4 participants