提交 74c0f01c authored 作者: 吴强's avatar 吴强

add progress bar

上级 d51b5570
......@@ -2,14 +2,24 @@ import { AsyncStorage } from 'react-native';
import { NavigationActions } from 'react-navigation';
// import codePush from 'react-native-code-push';
import { checkUpdate } from '../services/update';
import { addUpdaterDownloadingCallback, update, addUpdaterDownloadedCallback } from '../native/Updater';
import { update } from '../native/Updater';
import config from '../utils/config';
import { encrypt } from '../utils/helper';
export default {
namespace: 'welcome',
state: { },
reducers: {},
state: {
percent: 0,
},
reducers: {
setPercent(state, { payload }) {
console.info(payload);
return {
...state,
percent: payload.progress,
};
},
},
effects: {
*init(ignored, { put, call }) {
try {
......@@ -20,7 +30,13 @@ export default {
const token = encrypt(tokenId);
// console.info(`${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`);
console.log('开始');
yield call(update, `${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`, (event) => { console.info(event); });
yield call(
update, `${config.updateContextPath}/resource/${token}/${encodeURIComponent(deploymentInfo.uri)}`,
(event) => {
put({ type: 'setPercent', payload: { progress: event.progress } });
console.info(event);
},
);
console.log('结束结束结束结束结束结束结束结束结束结束');
}
} catch (e) {
......
......@@ -3,6 +3,7 @@ import { View, StyleSheet, Text } from 'react-native';
import { connect } from 'react-redux';
import SplashScreen from 'react-native-splash-screen';
import { createAction } from '../utils/index';
import PercentageCircle from '../components/roundProgressBarComponent';
@connect(({ welcome }) => ({ welcome }))
class WelcomeScreen extends Component {
......@@ -17,8 +18,10 @@ class WelcomeScreen extends Component {
return (
<View style={styles.container}>
<Text>wlecome</Text>
<View>
<PercentageCircle radius={60} percent={this.props.welcome.percent} color="#3498db" />
</View>
</View>
);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论