Modal/Bottomsheet UI Glitches In New Architecture
Introduction
In this article, we will discuss a common issue encountered when using the new architecture in React Native, specifically with regards to modal and bottomsheet UI glitches. These glitches can cause the content to appear on the top left of the UI, resulting in an inconsistent user experience. We will explore the steps to reproduce this issue, the affected platforms, and the output of the npx @react-native-community/cli info
command.
Description of the Issue
When opening a modal from the default React Native or any overlay component, a glitch in the UI is observed. The content of the modal appears on the top left of the UI, rather than being centered as intended. This issue is particularly noticeable and can be frustrating for users.
Steps to Reproduce the Issue
To reproduce this issue, follow these steps:
- Install the new application with React Native version 0.79.1: Ensure that you have the latest version of React Native installed on your system.
- Create a modal with some content and center the modal with some styling: Use a library like
react-native-modal
orreact-native-bottom-sheet
to create a modal with some content. Apply styling to center the modal on the screen. - Open the modal using any state: Trigger the modal to open using any state or event. Observe the glitch in the UI.
Affected Platforms
The issue is observed on the following platforms:
- Runtime - Android: The issue is specific to the Android runtime environment.
Output of npx @react-native-community/cli info
The output of the npx @react-native-community/cli info
command is as follows:
warn Package rn-fetch-blob contains invalid configuration: "dependency.hooks" is not allowed. Please verify it's properly linked using "npx react-native config" command and contact the package maintainers about this.
info Fetching system and libraries information...
System:
OS: Windows 11 10.0.26100
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1155G7 @ 2.50GHz
Memory: 1.65 GB / 11.65 GB
Binaries:
Node:
version: 22.11.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 10.9.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "33"
- "34"
- "35"
Build Tools:
- 30.0.3
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
System Images:
- android-31 | Google Play Intel x86_64 Atom
- android-33 | Google Play Intel x86_64 Atom
- android-35 | Google APIs Intel x86_64 Atom
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-241.18034.62.2411.12169540
Visual Studio: Not Found
Languages:
Java: 17.0.13
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: 18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.1
wanted: 0.79.1
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
info React Native v0.79.2 is now available (your project is running on v0.79.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.79.1&to=0.79.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".
Stacktrace or Logs
The stacktrace or logs are as follows:
no crashes
Mandatory Reproducer
No mandatory reproducer is required to reproduce this issue.
Screenshots and Videos
A screenshot of the issue is provided below:
Conclusion
Introduction
In our previous article, we discussed a common issue encountered when using the new architecture in React Native, specifically with regards to modal and bottomsheet UI glitches. These glitches can cause the content to appear on the top left of the UI, resulting in an inconsistent user experience. In this article, we will provide a Q&A section to help developers better understand and address this issue.
Q: What is the cause of the modal and bottomsheet UI glitches in the new architecture?
A: The cause of the modal and bottomsheet UI glitches in the new architecture is due to the changes in the way React Native handles overlays and modals. In the new architecture, React Native uses a different approach to handle overlays and modals, which can lead to glitches and inconsistencies in the UI.
Q: Which platforms are affected by this issue?
A: The issue is specific to the Android runtime environment. However, it's possible that the issue may also affect other platforms, such as iOS.
Q: How can I reproduce the issue?
A: To reproduce the issue, follow these steps:
- Install the new application with React Native version 0.79.1.
- Create a modal with some content and center the modal with some styling.
- Open the modal using any state or event.
Q: What are the symptoms of the issue?
A: The symptoms of the issue include:
- The content of the modal appears on the top left of the UI.
- The modal is not centered as intended.
- The UI is inconsistent and may appear glitchy.
Q: How can I fix the issue?
A: To fix the issue, you can try the following:
- Update to the latest version of React Native.
- Use a different library or component to create the modal or bottomsheet.
- Apply styling to the modal or bottomsheet to ensure it is centered and consistent with the rest of the UI.
Q: Are there any known workarounds for this issue?
A: Yes, there are several known workarounds for this issue. Some of these workarounds include:
- Using a different library or component to create the modal or bottomsheet.
- Applying styling to the modal or bottomsheet to ensure it is centered and consistent with the rest of the UI.
- Using a custom solution to create the modal or bottomsheet.
Q: Can I report this issue to the React Native team?
A: Yes, you can report this issue to the React Native team. You can file a bug report on the React Native GitHub page or reach out to the React Native community for help.
Q: Are there any resources available to help me fix this issue?
A: Yes, there are several resources available to help you fix this issue. Some of these resources include:
- The React Native documentation.
- The React Native GitHub page.
- The React Native community forums.
- Online tutorials and courses on React Native development.
Conclusion
In conclusion, the modal and bottomsheet UI glitches in the new architecture of React Native can the content to appear on the top left of the UI, resulting in an inconsistent user experience. By following the steps to reproduce the issue, affected platforms, and output of the npx @react-native-community/cli info
command, developers can identify and fix this issue in their applications. Additionally, the Q&A section in this article provides valuable information and resources to help developers better understand and address this issue.