1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-31 21:33:12 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Refactor demo

This commit is contained in:
sunnylqm
2021-04-08 23:46:29 +08:00
parent d9e307659f
commit 736b82aac6

View File

@@ -8,6 +8,7 @@ import {
TouchableOpacity, TouchableOpacity,
Linking, Linking,
Image, Image,
NativeModules,
} from 'react-native'; } from 'react-native';
import { import {
@@ -21,11 +22,11 @@ import {
switchVersionLater, switchVersionLater,
markSuccess, markSuccess,
downloadAndInstallApk, downloadAndInstallApk,
cInfo,
} from 'react-native-update'; } from 'react-native-update';
import _updateConfig from '../update.json'; import _updateConfig from '../update.json';
const {appKey} = _updateConfig[Platform.OS]; const {appKey} = _updateConfig[Platform.OS];
export default class App extends Component { export default class App extends Component {
state = { state = {
received: 0, received: 0,
@@ -140,7 +141,7 @@ export default class App extends Component {
}; };
render() { render() {
const { received, total } = this.state; const {received, total} = this.state;
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.welcome}>欢迎使用热更新服务</Text> <Text style={styles.welcome}>欢迎使用热更新服务</Text>
@@ -162,6 +163,16 @@ export default class App extends Component {
<TouchableOpacity onPress={this.checkUpdate}> <TouchableOpacity onPress={this.checkUpdate}>
<Text style={styles.instructions}>点击这里检查更新</Text> <Text style={styles.instructions}>点击这里检查更新</Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity
style={{marginTop: 15}}
onLongPress={() => {
// TODO 调试pushy方法
}}>
<Text style={styles.instructions}>
react-native-update版本{cInfo.pushy}
</Text>
</TouchableOpacity>
{/* <WebView style={{flex:1}} source={{uri: require('../www/index.html')}}/> */} {/* <WebView style={{flex:1}} source={{uri: require('../www/index.html')}}/> */}
</View> </View>
); );