Add webview background defaults to device color mode

This commit is contained in:
Reckless_Satoshi 2022-10-16 01:53:18 -07:00
parent 3e2b48862f
commit 6ecf6b105d
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -12,13 +12,13 @@ const backgroundColors = {
};
const App = () => {
const colorScheme = Appearance.getColorScheme();
const colorScheme = Appearance.getColorScheme() ?? 'light';
const torClient = new TorClient();
const webViewRef = useRef<WebView>();
const uri = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
const injectMessageResolve = (id: string, data?: object) => {
const json = JSON.stringify((data != null) || {});
const json = JSON.stringify(data != null || {});
webViewRef.current?.injectJavaScript(
`(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`,
);
@ -145,6 +145,7 @@ const App = () => {
}}
onMessage={onMessage}
// @ts-expect-error
style={{ backgroundColor: backgroundColors[colorScheme] }}
ref={(ref) => (webViewRef.current = ref)}
overScrollMode='never'
javaScriptEnabled={true}