expo-system-ui
Version:
Interact with system UI elements
15 lines (14 loc) • 437 B
text/typescript
export default {
getBackgroundColorAsync() {
if (typeof window === 'undefined') {
return null;
}
const normalizeColor = require('react-native-web/dist/cjs/modules/normalizeColor');
return normalizeColor(document.body.style.backgroundColor);
},
setBackgroundColorAsync(color: string | null) {
if (typeof window !== 'undefined') {
document.body.style.backgroundColor = color ?? 'white';
}
},
};