Skip to content

Commit 4b0a4bb

Browse files
author
z50902677
committed
修改
1 parent f088fd1 commit 4b0a4bb

File tree

6 files changed

+150
-21
lines changed

6 files changed

+150
-21
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"start": "node node_modules/react-native/local-cli/cli.js start"
6+
"start": "node node_modules/react-native/local-cli/cli.js start",
7+
"run-Android": "react-native run-android"
78
},
89
"dependencies": {
910
"babel-polyfill": "^6.9.1",
1011
"isomorphic-fetch": "^2.2.1",
1112
"react": "15.2.1",
1213
"react-native": "0.30.0",
1314
"react-native-button": "^1.6.0",
15+
"react-native-refreshable-listview": "^1.3.0",
1416
"react-native-router-flux": "^3.31.2",
17+
"react-native-swipeout": "^2.0.12",
1518
"react-redux": "^4.4.5",
1619
"redux": "^3.5.2",
1720
"redux-actions": "^0.10.1",

src/containers/android/ListView.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* Created by zhaohang on 2016/7/25.
3+
*/
4+
import React ,{Component}from 'react';
5+
import {View, Text, StyleSheet,TextInput,Image,ListView} from "react-native";
6+
import { connect } from 'react-redux'
7+
import Button from "react-native-button";
8+
import Swipeout from "react-native-swipeout";
9+
const styles = StyleSheet.create({
10+
row: {
11+
borderBottomColor: '#E0E0E0',
12+
borderBottomWidth: 1,
13+
flexDirection: 'row',
14+
padding: 5
15+
},
16+
thumb: {
17+
width: 56,
18+
height: 56
19+
},
20+
title: {
21+
marginTop: 8,
22+
marginLeft: 3,
23+
width:300,
24+
color: 'black',
25+
flex: 1
26+
},
27+
desc: {
28+
marginTop: 8,
29+
marginLeft: 3
30+
}
31+
});
32+
const listView = (props) => {
33+
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
34+
const dataSource = ds.cloneWithRows([{
35+
url: '../image/logo.png', title: '第四代活塞,谁发的第四代活塞,谁发的第四代活塞,谁发的', author: '张三', data: '2016-01-01'
36+
}, {
37+
url: '/src/image/login.png',
38+
title: '库克将怒火几年级',
39+
author: 'lily',
40+
data: '2016-08-08'
41+
}]);
42+
return (
43+
<ListView
44+
dataSource={dataSource}
45+
renderRow={(rowData) =>
46+
<Swipeout right={[{text:'删除',backgroundColor:'red'}]} backgroundColor={'#FFF'}>
47+
<View style={styles.row}>
48+
<View>
49+
<Image style={styles.thumb} source={require('../../image/login.png')} />
50+
</View>
51+
<View>
52+
<View>
53+
<Text style={styles.title} numberOfLines ={1}>
54+
{rowData.title}
55+
</Text>
56+
</View>
57+
<View>
58+
<Text style={styles.desc}>
59+
{rowData.author} {rowData.data}
60+
</Text>
61+
</View>
62+
</View>
63+
</View>
64+
</Swipeout>
65+
}
66+
/>
67+
);
68+
}
69+
70+
export default connect(
71+
(state) => ({
72+
})
73+
)(listView)

src/containers/android/Login.js

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,91 @@
22
* Created by wangtun on 2016/7/21.
33
*/
44
import React from 'react';
5-
import {View, Text, StyleSheet} from "react-native";
5+
import {View, Text, StyleSheet,TextInput,Image} from "react-native";
66
import { connect } from 'react-redux'
77
import Button from "react-native-button";
88
import loginActions from '../../actions/loginActions'
99

1010
const styles = StyleSheet.create({
1111
container: {
1212
flex: 1,
13-
justifyContent: "center",
14-
alignItems: "center",
15-
backgroundColor: "#F5FCFF",
13+
backgroundColor: '#2B3745'
1614
},
17-
welcome: {
18-
fontSize: 20,
19-
textAlign: "center",
20-
margin: 10,
15+
driver: {
16+
borderBottomColor:'#E0E0E0',
17+
borderBottomWidth:1,
18+
backgroundColor: '#2B3745',
19+
justifyContent: 'center',
20+
marginLeft: 10,
21+
marginTop: 10,
22+
marginRight:10
2123
},
22-
instructions: {
23-
textAlign: "center",
24-
color: "#333333",
25-
marginBottom: 5,
24+
driver1: {
25+
backgroundColor: '#2B3745',
26+
justifyContent: 'center',
27+
borderRadius: 6,
28+
marginLeft: 10,
29+
marginRight:10
30+
},
31+
textinput: {
32+
flex: 1,
33+
borderBottomColor:'#FFFFFF',
34+
borderBottomWidth:1,
35+
color: '#FFFFFF',
36+
fontSize: 16
37+
},
38+
buttonview: {
39+
backgroundColor: '#1DBAF1',
40+
margin: 20,
41+
borderRadius: 6,
42+
justifyContent: 'center',
43+
alignItems: 'center'
44+
},
45+
logintext: {
46+
fontSize: 17,
47+
color: '#FFFFFF',
48+
marginTop: 10,
49+
marginBottom: 10
50+
},
51+
loginName: {
52+
fontSize: 17,
53+
alignSelf: 'center',
54+
color: '#FFFFFF'
55+
},
56+
avatarview: {
57+
height: 150,
58+
justifyContent: 'center'
59+
},
60+
avatarimage: {
61+
width: 100,
62+
height: 100,
63+
alignSelf: 'center',
64+
borderRadius:126
2665
},
2766
});
2867

2968

3069
const Login = (props) => {
3170
const {login} = props.actions;
3271
return (
33-
<View style={[styles.container, {backgroundColor:"gray"}]}>
34-
<Text>Login page: </Text>
35-
<Button onPress={login}>-cccccc</Button>
72+
<View style={styles.container}>
73+
<View style={styles.avatarview}>
74+
<Image source={require('../../image/logo.png')} style={styles.avatarimage}/>
75+
<Text style={styles.loginName} >电 桩</Text>
76+
</View>
77+
<View style={styles.driver}>
78+
<TextInput placeholder="请输入用户名" placeholderTextColor ='#E0E0E0' style={styles.textinput} underlineColorAndroid='transparent'
79+
keyboardType = 'default'>
80+
</TextInput>
81+
</View>
82+
<View style={styles.driver1}>
83+
<TextInput placeholder="请输入密码" placeholderTextColor ='#E0E0E0' style={styles.textinput} underlineColorAndroid='transparent'
84+
secureTextEntry ={true} keyboardType = 'default'>
85+
</TextInput>
86+
</View>
87+
<View style={styles.buttonview}>
88+
<Text style={styles.logintext} >登 录</Text>
89+
</View>
3690
</View>
3791
);
3892
};

src/containers/android/app.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ import React, { Component } from 'react';
66
import { createStore, applyMiddleware, compose } from 'redux';
77
import { Provider,connect } from 'react-redux';
88
import { Router, Scene } from 'react-native-router-flux';
9+
import login from './../../containers/android/Login';
10+
import ListView from './../../containers/android/ListView';
911
import login2 from './../../components/android/Login2';
1012
import login3 from './../../components/android/Login3';
11-
import login from './Login';
12-
1313
import routeReducerCreator from './../../reducers/routeReducerCreator';
1414
import helper from './../../utils/helper'
1515
import { api, callApi } from './../../apis/api'
1616
import Button from "react-native-button";
17-
import store from './../../store/store'
18-
17+
import store from './../../store/store';
1918
class App extends React.Component {
2019
constructor(props) {
2120
super(props);
@@ -36,7 +35,7 @@ class App extends React.Component {
3635
<Provider store={store}>
3736
<Router createReducer={routeReducerCreator}>
3837
<Scene key="login" direction="vertical" initial={true}>
39-
<Scene key="loginModal" direction="vertical" component={login} title="Login" />
38+
<Scene key="loginModal" direction="vertical" component={login} title="Login" hideNavBar/>
4039
<Scene
4140
key="loginModal2"
4241
hideNavBar

src/image/login.png

38.4 KB
Loading

src/image/logo.png

13.9 KB
Loading

0 commit comments

Comments
 (0)