mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31:35 +00:00
Add webview background defaults to device color mode
This commit is contained in:
parent
3e2b48862f
commit
6ecf6b105d
@ -12,13 +12,13 @@ const backgroundColors = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const colorScheme = Appearance.getColorScheme();
|
const colorScheme = Appearance.getColorScheme() ?? 'light';
|
||||||
const torClient = new TorClient();
|
const torClient = new TorClient();
|
||||||
const webViewRef = useRef<WebView>();
|
const webViewRef = useRef<WebView>();
|
||||||
const uri = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
|
const uri = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
|
||||||
|
|
||||||
const injectMessageResolve = (id: string, data?: object) => {
|
const injectMessageResolve = (id: string, data?: object) => {
|
||||||
const json = JSON.stringify((data != null) || {});
|
const json = JSON.stringify(data != null || {});
|
||||||
webViewRef.current?.injectJavaScript(
|
webViewRef.current?.injectJavaScript(
|
||||||
`(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`,
|
`(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`,
|
||||||
);
|
);
|
||||||
@ -145,6 +145,7 @@ const App = () => {
|
|||||||
}}
|
}}
|
||||||
onMessage={onMessage}
|
onMessage={onMessage}
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
|
style={{ backgroundColor: backgroundColors[colorScheme] }}
|
||||||
ref={(ref) => (webViewRef.current = ref)}
|
ref={(ref) => (webViewRef.current = ref)}
|
||||||
overScrollMode='never'
|
overScrollMode='never'
|
||||||
javaScriptEnabled={true}
|
javaScriptEnabled={true}
|
||||||
|
Loading…
Reference in New Issue
Block a user