1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-29 20:43:09 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2025-10-24 17:01:50 +08:00
parent 1b4c03924a
commit 6e4f432e26
12 changed files with 343 additions and 746 deletions

View File

@@ -1,4 +1,3 @@
/* eslint-disable react/no-unstable-nested-components */
/* eslint-disable react-native/no-inline-styles */
import React, {useState} from 'react';
import {StyleSheet, Text, View, TouchableOpacity, Image} from 'react-native';
@@ -6,7 +5,7 @@ import {StyleSheet, Text, View, TouchableOpacity, Image} from 'react-native';
import TestConsole from './TestConsole';
import _updateConfig from './update.json';
import {PushyProvider, Pushy, usePushy} from 'react-native-update';
import {UpdateProvider, Pushy, useUpdate} from 'react-native-update';
const {appKey} = _updateConfig.harmony;
function App() {
@@ -20,7 +19,7 @@ function App() {
packageVersion,
currentHash,
progress: {received, total} = {},
} = usePushy();
} = useUpdate();
const [useDefaultAlert, setUseDefaultAlert] = useState(false);
const [showTestConsole, setShowTestConsole] = useState(false);
const [showUpdateBanner, setShowUpdateBanner] = useState(false);
@@ -41,6 +40,7 @@ function App() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>使Pushy热更新服务</Text>
{/* <Image source={require('./gmail.png')} style={styles.image} /> */}
{/* <Text style={styles.welcome}>😁hdiffFromAPP更新成功</Text> */}
{/* <Text style={styles.welcome}>😁hdiffFromPPk更新成功</Text> */}
<View style={{flexDirection: 'row'}}>
@@ -166,7 +166,7 @@ function App() {
style={{marginRight: 20}}>
<Text style={{color: '#2196F3'}}></Text>
</TouchableOpacity>
<TouchableOpacity onPress={switchVersion}>
<TouchableOpacity onPress={() => switchVersion()}>
<Text style={{color: '#2196F3'}}></Text>
</TouchableOpacity>
</View>
@@ -204,18 +204,22 @@ const styles = StyleSheet.create({
color: '#333333',
marginBottom: 5,
},
image: {},
image: {
width: 109,
height: 40,
},
});
const pushyClient = new Pushy({
appKey,
debug: true,
updateStrategy: null,
});
export default function Root() {
return (
<PushyProvider client={pushyClient}>
<UpdateProvider client={pushyClient}>
<App />
</PushyProvider>
</UpdateProvider>
);
}