1. 提出loading组件

2. 底部导航构造json单独提出
3. 搞定icon问题
This commit is contained in:
xuwenyang 2019-05-08 17:13:45 +08:00
parent df5a3cf98c
commit 4076fa7333
16 changed files with 624 additions and 369 deletions

19
App.js
View file

@ -21,6 +21,7 @@ import {Navigation} from 'react-native-navigation';
import Color from './src/style/color'
import Api from './src/util/api'
import Loading from './src/component/loading'
import LoginForm from './src/component/loginForm'
import RegisterForm from './src/component/registerForm'
@ -32,12 +33,12 @@ export default class App extends Component {
this.state = ({
isLoginPage: true,
loading: false
isLoading: false
});
}
setLoading(loading) {
this.setState({loading});
_setLoading(value) {
this.setState({isLoading: value});
}
_toWeb() {
@ -54,17 +55,11 @@ export default class App extends Component {
render() {
return (
<View style={localStyle.wrap}>
<Modal visible={this.state.loading}
onRequestClose={() => {}}
transparent={true}>
<View style={localStyle.modal}>
<ActivityIndicator animating={true} color={Color.primary} size={Platform.OS === 'android' ? 'large' : 'small'}/>
</View>
</Modal>
<Loading visible={this.state.isLoading}></Loading>
<Animated.View style={localStyle.content}>
{this.state.isLoginPage
? (<LoginForm setLoading={this.setLoading.bind(this)}></LoginForm>)
: (<RegisterForm setLoading={this.setLoading.bind(this)}></RegisterForm>)}
? (<LoginForm setLoading={this._setLoading.bind(this)}></LoginForm>)
: (<RegisterForm></RegisterForm>)}
<View style={localStyle.bottom}>
<TouchableOpacity onPress={this._switchForm.bind(this)}>

View file

@ -2,30 +2,30 @@
* @entry
*/
import { Navigation } from 'react-native-navigation';
import {Navigation} from 'react-native-navigation';
import {Icon, loadIcon} from './src/style/icon'
import App from './App';
import PageList from './src/page/_list'
import Token from './src/util/token'
import PageList from './src/page/_list'
import BottomNav from './src/nav/bottomNav'
async function init() {
let token = await Token.getUserToken();
await loadIcon();
// let token = await Token.getUserToken();
let token;
if (!token) {
Navigation.startSingleScreenApp({
screen: {
screen: 'App',
title: 'App Title'
screen: 'App'
}
});
} else {
Navigation.startSingleScreenApp({
screen: {
screen: 'Home',
title: 'Home Title'
}
});
Navigation.startTabBasedApp(BottomNav.config());
}
}

View file

@ -41,22 +41,18 @@
4117125F2280921A00018FD3 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4117125E2280920E00018FD3 /* libReactNativeNavigation.a */; };
444B74B0B45F447FA6D25561 /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A333F2A12D224289B26028D1 /* libRNVectorIcons.a */; };
47AE5EA4A39F43CFA279144B /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B6943EF54DC4C0E8C860C48 /* libRNDeviceInfo.a */; };
65C05FE762B34063B6F7C56A /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9B75EADE871640EF8F7DB2E4 /* AntDesign.ttf */; };
6CA03C7B6F034CF5B2ECC3E5 /* libRNVectorIcons-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */; };
6CAEBF678D2F4D3A8D88B88A /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CC35BDC2C50846E0A4F98D35 /* EvilIcons.ttf */; };
71E72460768C4C9EB73C5050 /* MaterialCommunityIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0D4DF9EF3F764CD0BF997FD6 /* MaterialCommunityIcons.ttf */; };
7CDD27C257FA4106B76D549E /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C558ABC6E5C94D939958E5F9 /* FontAwesome.ttf */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
93CB73C935C04E44A8FA6B25 /* FontAwesome5_Brands.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B067C379E8A3470390E07C13 /* FontAwesome5_Brands.ttf */; };
9D7603B23A7F4822A211DDAE /* Feather.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6D8788EB66CB42AAAE311EF6 /* Feather.ttf */; };
9DF5D161F69E45E7B193AF29 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 126191B2E4AC47DC918127F9 /* Ionicons.ttf */; };
9ED46B2FDF3A4DB9A9DE64DD /* libRNCAsyncStorage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 02F6E40D13C4416C92D5A67C /* libRNCAsyncStorage.a */; };
A61FA51EAE72415DB62CBA81 /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = ADD4078A795846A0BD1A4B1B /* FontAwesome5_Regular.ttf */; };
AAC17BBBD9A24A4391B1FBA1 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E259D54DE3C4445E8CCCEE25 /* SimpleLineIcons.ttf */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
B45882E734E94D3393231370 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 784C7C58E2B04EECBD71EF5E /* libRNDeviceInfo-tvOS.a */; };
C4A31F747A7249C4AB01212C /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = ADDB7A9FC7044DF48E9BA080 /* Octicons.ttf */; };
D9511472069D4A7684F78795 /* FontAwesome5_Solid.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 958BF3F4E40A4001BAF2E744 /* FontAwesome5_Solid.ttf */; };
E039523D29354ECE80E38A03 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 39A6CC5AA01844FCA6BAD7CE /* MaterialIcons.ttf */; };
ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };
@ -323,13 +319,6 @@
remoteGlobalIDString = 5DBEB1501B18CEA900B34395;
remoteInfo = RNVectorIcons;
};
41FCEABD22818DAE009A3DD7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 000EDE6A5D7D497FB251CC09 /* RNVectorIcons.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A39873CE1EA65EE60051E01A;
remoteInfo = "RNVectorIcons-tvOS";
};
41FCEAC322818DAE009A3DD7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D16AA0DE1A4348A8B86F08A1 /* RNDeviceInfo.xcodeproj */;
@ -420,13 +409,9 @@
7FC4807EA1FA42A4A55BDAE5 /* libRNVectorIcons-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNVectorIcons-tvOS.a"; sourceTree = "<group>"; };
81F0243DD71F467A964CAD89 /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
958BF3F4E40A4001BAF2E744 /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Solid.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf"; sourceTree = "<group>"; };
9B75EADE871640EF8F7DB2E4 /* AntDesign.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = AntDesign.ttf; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = "<group>"; };
A333F2A12D224289B26028D1 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = "<group>"; };
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
ADD4078A795846A0BD1A4B1B /* FontAwesome5_Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Regular.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf"; sourceTree = "<group>"; };
ADDB7A9FC7044DF48E9BA080 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = "<group>"; };
B067C379E8A3470390E07C13 /* FontAwesome5_Brands.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Brands.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf"; sourceTree = "<group>"; };
C558ABC6E5C94D939958E5F9 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = "<group>"; };
CC35BDC2C50846E0A4F98D35 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
D16AA0DE1A4348A8B86F08A1 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
@ -656,7 +641,6 @@
isa = PBXGroup;
children = (
41EC7D5222815DCA00779391 /* libRNVectorIcons.a */,
41FCEABE22818DAE009A3DD7 /* libRNVectorIcons-tvOS.a */,
);
name = Products;
sourceTree = "<group>";
@ -759,14 +743,10 @@
E53A65304C4E46A4856A4D78 /* Resources */ = {
isa = PBXGroup;
children = (
9B75EADE871640EF8F7DB2E4 /* AntDesign.ttf */,
81F0243DD71F467A964CAD89 /* Entypo.ttf */,
CC35BDC2C50846E0A4F98D35 /* EvilIcons.ttf */,
6D8788EB66CB42AAAE311EF6 /* Feather.ttf */,
C558ABC6E5C94D939958E5F9 /* FontAwesome.ttf */,
B067C379E8A3470390E07C13 /* FontAwesome5_Brands.ttf */,
ADD4078A795846A0BD1A4B1B /* FontAwesome5_Regular.ttf */,
958BF3F4E40A4001BAF2E744 /* FontAwesome5_Solid.ttf */,
286848A695D94FA0AC6F8B7E /* Foundation.ttf */,
126191B2E4AC47DC918127F9 /* Ionicons.ttf */,
0D4DF9EF3F764CD0BF997FD6 /* MaterialCommunityIcons.ttf */,
@ -1211,13 +1191,6 @@
remoteRef = 41EC7D5122815DCA00779391 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
41FCEABE22818DAE009A3DD7 /* libRNVectorIcons-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libRNVectorIcons-tvOS.a";
remoteRef = 41FCEABD22818DAE009A3DD7 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
41FCEAC422818DAE009A3DD7 /* libRNDeviceInfo.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1283,14 +1256,10 @@
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
65C05FE762B34063B6F7C56A /* AntDesign.ttf in Resources */,
F343A722A8DB46C79081F2A0 /* Entypo.ttf in Resources */,
6CAEBF678D2F4D3A8D88B88A /* EvilIcons.ttf in Resources */,
9D7603B23A7F4822A211DDAE /* Feather.ttf in Resources */,
7CDD27C257FA4106B76D549E /* FontAwesome.ttf in Resources */,
93CB73C935C04E44A8FA6B25 /* FontAwesome5_Brands.ttf in Resources */,
A61FA51EAE72415DB62CBA81 /* FontAwesome5_Regular.ttf in Resources */,
D9511472069D4A7684F78795 /* FontAwesome5_Solid.ttf in Resources */,
1BB1EE3F5E2B43A3A160B05B /* Foundation.ttf in Resources */,
9DF5D161F69E45E7B193AF29 /* Ionicons.ttf in Resources */,
71E72460768C4C9EB73C5050 /* MaterialCommunityIcons.ttf in Resources */,
@ -1331,7 +1300,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;

View file

@ -54,6 +54,18 @@
</dict>
</dict>
<key>UIAppFonts</key>
<array/>
<array>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>
</dict>
</plist>

482
package-lock.json generated
View file

@ -2923,9 +2923,9 @@
"integrity": "sha1-WmZEhNSFvLq3lkjhoM53W5CEPyk="
},
"@react-native-community/cli": {
"version": "1.9.2",
"resolved": "https://registry.npm.taobao.org/@react-native-community/cli/download/@react-native-community/cli-1.9.2.tgz",
"integrity": "sha1-0DOrFB3zpHbmKK7NnJlTS1yw1j4=",
"version": "1.9.4",
"resolved": "https://registry.npm.taobao.org/@react-native-community/cli/download/@react-native-community/cli-1.9.4.tgz",
"integrity": "sha1-UeS6MKpu4p8MHivt9prH0aTfGow=",
"requires": {
"chalk": "^1.1.1",
"commander": "^2.19.0",
@ -3722,6 +3722,23 @@
"resolved": "http://registry.npm.taobao.org/babel-plugin-syntax-trailing-function-commas/download/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz",
"integrity": "sha1-qiE8FDXiv/62/KhCKH71NK0F1c8="
},
"babel-polyfill": {
"version": "6.23.0",
"resolved": "http://registry.npm.taobao.org/babel-polyfill/download/babel-polyfill-6.23.0.tgz",
"integrity": "sha1-g2TKYt+Or7gwSZ9pkXdGbDsDSZ0=",
"requires": {
"babel-runtime": "^6.22.0",
"core-js": "^2.4.0",
"regenerator-runtime": "^0.10.0"
},
"dependencies": {
"regenerator-runtime": {
"version": "0.10.5",
"resolved": "http://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
}
}
},
"babel-preset-fbjs": {
"version": "3.2.0",
"resolved": "http://registry.npm.taobao.org/babel-preset-fbjs/download/babel-preset-fbjs-3.2.0.tgz",
@ -3766,6 +3783,15 @@
"babel-plugin-jest-hoist": "^24.6.0"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/balanced-match/download/balanced-match-1.0.0.tgz",
@ -4148,15 +4174,6 @@
"object-visit": "^1.0.0"
}
},
"color": {
"version": "3.1.1",
"resolved": "https://registry.npm.taobao.org/color/download/color-3.1.1.tgz",
"integrity": "sha1-er9cDTjok3goToc8IHriFy3MimE=",
"requires": {
"color-convert": "^1.9.1",
"color-string": "^1.5.2"
}
},
"color-convert": {
"version": "1.9.3",
"resolved": "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz",
@ -4170,15 +4187,6 @@
"resolved": "http://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"color-string": {
"version": "1.5.3",
"resolved": "http://registry.npm.taobao.org/color-string/download/color-string-1.5.3.tgz",
"integrity": "sha1-ybvF8BtYtUkvPWhXRZy2WQziBMw=",
"requires": {
"color-name": "^1.0.0",
"simple-swizzle": "^0.2.2"
}
},
"color-support": {
"version": "1.1.3",
"resolved": "http://registry.npm.taobao.org/color-support/download/color-support-1.1.3.tgz",
@ -4406,11 +4414,6 @@
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
"dev": true
},
"deepmerge": {
"version": "3.2.0",
"resolved": "http://registry.npm.taobao.org/deepmerge/download/deepmerge-3.2.0.tgz",
"integrity": "sha1-WO9GOlfAjTdlR/iGn9xbzulX9E4="
},
"define-properties": {
"version": "1.1.3",
"resolved": "http://registry.npm.taobao.org/define-properties/download/define-properties-1.1.3.tgz",
@ -4534,11 +4537,6 @@
"resolved": "http://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "http://registry.npm.taobao.org/emoji-regex/download/emoji-regex-7.0.3.tgz",
"integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/encodeurl/download/encodeurl-1.0.2.tgz",
@ -4562,7 +4560,7 @@
},
"envinfo": {
"version": "5.12.1",
"resolved": "http://registry.npm.taobao.org/envinfo/download/envinfo-5.12.1.tgz",
"resolved": "https://registry.npm.taobao.org/envinfo/download/envinfo-5.12.1.tgz",
"integrity": "sha1-gwaMM+CXLrZX1rxppt8wut77Ru8="
},
"error-ex": {
@ -5690,14 +5688,6 @@
}
}
},
"hoist-non-react-statics": {
"version": "3.3.0",
"resolved": "http://registry.npm.taobao.org/hoist-non-react-statics/download/hoist-non-react-statics-3.3.0.tgz",
"integrity": "sha1-sJF48BIhhPuVrPUl2q7LTY9FlYs=",
"requires": {
"react-is": "^16.7.0"
}
},
"hosted-git-info": {
"version": "2.7.1",
"resolved": "http://registry.npm.taobao.org/hosted-git-info/download/hosted-git-info-2.7.1.tgz",
@ -5713,14 +5703,15 @@
}
},
"http-errors": {
"version": "1.6.3",
"resolved": "http://registry.npm.taobao.org/http-errors/download/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"version": "1.7.2",
"resolved": "http://registry.npm.taobao.org/http-errors/download/http-errors-1.7.2.tgz",
"integrity": "sha1-T1ApzxMjnzEDblsuVSkrz7zIXI8=",
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2"
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
},
"dependencies": {
"statuses": {
@ -9243,6 +9234,11 @@
"resolved": "http://registry.npm.taobao.org/lodash/download/lodash-4.17.11.tgz",
"integrity": "sha1-s56mIp72B+zYniyN8SU2iRysm40="
},
"lodash.isempty": {
"version": "4.4.0",
"resolved": "http://registry.npm.taobao.org/lodash.isempty/download/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"lodash.pad": {
"version": "4.5.1",
"resolved": "http://registry.npm.taobao.org/lodash.pad/download/lodash.pad-4.5.1.tgz",
@ -9269,6 +9265,11 @@
"resolved": "http://registry.npm.taobao.org/lodash.throttle/download/lodash.throttle-4.1.1.tgz",
"integrity": "sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ="
},
"lodash.times": {
"version": "4.3.2",
"resolved": "http://registry.npm.taobao.org/lodash.times/download/lodash.times-4.3.2.tgz",
"integrity": "sha1-Ph8lZcQxdU1Uq1fy7RdBk5KFyh0="
},
"loose-envify": {
"version": "1.4.0",
"resolved": "http://registry.npm.taobao.org/loose-envify/download/loose-envify-1.4.0.tgz",
@ -9314,6 +9315,7 @@
"version": "0.1.3",
"resolved": "http://registry.npm.taobao.org/map-age-cleaner/download/map-age-cleaner-0.1.3.tgz",
"integrity": "sha1-fVg6cwZDTAVf5HSw9FB45uG0uSo=",
"dev": true,
"requires": {
"p-defer": "^1.0.0"
}
@ -10133,10 +10135,75 @@
"mimic-fn": "^1.0.0"
}
},
"opencollective-postinstall": {
"version": "2.0.2",
"resolved": "https://registry.npm.taobao.org/opencollective-postinstall/download/opencollective-postinstall-2.0.2.tgz",
"integrity": "sha1-Vlfxvt5ptuM6RZObBh61PTxsOok="
"opencollective": {
"version": "1.0.3",
"resolved": "http://registry.npm.taobao.org/opencollective/download/opencollective-1.0.3.tgz",
"integrity": "sha1-ruY3K8KBRFg2kMPKja7PwSDdDvE=",
"requires": {
"babel-polyfill": "6.23.0",
"chalk": "1.1.3",
"inquirer": "3.0.6",
"minimist": "1.2.0",
"node-fetch": "1.6.3",
"opn": "4.0.2"
},
"dependencies": {
"ansi-escapes": {
"version": "1.4.0",
"resolved": "http://registry.npm.taobao.org/ansi-escapes/download/ansi-escapes-1.4.0.tgz",
"integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4="
},
"chalk": {
"version": "1.1.3",
"resolved": "http://registry.npm.taobao.org/chalk/download/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"inquirer": {
"version": "3.0.6",
"resolved": "http://registry.npm.taobao.org/inquirer/download/inquirer-3.0.6.tgz",
"integrity": "sha1-4EqqnQW3o8ubD0B9BDdfBEcZA0c=",
"requires": {
"ansi-escapes": "^1.1.0",
"chalk": "^1.0.0",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^2.0.1",
"figures": "^2.0.0",
"lodash": "^4.3.0",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rx": "^4.1.0",
"string-width": "^2.0.0",
"strip-ansi": "^3.0.0",
"through": "^2.3.6"
}
},
"node-fetch": {
"version": "1.6.3",
"resolved": "https://registry.npm.taobao.org/node-fetch/download/node-fetch-1.6.3.tgz",
"integrity": "sha1-3CNO3WSJmC1Y6PDbT2lQKavNjAQ=",
"requires": {
"encoding": "^0.1.11",
"is-stream": "^1.0.1"
}
},
"opn": {
"version": "4.0.2",
"resolved": "http://registry.npm.taobao.org/opn/download/opn-4.0.2.tgz",
"integrity": "sha1-erwi5kTf9jsKltWrfyeQwPAavJU=",
"requires": {
"object-assign": "^4.0.1",
"pinkie-promise": "^2.0.0"
}
}
}
},
"opn": {
"version": "3.0.3",
@ -10235,7 +10302,8 @@
"p-defer": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/p-defer/download/p-defer-1.0.0.tgz",
"integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww="
"integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=",
"dev": true
},
"p-each-series": {
"version": "1.0.0",
@ -10254,7 +10322,8 @@
"p-is-promise": {
"version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/p-is-promise/download/p-is-promise-2.1.0.tgz",
"integrity": "sha1-kYzrrqJIpiz3/6uOO8qMX4gvxC4="
"integrity": "sha1-kYzrrqJIpiz3/6uOO8qMX4gvxC4=",
"dev": true
},
"p-limit": {
"version": "1.3.0",
@ -10363,6 +10432,19 @@
"resolved": "http://registry.npm.taobao.org/pify/download/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
"version": "2.0.4",
"resolved": "http://registry.npm.taobao.org/pinkie/download/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "http://registry.npm.taobao.org/pinkie-promise/download/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"requires": {
"pinkie": "^2.0.0"
}
},
"pirates": {
"version": "4.0.1",
"resolved": "http://registry.npm.taobao.org/pirates/download/pirates-4.0.1.tgz",
@ -10722,17 +10804,14 @@
"integrity": "sha1-cXFx2a0c44NY6Pkq3iHUGnBH/AI="
},
"react-native-elements": {
"version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/react-native-elements/download/react-native-elements-1.1.0.tgz",
"integrity": "sha1-+ZvNpEWaiG86tFkcaEwJnTeu3ys=",
"version": "0.19.0",
"resolved": "http://registry.npm.taobao.org/react-native-elements/download/react-native-elements-0.19.0.tgz",
"integrity": "sha1-c3xRmL90h/mYbiAjgmzQvXpQA2Y=",
"requires": {
"color": "^3.1.0",
"deepmerge": "^3.1.0",
"hoist-non-react-statics": "^3.1.0",
"opencollective-postinstall": "^2.0.0",
"prop-types": "^15.5.8",
"react-native-ratings": "^6.3.0",
"react-native-status-bar-height": "^2.2.0"
"lodash.isempty": "^4.4.0",
"lodash.times": "^4.3.2",
"opencollective": "^1.0.3",
"prop-types": "^15.5.8"
}
},
"react-native-navigation": {
@ -10743,210 +10822,34 @@
"lodash": "4.x.x"
}
},
"react-native-ratings": {
"version": "6.3.1",
"resolved": "https://registry.npm.taobao.org/react-native-ratings/download/react-native-ratings-6.3.1.tgz",
"integrity": "sha1-TkvYfzdkI9xiyTP1cPwZMseK2qQ=",
"requires": {
"lodash": "^4.17.4",
"prop-types": "^15.5.10"
}
},
"react-native-status-bar-height": {
"version": "2.3.1",
"resolved": "https://registry.npm.taobao.org/react-native-status-bar-height/download/react-native-status-bar-height-2.3.1.tgz",
"integrity": "sha1-uSzpESwjZykIR6wRKE2dhKYzAWk="
},
"react-native-vector-icons": {
"version": "6.4.2",
"resolved": "http://registry.npm.taobao.org/react-native-vector-icons/download/react-native-vector-icons-6.4.2.tgz",
"integrity": "sha1-7gsJfngzh1RO0WCjGSpDfAl+VR0=",
"version": "4.5.0",
"resolved": "http://registry.npm.taobao.org/react-native-vector-icons/download/react-native-vector-icons-4.5.0.tgz",
"integrity": "sha1-a5VhnmT2LwX1efdKAf5WQN+VFYs=",
"requires": {
"lodash": "^4.0.0",
"prop-types": "^15.6.2",
"yargs": "^13.2.2"
"prop-types": "^15.5.10",
"yargs": "^8.0.2"
},
"dependencies": {
"ansi-regex": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
},
"camelcase": {
"version": "5.3.1",
"resolved": "http://registry.npm.taobao.org/camelcase/download/camelcase-5.3.1.tgz",
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA="
},
"cliui": {
"version": "4.1.0",
"resolved": "http://registry.npm.taobao.org/cliui/download/cliui-4.1.0.tgz",
"integrity": "sha1-NIQi2+gtgAswIu709qwQvy5NG0k=",
"requires": {
"string-width": "^2.1.1",
"strip-ansi": "^4.0.0",
"wrap-ansi": "^2.0.0"
},
"dependencies": {
"string-width": {
"version": "2.1.1",
"resolved": "http://registry.npm.taobao.org/string-width/download/string-width-2.1.1.tgz",
"integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=",
"requires": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
}
}
}
},
"find-up": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/find-up/download/find-up-3.0.0.tgz",
"integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=",
"requires": {
"locate-path": "^3.0.0"
}
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "http://registry.npm.taobao.org/get-caller-file/download/get-caller-file-2.0.5.tgz",
"integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34="
},
"invert-kv": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/invert-kv/download/invert-kv-2.0.0.tgz",
"integrity": "sha1-c5P1r6Weyf9fZ6J2INEcIm4+7AI="
},
"lcid": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/lcid/download/lcid-2.0.0.tgz",
"integrity": "sha1-bvXS32DlL4LrIopMNz6NHzlyU88=",
"requires": {
"invert-kv": "^2.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz",
"integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"mem": {
"version": "4.3.0",
"resolved": "http://registry.npm.taobao.org/mem/download/mem-4.3.0.tgz",
"integrity": "sha1-Rhr0l7xK4JYIzbLmDu+2m/90QXg=",
"requires": {
"map-age-cleaner": "^0.1.1",
"mimic-fn": "^2.0.0",
"p-is-promise": "^2.0.0"
}
},
"mimic-fn": {
"version": "2.1.0",
"resolved": "http://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz",
"integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs="
},
"os-locale": {
"version": "3.1.0",
"resolved": "http://registry.npm.taobao.org/os-locale/download/os-locale-3.1.0.tgz",
"integrity": "sha1-qAKm7hfyTBBIOrmTVxnO9O0Wvxo=",
"requires": {
"execa": "^1.0.0",
"lcid": "^2.0.0",
"mem": "^4.0.0"
}
},
"p-limit": {
"version": "2.2.0",
"resolved": "http://registry.npm.taobao.org/p-limit/download/p-limit-2.2.0.tgz",
"integrity": "sha1-QXyZQeYCepq8ulCS3SkE4lW1+8I=",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "http://registry.npm.taobao.org/p-locate/download/p-locate-3.0.0.tgz",
"integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "http://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz",
"integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY="
},
"require-main-filename": {
"version": "2.0.0",
"resolved": "http://registry.npm.taobao.org/require-main-filename/download/require-main-filename-2.0.0.tgz",
"integrity": "sha1-0LMp7MfMD2Fkn2IhW+aa9UqomJs="
},
"string-width": {
"version": "3.1.0",
"resolved": "http://registry.npm.taobao.org/string-width/download/string-width-3.1.0.tgz",
"integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=",
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "http://registry.npm.taobao.org/ansi-regex/download/ansi-regex-4.1.0.tgz",
"integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc="
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz",
"integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
"requires": {
"ansi-regex": "^4.1.0"
}
}
}
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "http://registry.npm.taobao.org/strip-ansi/download/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"requires": {
"ansi-regex": "^3.0.0"
}
},
"y18n": {
"version": "4.0.0",
"resolved": "http://registry.npm.taobao.org/y18n/download/y18n-4.0.0.tgz",
"integrity": "sha1-le+U+F7MgdAHwmThkKEg8KPIVms="
},
"yargs": {
"version": "13.2.2",
"resolved": "http://registry.npm.taobao.org/yargs/download/yargs-13.2.2.tgz?cache=0&other_urls=http%3A%2F%2Fregistry.npm.taobao.org%2Fyargs%2Fdownload%2Fyargs-13.2.2.tgz",
"integrity": "sha1-DBAfWArpXOp/Odkn53cOP9yX+ZM=",
"version": "8.0.2",
"resolved": "http://registry.npm.taobao.org/yargs/download/yargs-8.0.2.tgz?cache=0&other_urls=http%3A%2F%2Fregistry.npm.taobao.org%2Fyargs%2Fdownload%2Fyargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"requires": {
"cliui": "^4.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"os-locale": "^3.1.0",
"camelcase": "^4.1.0",
"cliui": "^3.2.0",
"decamelize": "^1.1.1",
"get-caller-file": "^1.0.1",
"os-locale": "^2.0.0",
"read-pkg-up": "^2.0.0",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"require-main-filename": "^1.0.1",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"string-width": "^2.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.0.0"
}
},
"yargs-parser": {
"version": "13.1.0",
"resolved": "https://registry.npm.taobao.org/yargs-parser/download/yargs-parser-13.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyargs-parser%2Fdownload%2Fyargs-parser-13.1.0.tgz",
"integrity": "sha1-cBa23QPijhQYpRDiWL5L/1oxE48=",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
"y18n": "^3.2.1",
"yargs-parser": "^7.0.0"
}
}
}
@ -11220,6 +11123,11 @@
"is-promise": "^2.1.0"
}
},
"rx": {
"version": "4.1.0",
"resolved": "http://registry.npm.taobao.org/rx/download/rx-4.1.0.tgz",
"integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I="
},
"rx-lite": {
"version": "4.0.8",
"resolved": "http://registry.npm.taobao.org/rx-lite/download/rx-lite-4.0.8.tgz",
@ -11538,9 +11446,9 @@
"integrity": "sha1-eQp89v6lRZuslhELKbYEEtyP+Ws="
},
"send": {
"version": "0.16.2",
"resolved": "https://registry.npm.taobao.org/send/download/send-0.16.2.tgz",
"integrity": "sha1-bsyh4PjBVtFBWXVZhI32RzCmu8E=",
"version": "0.17.0",
"resolved": "https://registry.npm.taobao.org/send/download/send-0.17.0.tgz",
"integrity": "sha1-bRkL6q8Ixc9+Ml3tAk8afNk07Zo=",
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
@ -11549,23 +11457,23 @@
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.6.2",
"mime": "1.4.1",
"ms": "2.0.0",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.0",
"statuses": "~1.4.0"
"statuses": "~1.5.0"
},
"dependencies": {
"mime": {
"version": "1.4.1",
"resolved": "http://registry.npm.taobao.org/mime/download/mime-1.4.1.tgz",
"integrity": "sha1-Eh+evEnjdm8xGnbh+hyAA8SwOqY="
"ms": {
"version": "2.1.1",
"resolved": "http://registry.npm.taobao.org/ms/download/ms-2.1.1.tgz",
"integrity": "sha1-MKWGTrPrsKZvLr5tcnrwagnYbgo="
},
"statuses": {
"version": "1.4.0",
"resolved": "http://registry.npm.taobao.org/statuses/download/statuses-1.4.0.tgz",
"integrity": "sha1-u3PURtonlhBu/MG2AaJT1sRr0Ic="
"version": "1.5.0",
"resolved": "http://registry.npm.taobao.org/statuses/download/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
}
}
},
@ -11575,14 +11483,14 @@
"integrity": "sha1-ULZ51WNc34Rme9yOWa9OW4HV9go="
},
"serve-static": {
"version": "1.13.2",
"resolved": "http://registry.npm.taobao.org/serve-static/download/serve-static-1.13.2.tgz",
"integrity": "sha1-CV6Ecv1bRiN9tQzkhqQ/S4bGzsE=",
"version": "1.14.0",
"resolved": "https://registry.npm.taobao.org/serve-static/download/serve-static-1.14.0.tgz",
"integrity": "sha1-+tZ+nzbYxnC5P//QWGr+Y09siKU=",
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.2",
"send": "0.16.2"
"parseurl": "~1.3.3",
"send": "0.17.0"
}
},
"set-blocking": {
@ -11617,9 +11525,9 @@
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "http://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.0.tgz",
"integrity": "sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY="
"version": "1.1.1",
"resolved": "http://registry.npm.taobao.org/setprototypeof/download/setprototypeof-1.1.1.tgz",
"integrity": "sha1-fpWsskqpL1iF4KvvW6ExMw1K5oM="
},
"shebang-command": {
"version": "1.2.0",
@ -11665,21 +11573,6 @@
"plist": "^3.0.1"
}
},
"simple-swizzle": {
"version": "0.2.2",
"resolved": "http://registry.npm.taobao.org/simple-swizzle/download/simple-swizzle-0.2.2.tgz",
"integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=",
"requires": {
"is-arrayish": "^0.3.1"
},
"dependencies": {
"is-arrayish": {
"version": "0.3.2",
"resolved": "http://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.3.2.tgz",
"integrity": "sha1-RXSirlb3qyBolvtDHq7tBm/fjwM="
}
}
},
"sisteransi": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/sisteransi/download/sisteransi-1.0.0.tgz",
@ -12304,6 +12197,11 @@
}
}
},
"toidentifier": {
"version": "1.0.0",
"resolved": "http://registry.npm.taobao.org/toidentifier/download/toidentifier-1.0.0.tgz",
"integrity": "sha1-fhvjRw8ed5SLxD2Uo8j013UrpVM="
},
"tough-cookie": {
"version": "2.4.3",
"resolved": "http://registry.npm.taobao.org/tough-cookie/download/tough-cookie-2.4.3.tgz",

View file

@ -12,9 +12,9 @@
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-device-info": "^1.6.1",
"react-native-elements": "^1.1.0",
"react-native-elements": "^0.19.0",
"react-native-navigation": "^1.1.376",
"react-native-vector-icons": "^6.4.2"
"react-native-vector-icons": "^4.5.0"
},
"devDependencies": {
"@babel/core": "^7.4.3",

47
src/component/loading.js Normal file
View file

@ -0,0 +1,47 @@
import React, { Component } from 'react';
import { StyleSheet, Text, View, ActivityIndicator, Dimensions } from 'react-native';
const { width, height } = Dimensions.get('window')
export default class Loading extends Component {
constructor(props) {
super(props);
}
/*
show() {
this.setState({visible: true})
}
hide() {
this.setState({visible: false})
}
*/
render() {
if (this.props.visible) {
return (
<View style={styles.loading}>
<ActivityIndicator size="large" color="#aaa" />
</View>
);
} else {
return <View />
}
}
}
const styles = StyleSheet.create({
loading: {
position: "absolute",
left: 0,
top: 0,
width: width,
height: 400,
justifyContent: "center",
alignItems: "center"
}
});

View file

@ -1,10 +1,11 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, InteractionManager, Alert} from 'react-native';
import {Input, Button} from "react-native-elements";
import {FormInput, Button} from "react-native-elements";
import {Navigation} from 'react-native-navigation';
import Color from '../style/color'
import Api from '../util/api'
import BottomNav from '../nav/bottomNav'
export default class LoginForm extends Component {
@ -21,15 +22,13 @@ export default class LoginForm extends Component {
async login() {
let isLoginSucc, errMsg = '账号或密码不正确';
this.props.setLoading(true);
try {
isLoginSucc = await Api.login(this.state.username, this.state.password);
} catch (err) {
console.log(err);
errMsg = err.message;
}
this.props.setLoading(false);
return {
isLoginSucc,
errMsg
@ -39,12 +38,7 @@ export default class LoginForm extends Component {
_checkResult(result) {
InteractionManager.runAfterInteractions(() => {
if(result.isLoginSucc) {
Navigation.startSingleScreenApp({
screen: {
screen: 'Home',
title: 'Home Title',
}
});
Navigation.startTabBasedApp(BottomNav.config());
} else {
Alert.alert(
@ -56,11 +50,15 @@ export default class LoginForm extends Component {
{cancelable: false}
);
}
})
});
}
_clickLogin() {
this.login().then(this._checkResult);
this.props.setLoading(true);
this.login().then(result => {
this.props.setLoading(false);
this._checkResult(result);
});
}
_usernameSubmit() {
@ -73,10 +71,12 @@ export default class LoginForm extends Component {
render() {return (
<View>
<Text style={localStyle.title}>{'欢迎来到胶囊日记'}</Text>
<View style={localStyle.form}>
<Input ref="loginUsername"
<FormInput ref="loginUsername"
selectionColor={Color.primary}
underlineColorAndroid='transparent'
@ -95,7 +95,7 @@ export default class LoginForm extends Component {
onSubmitEditing={this._usernameSubmit.bind(this)}
/>
<Input ref="loginPw"
<FormInput ref="loginPw"
selectionColor={Color.primary}
underlineColorAndroid='transparent'

View file

@ -1,6 +1,6 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, InteractionManager, Alert} from 'react-native';
import {Input, Button} from "react-native-elements";
import {FormInput, Button} from "react-native-elements";
import {Navigation} from 'react-native-navigation';
import Color from '../style/color'
@ -69,7 +69,7 @@ export default class RegisterForm extends Component {
<Text style={localStyle.title}>{'注册胶囊日记账号'}</Text>
<View style={localStyle.form}>
<Input
<FormInput
selectionColor={Color.primary}
underlineColorAndroid='transparent'
@ -88,7 +88,7 @@ export default class RegisterForm extends Component {
onSubmitEditing={() => {}}
/>
<Input
<FormInput
selectionColor={Color.primary}
underlineColorAndroid='transparent'
@ -107,7 +107,7 @@ export default class RegisterForm extends Component {
onSubmitEditing={() => {}}
/>
<Input
<FormInput
selectionColor={Color.primary}
underlineColorAndroid='transparent'

113
src/nav/bottomNav.js Normal file
View file

@ -0,0 +1,113 @@
import Color from '../style/color'
import {Icon} from '../style/icon'
const insets = {
top: 6,
left: 0,
bottom: -6,
right: 0
};
function config() {
return {
tabs: [
{
// label: '首页',
screen: 'Home',
icon: Icon.homeIcon,
selectedIcon: Icon.homeSelectedIcon, // iOS only
title: '首页',
iconInsets: insets,
navigatorStyle: {
tabBarHidden: false,
}
},
{
// label: '关注',
screen: 'Follow',
icon: Icon.followIcon,
selectedIcon: Icon.followSelectedIcon, // iOS only
title: '关注',
iconInsets: insets,
navigatorStyle: {
tabBarHidden: false,
}
},
{
// label: '写日记',
screen: 'Write',
icon: Icon.writeIcon,
selectedIcon: Icon.writeSelectedIcon, // iOS only
title: '写日记',
iconInsets: insets,
overrideBackPress: true,
navigatorStyle: {
tabBarHidden: true,
},
passProps: {
tabOpen: true,
}
},
{
// label: '提醒',
screen: 'Notification',
icon: Icon.tipIcon,
selectedIcon: Icon.tipSelectedIcon, // iOS only
title: '提醒',
iconInsets: insets,
navigatorStyle: {
tabBarHidden: false,
}
},
{
// label: '我的',
screen: 'User',
icon: Icon.myIcon,
selectedIcon: Icon.mySelectIcon, // iOS only
title: '我的',
iconInsets: insets,
navigatorStyle: {
tabBarHidden: false,
},
passProps: {
isMyself: true,
tabOpen: true,
}
}
],
tabsStyle: {
tabBarHidden: true,
tabBarSelectedButtonColor: Color.primary,
navBarTranslucent: false,
statusBarTextColorScheme: 'dark',
drawUnderNavBar: true,
initialTabIndex: 0,
},
appStyle: {
tabBarHidden: true,
tabBarBackgroundColor: Color.navBackground,
tabBarButtonColor: '#999',
tabBarSelectedButtonColor: Color.primary,
navBarTranslucent: false,
navBarBackgroundColor: Color.navBackground,
navigationBarColor: Color.navBackground,
statusBarTextColorScheme: 'dark',
statusBarColor: Color.navBackground,
keepStyleAcrossPush: false,
topBarBorderColor: '#ddd',
drawUnderStatusBar: false,
orientation: 'portrait',
initialTabIndex: 0,
},
animationType: 'fade'
}
}
export default {
config
}

33
src/page/FollowPage.js Normal file
View file

@ -0,0 +1,33 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
export default class FollowPage extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Follow Page !</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

View file

@ -0,0 +1,33 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
export default class NotifyPage extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Notify Page !</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

33
src/page/UserPage.js Normal file
View file

@ -0,0 +1,33 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
export default class UserPage extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>User Page !</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

33
src/page/WritePage.js Normal file
View file

@ -0,0 +1,33 @@
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
export default class WritePage extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Write Page !</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

View file

@ -1,3 +1,7 @@
export default {
Home: require("./HomePage.js").default
Follow: require("./FollowPage.js").default,
Home: require("./HomePage.js").default,
Notification: require("./NotificationPage.js").default,
User: require("./UserPage.js").default,
Write: require("./WritePage.js").default
}

85
src/style/icon.js Normal file
View file

@ -0,0 +1,85 @@
import Ionicons from "react-native-vector-icons/Ionicons";
import {Platform} from "react-native";
let Icon = {
homeIcon : null,
homeSelectedIcon: null,
followIcon: null,
followSelectedIcon: null,
writeIcon: null,
writeSelectedIcon: null,
tipIcon: null,
tipSelectedIcon: null,
myIcon: null,
mySelectIcon: null,
navButtonSave: null,
navButtonClose: null,
navButtonFollow: null,
navButtonFollowSelected: null,
navButtonMore: null,
navButtonSetting: null,
navButtonNotebookSetting: null,
navButtonWrite: null,
navButtonBack: null,
navButtonOpen: null,
navButtonTime: null
};
const outline = Platform.OS === 'ios' ? '-outline' : '';
const iconColor = '#333333';
async function loadIcon() {
let localIcons = await Promise.all([
Ionicons.getImageSource('ios-home' + outline, 26),
Ionicons.getImageSource('ios-home', 26),
Ionicons.getImageSource('ios-heart' + outline, 26),
Ionicons.getImageSource('ios-heart', 26),
Ionicons.getImageSource('ios-create' + outline, 26),
Ionicons.getImageSource('ios-create', 26),
Ionicons.getImageSource('ios-notifications' + outline, 26),
Ionicons.getImageSource('ios-notifications', 26),
Ionicons.getImageSource('ios-contact' + outline, 26),
Ionicons.getImageSource('ios-contact', 26),
Ionicons.getImageSource('md-checkmark', 28, iconColor),
Ionicons.getImageSource('md-close', 28, iconColor),
Ionicons.getImageSource('ios-heart-outline', 26, iconColor),
Ionicons.getImageSource('ios-heart', 26, "#d9534f"),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-more' : 'md-more', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-settings' : 'md-settings', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-switch' : 'ios-switch', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-create-outline' : 'ios-create', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'md-arrow-back' : 'md-arrow-back', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'ios-open-outline' : 'md-open', 26, iconColor),
Ionicons.getImageSource(Platform.OS === 'ios' ? 'md-time' : 'md-time', 26, iconColor),
]);
let index = 0;
for(let name in Icon) {
Icon[name] = localIcons[index];
index++;
}
}
export {
Icon,
loadIcon
}