facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.11k stars 24.32k forks source link

Modal is getting truncated when rendering at bottom on Android 15 #45490

Closed ManiTWIndia closed 1 week ago

ManiTWIndia commented 3 months ago

Description

When we use the React Native Modal and try to render the Modal content at the bottom, upto Android 14 new architecture it is working fine. But in Android 15 new architecture, the Modal rendered at the bottom is not entirely visible and we are only able to see a small section of the Modal rendered.

Please find the video attached below where the issue is happening on Android 15 new architecture

https://github.com/user-attachments/assets/32525bd9-2837-4ab3-9326-f878170b979b

Please find the video attached below with expected behaviour on Android 14 new architecture

https://github.com/user-attachments/assets/a4d0306c-fa30-4a1d-afb0-5093215681c7

Note: We have tested this issue on Pixel 7 Pro and Pixel 8 Pro (Emulator)

Steps to reproduce

  1. Run an android simulator with Android 15 version.
  2. After cloning, Run npm install and npx react-native run-android to run the project.

React Native Version

0.74.3

Affected Platforms

Runtime - Android

Areas

Other (please specify)

Output of npx react-native info

System:
  OS: macOS 14.0
  CPU: (10) arm64 Apple M1 Pro
  Memory: 77.34 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.4.1
    path: /opt/homebrew/bin/node
  Yarn: Not Found
  npm:
    version: 10.8.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.07.08.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.3
    wanted: 0.74.3
  react-native-macos: Not Found
npmGlobalPackages:
  "react-native": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

NA

Reproducer

https://github.com/ManiTWIndia/ReactNativeModalIssue

Screenshots and Videos

https://github.com/user-attachments/assets/b9e758e6-3895-4d12-9b1e-042caac15c20

Abdelaty-magdy commented 3 months ago

Any updates here?

cortinico commented 3 months ago

Any updates here?

Why are you asking? Are you having the same issue or would you like to take this one to fix it?

Abdelaty-magdy commented 3 months ago

Any updates here?

Why are you asking? Are you having the same issue or would you like to take this one to fix it?

Yes I'm having the same issue

alanleedev commented 3 months ago

@Abdelaty-magdy @ManiTWIndia I'll be looking into this issues and any general issues that may come up related to Android 15. Will post an update when I have identified the issue and have a proposed fix

Abdelaty-magdy commented 2 months ago

@Abdelaty-magdy @ManiTWIndia I'll be looking into this issues and any general issues that may come up related to Android 15. Will post an update when I have identified the issue and have a proposed fix

@alanleedev I did some investigation and I think the root cause is forcing the app to have edge-to-edge feature in Android 15.

alanleedev commented 2 months ago

@alanleedev I did some investigation and I think the root cause is forcing the app to have edge-to-edge feature in Android 15.

@Abdelaty-magdy Do you have more details around what you found? My investigation lead me to believe it was an issue with ModalHostHelper.getModalHostSize(). Specifically, display.getCurrentSizeRange(MIN_POINT, MAX_POINT) seems to have different results in Android 15 and the return value from the function is incorrect. I also see some existing issues with the Modal. I don't have a solution for this issue yet.

ieatfood commented 2 weeks ago

We are also affected by this issue. Are there any updates, since Android 15 was just released?

alanleedev commented 2 weeks ago

We are also affected by this issue. Are there any updates, since Android 15 was just released?

@ieatfood There was a fix for this and will be included in the upcoming 0.76 release. Could you try to test with the latest RC to see if the problem was resolved?

alanleedev commented 2 weeks ago

The fix was merged here: https://github.com/facebook/react-native/pull/46359

alanleedev commented 2 weeks ago

@ManiTWIndia could you also check with latest 0.76 RC?

ManiTWIndia commented 1 week ago

@alanleedev I am not facing the Modal truncation issue on React native version 0.76 with new architecture. Thanks.

alanleedev commented 1 week ago

@ManiTWIndia Thanks for verifying. Closing the issue.

ManiTWIndia commented 1 week ago

@alanleedev Can we backport this fix for lower versions? We are using React native 0.74.3 and we cant upgrade to the latest version for now

alanleedev commented 1 week ago

@alanleedev Can we backport this fix for lower versions? We are using React native 0.74.3 and we cant upgrade to the latest version for now

@cortinico @cipolleschi Is this something we can do?

cortinico commented 1 week ago

We are using React native 0.74.3 and we cant upgrade to the latest version for now

@ManiTWIndia why not? This change is included in 0.76.0

amirbhz86 commented 4 days ago

How do you test on Android 15 when React Native still doesn’t support 16 KB page sizes? @ManiTWIndia

cortinico commented 3 days ago

How do you test on Android 15 when React Native still doesn’t support 16 KB page sizes? @ManiTWIndia

How is this related to 16K support