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

Add TestConsole

This commit is contained in:
sunnylqm
2021-04-09 22:42:43 +08:00
parent ca7878a9db
commit 0ccacc2f7b
2 changed files with 80 additions and 4 deletions

View File

@@ -8,7 +8,6 @@ import {
TouchableOpacity,
Linking,
Image,
NativeModules,
} from 'react-native';
import {
@@ -25,12 +24,15 @@ import {
cInfo,
} from 'react-native-update';
import TestConsole from './TestConsole';
import _updateConfig from '../update.json';
const {appKey} = _updateConfig[Platform.OS];
export default class App extends Component {
state = {
received: 0,
total: 0,
showTestConsole: false,
};
componentDidMount() {
if (isRolledBack) {
@@ -56,7 +58,7 @@ export default class App extends Component {
);
}
}
doUpdate = async (info) => {
doUpdate = async info => {
try {
const hash = await downloadUpdate(info, {
onDownloadProgress: ({received, total}) => {
@@ -141,7 +143,7 @@ export default class App extends Component {
};
render() {
const {received, total} = this.state;
const {received, total, showTestConsole} = this.state;
return (
<View style={styles.container}>
<Text style={styles.welcome}>欢迎使用热更新服务</Text>
@@ -167,12 +169,13 @@ export default class App extends Component {
<TouchableOpacity
style={{marginTop: 15}}
onLongPress={() => {
// TODO 调试pushy方法
this.setState({showTestConsole: true});
}}>
<Text style={styles.instructions}>
react-native-update版本{cInfo.pushy}
</Text>
</TouchableOpacity>
<TestConsole visible={showTestConsole} />
{/* <WebView style={{flex:1}} source={{uri: require('../www/index.html')}}/> */}
</View>
);