Closed
Description
Before submitting a new issue
- I tested using the latest version of the library, as the bug might be already fixed.
- I tested using a supported version of react native.
- I checked for possible duplicate issues, with possible answers.
Bug summary
I'm a bit unsure if this should belong to here or Expo / RN CLI / RN.
Since this package (esp. the Expo plugin) applies Theme.xxx.DayNight.NoActionBar
themes, it breaks how native dialogs are rendered (e.g. in react-native-webview
where the default dialogs from system are shown when JS calls alert
) due to some default generated overrides (presumably for RN < 0.75?):
<style name="AppTheme" parent="Theme.EdgeToEdge.DayNight.NoActionBar">
<item name="android:textColor">@android:color/black</item>
<item name="android:editTextStyle">@style/ResetEditText</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:statusBarColor">#FFFBFF</item>
</style>
Issues (only in dark mode):
- when
editTextBackground
is set, native dialogs will be very dark - when
android:textColor
andcolorPrimary
are set buttons will never adopt for dark theme and become very hard to read
My current solution is to apply extra plugins to remove those keys, but maybe this should be something that is included in this package (since it's probably quite hard to figure out what's going on):
withAndroidStyles(config, (config) => {
config.modResults.resources.style = config.modResults.resources.style?.map(
(style): typeof style => {
if (style.$.name === "AppTheme") {
style.item = style.item.filter(
(i) =>
![
"android:editTextBackground",
"android:textColor",
"colorPrimary",
].includes(i.$.name),
);
}
return style;
},
);
return config;
});
Library version
1.1.3
Environment info
expo-env-info 1.2.1 environment info:
System:
OS: macOS 15.2
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.local/share/mise/installs/node/22.12.0/bin/node
Yarn: 1.22.22 - ~/.local/share/mise/installs/node/22.12.0/bin/yarn
npm: 11.0.0 - ~/.local/share/mise/installs/node/22.12.0/bin/npm
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 24.2, iOS 18.2, macOS 15.2, tvOS 18.2, visionOS 2.2, watchOS 11.2
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12700392
Xcode: 16.2/16C5032a - /usr/bin/xcodebuild
npmPackages:
expo: ~52.0.23 => 52.0.23
expo-router: ~4.0.15 => 4.0.15
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
react-native: 0.76.5 => 0.76.5
react-native-web: ~0.19.13 => 0.19.13
npmGlobalPackages:
eas-cli: 14.2.0
Expo Workflow: managed
Steps to reproduce
- Have an app that uses
react-native-edge-to-edge
and renders a WebView usingreact-native-webview
- Run the app on Android, ensure dark theme is enabled
- Trigger
alert("test")
in the WebView, and see how the dialogs look wonky
Reproducible sample code
Add the following view to an Expo app (code written using Expo Router here):
export default function Route() {
return (
<WebView source={{ uri: 'https://reactnative.dev/' }} style={{ flex: 1 }} />
);
}
Then, use `chrome://inspect` to go into WebView debugger. In the debugger, trigger `alert("test")`.
There are probably other ways to trigger native dialogs but this is the specific route I encountered the issue.