Skip to content

Commit

Permalink
[system-ui] fix RCTRootViewBackgroundColor setup from plugin (expo#25946
Browse files Browse the repository at this point in the history
)

# Why

expo-system-ui config plugin will setup `RCTRootViewBackgroundColor`
from app.json's `ios.backgroundColor` to info.plist. from expo#22773, we
break this and expo-system-ui will always use system default color as
the background color:
https://github.com/expo/expo/blob/e281adb30e978c382220686ffb0cb1b665f8d3c5/packages/expo-system-ui/ios/ExpoSystemUI/ExpoSystemUIModule.swift#L44-L60

# How

if the color is not persisted yet, we should respect the color from
`RCTRootViewBackgroundColor`
  • Loading branch information
Kudo committed Dec 15, 2023
1 parent 80b68a5 commit 947540d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/expo-system-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Fixed custom `backgroundColor` is broken on iOS. ([#25946](https://github.com/expo/expo/pull/25946) by [@kudo](https://github.com/kudo))

### 💡 Others

## 2.9.0 — 2023-12-12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ public class ExpoSystemUIModule: Module {
Name("ExpoSystemUI")

OnCreate {
// TODO: Maybe read from the app manifest instead of from Info.plist.
// Set / reset the initial color on reload and app start.
let color = UserDefaults.standard.integer(forKey: Self.colorKey)

if color > 0 {
Self.setBackgroundColorAsync(color: color)
} else {
Self.setBackgroundColorAsync(color: nil)
// TODO: Maybe read from the app manifest instead of from Info.plist.
// Set / reset the initial color on reload and app start.
let colorFromPlugin = Bundle.main.object(forInfoDictionaryKey: "RCTRootViewBackgroundColor") as? Int
Self.setBackgroundColorAsync(color: colorFromPlugin)
}
}

Expand Down

0 comments on commit 947540d

Please sign in to comment.