MCPcopy Create free account
hub / github.com/reactnativecn/react-native-update / App

Function App

Example/harmony_use_pushy/App.tsx:11–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9const {appKey} = _updateConfig.harmony;
10
11function App() {
12 const {
13 client,
14 checkUpdate,
15 downloadUpdate,
16 switchVersionLater,
17 switchVersion,
18 updateInfo,
19 packageVersion,
20 currentHash,
21 progress: {received, total} = {},
22 } = useUpdate();
23 const [useDefaultAlert, setUseDefaultAlert] = useState(false);
24 const [showTestConsole, setShowTestConsole] = useState(false);
25 const [showUpdateBanner, setShowUpdateBanner] = useState(false);
26 const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
27 // if (updateInfo) {
28 // updateInfo!.name = 'name';
29 // updateInfo!.update = true;
30 // }
31 const snackbarVisible =
32 !useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
33
34 if (showTestConsole) {
35 return (
36 <TestConsole visible={true} onClose={() => setShowTestConsole(false)} />
37 );
38 }
39
40 return (
41 <View style={styles.container}>
42 <Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text>
43 {/* <Image source={require('./gmail.png')} style={styles.image} /> */}
44 {/* <Text style={styles.welcome}>😁hdiffFromAPP更新成功!!!</Text> */}
45 {/* <Text style={styles.welcome}>😁hdiffFromPPk更新成功!!!</Text> */}
46 <View style={{flexDirection: 'row'}}>
47 <TouchableOpacity
48 onPress={() => {
49 client?.setOptions({
50 updateStrategy: !useDefaultAlert ? null : 'alwaysAlert',
51 });
52 setShowUpdateSnackbar(useDefaultAlert);
53 setUseDefaultAlert(!useDefaultAlert);
54 }}
55 style={{
56 flexDirection: 'row',
57 alignItems: 'center',
58 }}>
59 <View
60 style={{
61 width: 20,
62 height: 20,
63 borderWidth: 1,
64 borderColor: '#999',
65 backgroundColor: useDefaultAlert ? 'blue' : 'white',
66 justifyContent: 'center',
67 alignItems: 'center',
68 }}>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected