Commit 7f4ccae
iOS: add BrowserComponent.interfaceStyle property to pin web-view appearance (#5203)
WKWebView feeds the device's light/dark trait into the page's
prefers-color-scheme media query and the UA rendering of default
backgrounds and form controls. Since #4786 enabled the UIScene lifecycle
by default, the window is created programmatically and the
UIUserInterfaceStyle Info.plist key is no longer reliably applied to it,
so embedded web views started following the device dark mode with no way
to override it per component.
Add a BrowserComponent.BROWSER_PROPERTY_INTERFACE_STYLE property
("light"/"dark"/"auto") routed through setBrowserProperty to the native
widget, where it sets the web view's overrideUserInterfaceStyle. This is
the natural per-component vertical rather than an app-wide window hack.
overrideUserInterfaceStyle is a UIView property so the single cast covers
both WKWebView and the legacy UIWebView. Other platforms ignore the
unknown property as usual.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 89bb334 commit 7f4ccae
4 files changed
Lines changed: 46 additions & 0 deletions
File tree
- CodenameOne/src/com/codename1/ui
- Ports/iOSPort
- nativeSources
- src/com/codename1/impl/ios
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3079 | 3079 | | |
3080 | 3080 | | |
3081 | 3081 | | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
3082 | 3105 | | |
3083 | 3106 | | |
3084 | 3107 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7928 | 7928 | | |
7929 | 7929 | | |
7930 | 7930 | | |
| 7931 | + | |
| 7932 | + | |
| 7933 | + | |
| 7934 | + | |
| 7935 | + | |
| 7936 | + | |
| 7937 | + | |
| 7938 | + | |
| 7939 | + | |
| 7940 | + | |
| 7941 | + | |
| 7942 | + | |
| 7943 | + | |
7931 | 7944 | | |
7932 | 7945 | | |
7933 | 7946 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
| |||
0 commit comments