view.js
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @author sheng
* @description 隐私政策
* @date 2020/09/03
*/
import React, { useEffect, useState } from 'react'
import { View, ActivityIndicator } from 'react-native'
import WebView from 'react-native-webview'
import { Colors } from '../../../commo/theme'
import { APP } from '../../../config'
import { styles } from './style'
const Page = ({ navigation }) => {
const [show, setShow] = useState(false)
const indicator = () => {
return (
<View style={styles.wrapper}>
<ActivityIndicator size={'large'} color={Colors.primary} />
</View>
)
}
useEffect(()=>{
setShow(true)
const remove = navigation.addListener('beforeRemove', e => {
e.preventDefault()
setShow(false)
remove()
navigation.goBack()
})
return () => remove && remove()
}, [])
return (
<View style={{ flex: 1 }}>
{ show &&
<WebView
style={{ flex: 1 }}
startInLoadingState={true}
renderLoading={indicator}
source={{ uri: APP.privacyLink }}
/>
}
</View>
)
}
export default Page