1- /* eslint-disable react/no-unstable-nested-components */
21/* eslint-disable react-native/no-inline-styles */
32import React , { useState } from 'react' ;
43import { StyleSheet , Text , View , TouchableOpacity , Image } from 'react-native' ;
54
65import TestConsole from './TestConsole' ;
76
87import _updateConfig from './update.json' ;
9- import { PushyProvider , Pushy , usePushy } from 'react-native-update' ;
8+ import { UpdateProvider , Pushy , useUpdate } from 'react-native-update' ;
109const { appKey} = _updateConfig . harmony ;
1110
1211function App ( ) {
@@ -20,7 +19,7 @@ function App() {
2019 packageVersion,
2120 currentHash,
2221 progress : { received, total} = { } ,
23- } = usePushy ( ) ;
22+ } = useUpdate ( ) ;
2423 const [ useDefaultAlert , setUseDefaultAlert ] = useState ( false ) ;
2524 const [ showTestConsole , setShowTestConsole ] = useState ( false ) ;
2625 const [ showUpdateBanner , setShowUpdateBanner ] = useState ( false ) ;
@@ -41,6 +40,7 @@ function App() {
4140 return (
4241 < View style = { styles . container } >
4342 < Text style = { styles . welcome } > 欢迎使用Pushy热更新服务</ Text >
43+ { /* <Image source={require('./gmail.png')} style={styles.image} /> */ }
4444 { /* <Text style={styles.welcome}>😁hdiffFromAPP更新成功!!!</Text> */ }
4545 { /* <Text style={styles.welcome}>😁hdiffFromPPk更新成功!!!</Text> */ }
4646 < View style = { { flexDirection : 'row' } } >
@@ -166,7 +166,7 @@ function App() {
166166 style = { { marginRight : 20 } } >
167167 < Text style = { { color : '#2196F3' } } > 下次再说</ Text >
168168 </ TouchableOpacity >
169- < TouchableOpacity onPress = { switchVersion } >
169+ < TouchableOpacity onPress = { ( ) => switchVersion ( ) } >
170170 < Text style = { { color : '#2196F3' } } > 立即重启</ Text >
171171 </ TouchableOpacity >
172172 </ View >
@@ -204,18 +204,22 @@ const styles = StyleSheet.create({
204204 color : '#333333' ,
205205 marginBottom : 5 ,
206206 } ,
207- image : { } ,
207+ image : {
208+ width : 109 ,
209+ height : 40 ,
210+ } ,
208211} ) ;
209212
210213const pushyClient = new Pushy ( {
211214 appKey,
212215 debug : true ,
216+ updateStrategy : null ,
213217} ) ;
214218
215219export default function Root ( ) {
216220 return (
217- < PushyProvider client = { pushyClient } >
221+ < UpdateProvider client = { pushyClient } >
218222 < App />
219- </ PushyProvider >
223+ </ UpdateProvider >
220224 ) ;
221225}
0 commit comments