chore: ios window color [skip e2e]

This commit is contained in:
Aman Harwara
2023-11-06 14:38:05 +05:30
parent d55b2527d5
commit ade6c8bb1e

View File

@@ -356,45 +356,52 @@ const MobileWebAppContents = ({ destroyAndReload }: { destroyAndReload: () => vo
}
return (
<WebView
ref={webViewRef}
source={{ uri: sourceUri }}
<View
style={{
flex: 1,
backgroundColor: '#000000',
opacity: didLoadEnd ? 1 : 0,
}}
originWhitelist={['*']}
onError={(err) => console.error('An error has occurred', err)}
onHttpError={() => console.error('An HTTP error occurred')}
onMessage={onMessage}
onContentProcessDidTerminate={() => {
webViewRef.current?.reload()
}}
onRenderProcessGone={() => {
webViewRef.current?.reload()
}}
hideKeyboardAccessoryView={true}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
injectedJavaScriptBeforeContentLoaded={injectedJS}
bounces={false}
keyboardDisplayRequiresUserAction={false}
allowsInlineMediaPlayback={requireInlineMediaPlaybackForMomentsFeature}
mediaPlaybackRequiresUserAction={requireMediaUserInteractionForMomentsFeature}
scalesPageToFit={true}
/**
* This disables the global window scroll but keeps scroll within div elements like lists and textareas.
* This is needed to prevent the keyboard from pushing the webview up and down when it appears and disappears.
*/
scrollEnabled={false}
overScrollMode="never"
nativeConfig={Platform.select({
android: {
component: CustomAndroidWebView,
} as WebViewNativeConfig,
})}
webviewDebuggingEnabled
/>
>
<WebView
ref={webViewRef}
source={{ uri: sourceUri }}
style={{
backgroundColor: Platform.OS === 'ios' ? 'transparent' : '#000000',
opacity: didLoadEnd ? 1 : 0,
}}
originWhitelist={['*']}
onError={(err) => console.error('An error has occurred', err)}
onHttpError={() => console.error('An HTTP error occurred')}
onMessage={onMessage}
onContentProcessDidTerminate={() => {
webViewRef.current?.reload()
}}
onRenderProcessGone={() => {
webViewRef.current?.reload()
}}
hideKeyboardAccessoryView={true}
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
injectedJavaScriptBeforeContentLoaded={injectedJS}
bounces={false}
keyboardDisplayRequiresUserAction={false}
allowsInlineMediaPlayback={requireInlineMediaPlaybackForMomentsFeature}
mediaPlaybackRequiresUserAction={requireMediaUserInteractionForMomentsFeature}
scalesPageToFit={true}
/**
* This disables the global window scroll but keeps scroll within div elements like lists and textareas.
* This is needed to prevent the keyboard from pushing the webview up and down when it appears and disappears.
*/
scrollEnabled={false}
overScrollMode="never"
nativeConfig={Platform.select({
android: {
component: CustomAndroidWebView,
} as WebViewNativeConfig,
})}
webviewDebuggingEnabled
/>
</View>
)
}