|
4 | 4 | * @flow |
5 | 5 | */ |
6 | 6 |
|
7 | | -import React, { Component } from 'react'; |
8 | | -var ProgressBar = require('ProgressBarAndroid'); |
9 | | -import { |
10 | | - AppRegistry, |
11 | | - StyleSheet, |
12 | | - Text, |
13 | | - Modal, |
14 | | - Image, |
15 | | - TextInput, |
16 | | - ProgressBarAndroid, |
17 | | - View |
18 | | -} from 'react-native'; |
| 7 | +import { AppRegistry } from 'react-native'; |
| 8 | +import AndroidApp from './androidSrc/index.js'; |
19 | 9 |
|
20 | | -class AndroidProject extends Component { |
21 | | - constructor(props) { |
22 | | - super(props); |
23 | | - this.state = {username: "", password: "",modalVisible:false,transparent:true}; |
24 | | - this.handleSubmit = this.handleSubmit.bind(this); |
25 | | - } |
26 | | - |
27 | | - handleSubmit(){ |
28 | | - this.setState({modalVisible:!this.state.modalVisible}) |
29 | | - } |
30 | | - |
31 | | - render() { |
32 | | - const modalBackgroundStyle = { |
33 | | - backgroundColor: this.state.transparent ? 'rgba(0, 0, 0, 0.5)' : '#f5fcff', |
34 | | - } |
35 | | - const innerContainerTransparentStyle = this.state.transparent |
36 | | - ? {backgroundColor: '#e5e5e5', padding: 20,width:150} |
37 | | - : null |
38 | | - return ( |
39 | | - <View style={{paddingLeft:10,paddingRight:10,backgroundColor:'#E8E8E8'}}> |
40 | | - <View> |
41 | | - <Image source={require('./Image/qq.png')} style={styles.style_image}/> |
42 | | - </View> |
43 | | - <View style={styles.style_user_input}> |
44 | | - <TextInput placeholder='用户名' underlineColorAndroid='transparent' placeholderTextColor='gray' style={{height: 40, borderColor: 'gray', borderWidth: 1,textAlign:'center'}}> |
45 | | - </TextInput> |
46 | | - </View> |
47 | | - <View style={styles.style_pwd_input}> |
48 | | - <TextInput placeholder='密 码' underlineColorAndroid='transparent' secureTextEntry={true} placeholderTextColor='gray' style={{height: 40, borderColor: 'gray', borderWidth: 1,textAlign:'center'}}> |
49 | | - </TextInput> |
50 | | - </View> |
51 | | - <View style={styles.style_login_container} > |
52 | | - <Text onPress={this.handleSubmit} style={styles.style_login_text}>登 录</Text> |
53 | | - </View> |
54 | | - |
55 | | - |
56 | | - <Modal |
57 | | - animationType='none' |
58 | | - transparent={this.state.transparent} |
59 | | - visible={this.state.modalVisible} |
60 | | - onRequestClose={this.handleSubmit} |
61 | | - > |
62 | | - <View style={[styles.container, modalBackgroundStyle]}> |
63 | | - <View style={[styles.innerContainer, innerContainerTransparentStyle]}> |
64 | | - <View> |
65 | | - <ProgressBar /> |
66 | | - </View> |
67 | | - <Text onPress={this.handleSubmit} style={{marginTop:10}}> |
68 | | - 关闭 |
69 | | - </Text> |
70 | | - </View> |
71 | | - </View> |
72 | | - </Modal> |
73 | | - </View> |
74 | | - ); |
75 | | - } |
76 | | -} |
77 | | - |
78 | | -const styles = StyleSheet.create({ |
79 | | - container: { |
80 | | - flex: 1, |
81 | | - justifyContent: 'center', |
82 | | - alignItems: 'center', |
83 | | - backgroundColor: '#999', |
84 | | - }, |
85 | | - innerContainer: { |
86 | | - borderRadius: 10, |
87 | | - alignItems: 'center', |
88 | | - }, |
89 | | - style_user_input:{ |
90 | | - backgroundColor:'#fff', |
91 | | - marginTop:20, |
92 | | - height:35, |
93 | | - borderRadius:5, |
94 | | - }, |
95 | | - style_pwd_input:{ |
96 | | - backgroundColor:'#fff', |
97 | | - height:35, |
98 | | - marginTop:10, |
99 | | - borderRadius:5, |
100 | | - }, |
101 | | - style_image:{ |
102 | | - borderRadius:35, |
103 | | - height:70, |
104 | | - width:70, |
105 | | - marginTop:40, |
106 | | - alignSelf:'center', |
107 | | - }, |
108 | | - style_login_container:{ |
109 | | - backgroundColor:'green', |
110 | | - borderRadius:5, |
111 | | - height:35, |
112 | | - marginTop:10 |
113 | | - }, |
114 | | - style_login_text:{ |
115 | | - textAlign:'center', |
116 | | - color:"#FFF", |
117 | | - height:35, |
118 | | - textAlignVertical:'center' |
119 | | - } |
120 | | -}); |
121 | | - |
122 | | -AppRegistry.registerComponent('AndroidProject', () => AndroidProject); |
| 10 | +AppRegistry.registerComponent('AndroidProject', () => AndroidApp); |
0 commit comments