mirror of
https://gitcode.com/gh_mirrors/re/react-native-pushy.git
synced 2025-10-08 10:15:14 +08:00
Add TestConsole
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
Reference in New Issue
Block a user