11import React , { useEffect , useLayoutEffect , useMemo , useRef } from 'react'
2- import { View } from 'react-native'
3- import { WebView , WebViewProps } from 'react-native-webview'
2+ import { WebView } from 'react-native-webview'
43
5- import { useTheme , SylCommon } from '@src/theme'
6- import { WebViewerScreenProps as ScreenProps } from '@src/navigation/routes'
74import { Spinner } from '@src/components'
8- import { HeaderButton } from '../components'
9- import { linking } from '@src/utils'
105import { translate } from '@src/i18n'
6+ import { WebViewerScreenProps as ScreenProps } from '@src/navigation/routes'
7+ import { SylCommon , useTheme } from '@src/theme'
8+ import { linking } from '@src/utils'
9+ import { HeaderButton } from '../components'
1110
1211const WebLink = ( { route, navigation } : ScreenProps ) => {
1312 const { theme } = useTheme ( )
14- const webViewRef = useRef ( new WebView < { current ?: any } > ( { } ) )
13+ const webViewRef = useRef < WebView > ( null )
1514 const [ loading , setLoading ] = React . useState ( true )
1615 const url = useMemo (
1716 ( ) => ( ! route . params . url . startsWith ( 'http' ) ? `http://${ route . params . url } ` : route . params . url ) ,
@@ -33,7 +32,7 @@ const WebLink = ({ route, navigation }: ScreenProps) => {
3332 source = { theme . assets . images . icons . header . refresh }
3433 onPress = { ( ) => {
3534 setLoading ( true )
36- webViewRef . current . reload ( )
35+ webViewRef . current ? .reload ( )
3736 } }
3837 />
3938 < HeaderButton
0 commit comments