Performance issue with webview component with react native in iOS and Android

  android, ios, react-native

I have a performance issue when I run React Native’s WebView component, simply loading a page from this component takes about 11 seconds and from native code 2 seconds.
Please can someone help me, it is possible that the configuration of the component is not assigning it correctly.

This is a part of the code with the call to the component:

<Webview
                ref={webviewRef}
                style={{ backgroundColor: colors.WHITE }}
                sharedCookiesEnabled={true}
                startInLoadingState={true}
                bounces={false}
                renderLoading={loadingIndicator}
                showsHorizontalScrollIndicator={false}
                showsVerticalScrollIndicator={false}
                onError={console.error.bind(console, "error")}
                injectedJavaScriptBeforeContentLoaded={didomiJs}
                injectedJavaScript={webviewUtils.injectGetWeviewScrollTop()}
                javaScriptEnabled={true}
                domStorageEnabled={true}
                setSupportMultipleWindows={false}
                originWhitelist={configuration.PROTOCOLS.PROTOCOL_ACCEPTED_IN_WEBVIEWS}
                onMessage={(event) => {
                    onMessage({ event });
                }}
                source={{
                    uri: currentUrl
                }}
                onNavigationStateChange={(navState) => {
                    setCanGoBack(navState.canGoBack);
                }}
                onShouldStartLoadWithRequest={(request) => {
                    return requestOnStart({ request });
                }}
            />

Source: Android Questions

LEAVE A COMMENT