├── .watchmanconfig ├── .gitattributes ├── utils ├── store.ts ├── config.ts ├── interface.ts └── fetch.ts ├── app.json ├── .babelrc ├── assets ├── id-card.png └── fingerprint-scanning.png ├── android ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ └── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── assets │ │ │ └── fonts │ │ │ │ ├── Entypo.ttf │ │ │ │ ├── Zocial.ttf │ │ │ │ ├── AntDesign.ttf │ │ │ │ ├── EvilIcons.ttf │ │ │ │ ├── Feather.ttf │ │ │ │ ├── Ionicons.ttf │ │ │ │ ├── Octicons.ttf │ │ │ │ ├── FontAwesome.ttf │ │ │ │ ├── Foundation.ttf │ │ │ │ ├── MaterialIcons.ttf │ │ │ │ ├── SimpleLineIcons.ttf │ │ │ │ ├── FontAwesome5_Brands.ttf │ │ │ │ ├── FontAwesome5_Solid.ttf │ │ │ │ ├── FontAwesome5_Regular.ttf │ │ │ │ └── MaterialCommunityIcons.ttf │ │ │ ├── java │ │ │ └── com │ │ │ │ └── validator │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── AndroidManifest.xml │ ├── proguard-rules.pro │ ├── BUCK │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── keystores │ ├── debug.keystore.properties │ └── BUCK ├── gradle.properties ├── settings.gradle ├── build.gradle ├── gradlew.bat └── gradlew ├── ios ├── Validator │ ├── Images.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── app-icon@20x3.png │ │ │ ├── app-icon@29x2.png │ │ │ ├── app-icon@29x3.png │ │ │ ├── app-icon@40x1.png │ │ │ ├── app-icon@40x2.png │ │ │ ├── app-icon@40x3.png │ │ │ ├── app-icon@60x3.png │ │ │ ├── app-icon@1024x1.png │ │ │ ├── app-icon@40x3-1.png │ │ │ ├── app-icon-iTunesArtwork.png │ │ │ └── Contents.json │ │ ├── app-icon@40x3.imageset │ │ │ ├── app-icon@40x3.png │ │ │ └── Contents.json │ │ └── app-icon-iTunesArtwork-1.imageset │ │ │ └── Contents.json │ ├── AppDelegate.h │ ├── main.m │ ├── AppDelegate.m │ ├── Info.plist │ └── Base.lproj │ │ └── LaunchScreen.xib ├── ValidatorTests │ ├── Info.plist │ └── ValidatorTests.m ├── Validator-tvOSTests │ └── Info.plist ├── Validator-tvOS │ └── Info.plist └── Validator.xcodeproj │ ├── xcshareddata │ └── xcschemes │ │ ├── Validator.xcscheme │ │ └── Validator-tvOS.xcscheme │ └── project.pbxproj ├── theme.ts ├── .buckconfig ├── index.js ├── rn-cli.config.js ├── tsconfig.json ├── screens ├── ConfirmStack │ ├── ConfirmSuccess │ │ └── index.tsx │ └── InputInfo │ │ └── index.tsx ├── MainStack │ ├── AuthLoading │ │ └── index.tsx │ └── Home │ │ ├── Record │ │ └── index.tsx │ │ ├── Auth │ │ └── index.tsx │ │ ├── QRcode │ │ └── index.tsx │ │ └── index.tsx └── AuthStack │ ├── SignIn │ └── index.tsx │ └── SignUp │ └── index.tsx ├── components ├── Form │ └── Form.tsx ├── Container.tsx ├── Title.tsx └── MyImagePicker.tsx ├── .gitignore ├── package.json ├── App.tsx └── .flowconfig /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /utils/store.ts: -------------------------------------------------------------------------------- 1 | export const state = { 2 | user: null, 3 | }; 4 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Validator", 3 | "displayName": "铁旅ID" 4 | } -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["module:metro-react-native-babel-preset"] 3 | } 4 | -------------------------------------------------------------------------------- /assets/id-card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/assets/id-card.png -------------------------------------------------------------------------------- /utils/config.ts: -------------------------------------------------------------------------------- 1 | export const TOKEN_LABEL = 'token'; 2 | export const PRIVATE_KEY_LABEL = 'privateKey' -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Validator 3 | 4 | -------------------------------------------------------------------------------- /assets/fingerprint-scanning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/assets/fingerprint-scanning.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /theme.ts: -------------------------------------------------------------------------------- 1 | export const color = { 2 | primary: '#FF8C8A', 3 | info:'#c0c4cc' 4 | }; 5 | 6 | export const fontFamily = 'Verdana'; 7 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Entypo.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Zocial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Zocial.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/AntDesign.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/AntDesign.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/EvilIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/EvilIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Feather.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Feather.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Ionicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Octicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Octicons.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/FontAwesome.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/Foundation.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/Foundation.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/MaterialIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/SimpleLineIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/SimpleLineIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@20x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@20x3.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@29x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@29x2.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@29x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@29x3.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x1.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x2.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x3.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@60x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@60x3.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@1024x1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@1024x1.png -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon@40x3-1.png -------------------------------------------------------------------------------- /android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/app-icon@40x3.imageset/app-icon@40x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/app-icon@40x3.imageset/app-icon@40x3.png -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** @format */ 2 | 3 | import {AppRegistry} from 'react-native'; 4 | import App from './App'; 5 | import {name as appName} from './app.json'; 6 | 7 | AppRegistry.registerComponent(appName, () => App); 8 | -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon-iTunesArtwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/myWsq/validator-react-native/HEAD/ios/Validator/Images.xcassets/AppIcon.appiconset/app-icon-iTunesArtwork.png -------------------------------------------------------------------------------- /rn-cli.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | getTransformModulePath() { 3 | return require.resolve('react-native-typescript-transformer'); 4 | }, 5 | getSourceExts() { 6 | return [ 7 | 'ts', 8 | 'tsx', 9 | ]; 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 6 | -------------------------------------------------------------------------------- /utils/interface.ts: -------------------------------------------------------------------------------- 1 | export enum ResponseCode { 2 | SUCCESS = 0, 3 | USERNAME_EXIST = 1, 4 | USERNAME_NOT_EXIST = 2, 5 | INVALID_PASSWORD = 3, 6 | } 7 | 8 | export interface Response { 9 | code: ResponseCode; 10 | data?: any; 11 | message?: any; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/app-icon@40x3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "app-icon@40x3.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "jsx": "react", 5 | "noEmit": true, 6 | "moduleResolution": "node", 7 | "importHelpers": true, 8 | "allowSyntheticDefaultImports": true 9 | }, 10 | "exclude": [ 11 | "node_modules", 12 | ] 13 | } -------------------------------------------------------------------------------- /ios/Validator/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/app-icon-iTunesArtwork-1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x" 14 | } 15 | ], 16 | "info" : { 17 | "version" : 1, 18 | "author" : "xcode" 19 | } 20 | } -------------------------------------------------------------------------------- /ios/Validator/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/validator/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.validator; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "Validator"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /screens/ConfirmStack/ConfirmSuccess/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import Container from '../../../components/Container'; 3 | 4 | export interface ConfirmSuccessProps { 5 | } 6 | 7 | export interface ConfirmSuccessState { 8 | } 9 | 10 | export default class ConfirmSuccess extends React.Component { 11 | constructor(props: ConfirmSuccessProps) { 12 | super(props); 13 | 14 | this.state = { 15 | } 16 | } 17 | 18 | public render() { 19 | return ( 20 | 21 | 22 | 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /components/Form/Form.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { SafeAreaView } from 'react-native'; 3 | 4 | export interface FormProps {} 5 | 6 | export interface FormState {} 7 | 8 | export default class Form extends React.Component { 9 | constructor(props: FormProps) { 10 | super(props); 11 | 12 | this.state = {}; 13 | } 14 | 15 | public render() { 16 | return 17 | {this.props.children} 18 | 19 | } 20 | } 21 | 22 | const style = { 23 | container: { 24 | marginLeft: -20, 25 | marginRight: -20, 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /components/Container.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { SafeAreaView, StyleProp, ViewStyle } from 'react-native'; 3 | 4 | export interface ContainerProps { 5 | style?: StyleProp; 6 | } 7 | 8 | export interface ContainerState {} 9 | 10 | export default class Container extends React.Component { 11 | constructor(props: ContainerProps) { 12 | super(props); 13 | 14 | this.state = {}; 15 | } 16 | public render() { 17 | return ( 18 | 19 | {this.props.children} 20 | 21 | ); 22 | } 23 | } 24 | 25 | const styles = { 26 | container: { 27 | marginLeft: 20, 28 | marginRight: 20, 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /ios/ValidatorTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/Validator-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /components/Title.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { View } from 'react-native'; 3 | import { Text } from 'react-native-elements'; 4 | import { fontFamily, color } from '../theme'; 5 | 6 | export interface TitleProps {} 7 | 8 | export interface TitleState {} 9 | 10 | export default class Title extends React.Component { 11 | constructor(props: TitleProps) { 12 | super(props); 13 | 14 | this.state = {}; 15 | } 16 | 17 | public render() { 18 | return ( 19 | 20 | {this.props.children} 21 | 22 | 23 | ); 24 | } 25 | } 26 | 27 | const styles = { 28 | title: { 29 | fontFamily: fontFamily, 30 | fontSize: 30, 31 | marginTop: 50, 32 | }, 33 | line: { 34 | height: 3, 35 | width: 40, 36 | marginTop: 10, 37 | marginBottom: 20, 38 | backgroundColor: color.primary, 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Validator' 2 | include ':react-native-rsa-native' 3 | project(':react-native-rsa-native').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-rsa-native/android') 4 | include ':react-native-touch-id' 5 | project(':react-native-touch-id').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-touch-id/android') 6 | include ':react-native-spinkit' 7 | project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android') 8 | include ':react-native-image-picker' 9 | project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android') 10 | include ':react-native-gesture-handler' 11 | project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') 12 | include ':react-native-vector-icons' 13 | project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') 14 | 15 | include ':app' 16 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "27.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 27 8 | targetSdkVersion = 26 9 | supportLibVersion = "27.1.1" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.1.4' 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | // Add jitpack repository (added by react-native-spinkit) 26 | maven { url "https://jitpack.io" } 27 | mavenLocal() 28 | google() 29 | jcenter() 30 | maven { 31 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 32 | url "$rootDir/../node_modules/react-native/android" 33 | } 34 | } 35 | } 36 | 37 | 38 | task wrapper(type: Wrapper) { 39 | gradleVersion = '4.4' 40 | distributionUrl = distributionUrl.replace("bin", "all") 41 | } 42 | -------------------------------------------------------------------------------- /utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import { AsyncStorage } from 'react-native'; 2 | import { TOKEN_LABEL } from './config'; 3 | import { stringify } from 'query-string'; 4 | export const BASE_URL = 'http://sxyori.com:3003'; 5 | 6 | /** 包装请求头 */ 7 | const getHeader = async () => { 8 | /** 获得储存在本地的token */ 9 | const token = await AsyncStorage.getItem(TOKEN_LABEL); 10 | /** 拼装鉴权头 */ 11 | const authorization = token ? `JWT ${token}` : ''; 12 | 13 | const header = new Headers({ 14 | Accept: 'application/json', 15 | 'Content-Type': 'application/json', 16 | }); 17 | if (token) { 18 | header.append('Authorization', authorization); 19 | } 20 | return header; 21 | }; 22 | 23 | export const get = async ( 24 | url: string, 25 | query?: { 26 | [key: string]: any; 27 | } 28 | ) => { 29 | let fullUrl = BASE_URL + url; 30 | if (query) { 31 | fullUrl += `?${stringify(query)}`; 32 | } 33 | return fetch(fullUrl, { 34 | method: 'GET', 35 | headers: await getHeader(), 36 | }); 37 | }; 38 | 39 | export const post = async ( 40 | url: string, 41 | body?: any, 42 | query?: { 43 | [key: string]: any; 44 | } 45 | ) => { 46 | let fullUrl = BASE_URL + url; 47 | if (query) { 48 | fullUrl += `?${stringify(query)}`; 49 | } 50 | return fetch(fullUrl, { 51 | method: 'POST', 52 | headers: await getHeader(), 53 | body: JSON.stringify(body), 54 | }); 55 | }; 56 | -------------------------------------------------------------------------------- /ios/Validator/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | NSURL *jsCodeLocation; 18 | 19 | #ifdef DEBUG 20 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 21 | #else 22 | jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 23 | #endif 24 | 25 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 26 | moduleName:@"Validator" 27 | initialProperties:nil 28 | launchOptions:launchOptions]; 29 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 30 | 31 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 32 | UIViewController *rootViewController = [UIViewController new]; 33 | rootViewController.view = rootView; 34 | self.window.rootViewController = rootViewController; 35 | [self.window makeKeyAndVisible]; 36 | return YES; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Validator", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "@types/query-string": "^6.1.1", 11 | "qrcode.react": "^0.8.0", 12 | "query-string": "^6.2.0", 13 | "react": "16.6.3", 14 | "react-native": "0.57.8", 15 | "react-native-elements": "^0.19.1", 16 | "react-native-gesture-handler": "^1.0.12", 17 | "react-native-image-picker": "^0.27.2", 18 | "react-native-qrcode": "^0.2.7", 19 | "react-native-rsa-native": "^1.0.24", 20 | "react-native-spinkit": "^1.1.1", 21 | "react-native-touch-id": "^4.3.0", 22 | "react-native-vector-icons": "^6.1.0", 23 | "react-navigation": "^3.0.8", 24 | "styled-components": "^4.1.3", 25 | "tslib": "^1.9.3", 26 | "validator": "^10.9.0" 27 | }, 28 | "devDependencies": { 29 | "@types/qrcode.react": "^0.8.1", 30 | "@types/react": "^16.7.17", 31 | "@types/react-native": "^0.57.18", 32 | "@types/react-native-elements": "^0.18.0", 33 | "@types/react-native-touch-id": "^4.0.1", 34 | "@types/react-navigation": "^2.13.8", 35 | "@types/styled-components": "^4.1.4", 36 | "@types/validator": "^9.4.4", 37 | "babel-jest": "23.6.0", 38 | "jest": "23.6.0", 39 | "metro-react-native-babel-preset": "0.48.5", 40 | "react-native-typescript-transformer": "^1.2.10", 41 | "react-test-renderer": "16.6.3", 42 | "typescript": "^3.2.2" 43 | }, 44 | "jest": { 45 | "preset": "react-native" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /ios/Validator/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "app-icon@40x1.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "app-icon@20x3.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "app-icon@29x2.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "app-icon@29x3.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "app-icon@40x2.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "app-icon@40x3.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "app-icon@40x3-1.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "app-icon@60x3.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "1024x1024", 53 | "idiom" : "ios-marketing", 54 | "filename" : "app-icon-iTunesArtwork.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "1024x1024", 59 | "idiom" : "ios-marketing", 60 | "filename" : "app-icon@1024x1.png", 61 | "scale" : "1x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /screens/MainStack/AuthLoading/index.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * App用户身份认证时的Loading页面 3 | * @author wsq 4 | */ 5 | 6 | import * as React from 'react'; 7 | import { View, AsyncStorage } from 'react-native'; 8 | import { Text } from 'react-native-elements'; 9 | import { NavigationScreenProps } from 'react-navigation'; 10 | import { get } from '../../../utils/fetch'; 11 | import { Response, ResponseCode } from '../../../utils/interface'; 12 | import { state } from '../../../utils/store'; 13 | import { PRIVATE_KEY_LABEL } from '../../../utils/config'; 14 | export interface AuthLoadingProps extends NavigationScreenProps {} 15 | 16 | export interface AuthLoadingState {} 17 | 18 | export default class AuthLoading extends React.Component { 19 | constructor(props: AuthLoadingProps) { 20 | super(props); 21 | this.state = {}; 22 | /** 检测用户登录状态 */ 23 | this._bootstrap(); 24 | } 25 | _bootstrap = async () => { 26 | try { 27 | const res = await get('/auth'); 28 | const data = (await res.json()) as Response; 29 | /** 将用户信息放入中心仓库中 */ 30 | if (data.code === ResponseCode.SUCCESS) { 31 | state.user = data.data; 32 | /** 判断用户是否认证完毕 */ 33 | this.props.navigation.navigate( 34 | state.user.publicKey && (await AsyncStorage.getItem(PRIVATE_KEY_LABEL)) ? 'Main' : 'Confirm' 35 | ); 36 | } else { 37 | /** 认证失败, 跳转至鉴权界面 */ 38 | this.props.navigation.navigate('Auth'); 39 | } 40 | } catch (e) { 41 | /** 认证失败, 跳转至鉴权界面 */ 42 | this.props.navigation.navigate('Auth'); 43 | } 44 | }; 45 | 46 | public render() { 47 | return ( 48 | 49 | Loading... 50 | 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/validator/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.validator; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.RNRSA.RNRSAPackage; 7 | import com.rnfingerprint.FingerprintAuthPackage; 8 | import com.react.rnspinkit.RNSpinkitPackage; 9 | import com.imagepicker.ImagePickerPackage; 10 | import com.swmansion.gesturehandler.react.RNGestureHandlerPackage; 11 | import com.oblador.vectoricons.VectorIconsPackage; 12 | import com.facebook.react.ReactNativeHost; 13 | import com.facebook.react.ReactPackage; 14 | import com.facebook.react.shell.MainReactPackage; 15 | import com.facebook.soloader.SoLoader; 16 | 17 | import java.util.Arrays; 18 | import java.util.List; 19 | 20 | public class MainApplication extends Application implements ReactApplication { 21 | 22 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 23 | @Override 24 | public boolean getUseDeveloperSupport() { 25 | return BuildConfig.DEBUG; 26 | } 27 | 28 | @Override 29 | protected List getPackages() { 30 | return Arrays.asList( 31 | new MainReactPackage(), 32 | new RNRSAPackage(), 33 | new FingerprintAuthPackage(), 34 | new RNSpinkitPackage(), 35 | new ImagePickerPackage(), 36 | new RNGestureHandlerPackage(), 37 | new VectorIconsPackage() 38 | ); 39 | } 40 | 41 | @Override 42 | protected String getJSMainModuleName() { 43 | return "index"; 44 | } 45 | }; 46 | 47 | @Override 48 | public ReactNativeHost getReactNativeHost() { 49 | return mReactNativeHost; 50 | } 51 | 52 | @Override 53 | public void onCreate() { 54 | super.onCreate(); 55 | SoLoader.init(this, /* native exopackage */ false); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ios/Validator-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.validator", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.validator", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /App.tsx: -------------------------------------------------------------------------------- 1 | import { createStackNavigator, createNavigationContainer, createSwitchNavigator } from 'react-navigation'; 2 | import SignUp from './screens/AuthStack/SignUp'; 3 | import SignIn from './screens/AuthStack/SignIn'; 4 | import AuthLoading from './screens/MainStack/AuthLoading'; 5 | import InputInfo from './screens/ConfirmStack/InputInfo'; 6 | import ConfirmSuccess from './screens/ConfirmStack/ConfirmSuccess'; 7 | import Home from './screens/MainStack/Home'; 8 | import QRcode from './screens/MainStack/Home/QRcode'; 9 | import AuthScreen from './screens/MainStack/Home/Auth'; 10 | import RecordScreen from './screens/MainStack/Home/Record'; 11 | 12 | const MainStack = createStackNavigator( 13 | { 14 | Home: { 15 | screen: Home, 16 | navigationOptions: () => ({ 17 | title: `首页`, 18 | }), 19 | }, 20 | QRcode: { 21 | screen: QRcode, 22 | navigationOptions: () => ({ 23 | title: `我的身份二维码`, 24 | }), 25 | }, 26 | AuthScreen: { 27 | screen: AuthScreen, 28 | navigationOptions: () => ({ 29 | title: `授权请求`, 30 | }), 31 | }, 32 | RecordScreen: { 33 | screen: RecordScreen, 34 | navigationOptions: () => ({ 35 | title: `认证记录`, 36 | }), 37 | }, 38 | }, 39 | { 40 | headerTransitionPreset: 'fade-in-place', 41 | } 42 | ); 43 | 44 | const AuthStack = createStackNavigator( 45 | { 46 | SignUp, 47 | SignIn, 48 | }, 49 | { 50 | initialRouteName: 'SignIn', 51 | headerMode: 'none', 52 | } 53 | ); 54 | 55 | const ConfirmStack = createSwitchNavigator( 56 | { 57 | InputInfo, 58 | ConfirmSuccess, 59 | }, 60 | { 61 | initialRouteName: 'InputInfo', 62 | } 63 | ); 64 | 65 | const RootStack = createSwitchNavigator( 66 | { 67 | AuthLoading, 68 | Main: MainStack, 69 | Auth: AuthStack, 70 | Confirm: ConfirmStack, 71 | }, 72 | { 73 | initialRouteName: 'AuthLoading', 74 | } 75 | ); 76 | 77 | export default createNavigationContainer(RootStack); 78 | -------------------------------------------------------------------------------- /ios/ValidatorTests/ValidatorTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface ValidatorTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ValidatorTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /components/MyImagePicker.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { ImageSourcePropType, Image } from 'react-native'; 3 | import ImagePicker from 'react-native-image-picker'; 4 | import { color } from '../theme'; 5 | import styled from 'styled-components/native'; 6 | import Spinner from 'react-native-spinkit'; 7 | 8 | export interface MyImagePickerProps { 9 | image: ImageSourcePropType; 10 | onSubmit(uri: string): any; 11 | } 12 | 13 | export interface MyImagePickerState { 14 | loading: boolean; 15 | } 16 | 17 | export default class MyImagePicker extends React.Component { 18 | constructor(props: MyImagePickerProps) { 19 | super(props); 20 | 21 | this.state = { 22 | loading: false, 23 | }; 24 | } 25 | 26 | onSelect = () => { 27 | if (!this.state.loading) { 28 | this.setState({ 29 | loading: true, 30 | }); 31 | ImagePicker.showImagePicker( 32 | { 33 | title: '上传图片', 34 | cancelButtonTitle: '取消', 35 | takePhotoButtonTitle: '使用相机拍摄', 36 | chooseFromLibraryButtonTitle: '从相册选择', 37 | }, 38 | (res) => { 39 | if (res.uri) { 40 | this.props.onSubmit('data:image/jpeg;base64,' + res.data); 41 | } 42 | this.setState({ 43 | loading: false, 44 | }); 45 | } 46 | ); 47 | } 48 | }; 49 | 50 | public render() { 51 | return ( 52 | 53 | {this.props.image && } 54 | {this.state.loading && ( 55 | 56 | )} 57 | {!this.props.image && 58 | !this.state.loading && ( 59 | 60 | 61 | 62 | )} 63 | 64 | ); 65 | } 66 | } 67 | 68 | const Container = styled.TouchableOpacity` 69 | position: relative; 70 | height: 200px; 71 | margin: 20px; 72 | display: flex; 73 | justify-content: center; 74 | align-items: center; 75 | `; 76 | 77 | const FinalImage = styled.Image` 78 | position: absolute; 79 | top: 0; 80 | left: 0; 81 | right: 0; 82 | bottom: 0; 83 | `; 84 | 85 | const TapArea = styled.View` 86 | position: absolute; 87 | top: 0; 88 | left: 0; 89 | right: 0; 90 | bottom: 0; 91 | display: flex; 92 | flex-direction: column; 93 | justify-content: center; 94 | align-items: center; 95 | `; 96 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | esproposal.optional_chaining=enable 33 | esproposal.nullish_coalescing=enable 34 | 35 | module.system=haste 36 | module.system.haste.use_name_reducers=true 37 | # get basename 38 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 39 | # strip .js or .js.flow suffix 40 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 41 | # strip .ios suffix 42 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 44 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 45 | module.system.haste.paths.blacklist=.*/__tests__/.* 46 | module.system.haste.paths.blacklist=.*/__mocks__/.* 47 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 48 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 49 | 50 | munge_underscores=true 51 | 52 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 53 | 54 | module.file_ext=.js 55 | module.file_ext=.jsx 56 | module.file_ext=.json 57 | module.file_ext=.native.js 58 | 59 | suppress_type=$FlowIssue 60 | suppress_type=$FlowFixMe 61 | suppress_type=$FlowFixMeProps 62 | suppress_type=$FlowFixMeState 63 | 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 67 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 68 | 69 | [version] 70 | ^0.78.0 71 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /screens/MainStack/Home/Record/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { NavigationScreenProps } from 'react-navigation'; 3 | import Container from '../../../../components/Container'; 4 | import styled from 'styled-components/native'; 5 | import { Divider, Text } from 'react-native-elements'; 6 | import { color } from '../../../../theme'; 7 | import { ScrollView } from 'react-native'; 8 | import TouchID from 'react-native-touch-id'; 9 | 10 | export interface RecordScreenProps extends NavigationScreenProps {} 11 | 12 | export interface RecordScreenState { 13 | isAuth: boolean; 14 | } 15 | 16 | export default class RecordScreen extends React.Component { 17 | constructor(props: RecordScreenProps) { 18 | super(props); 19 | 20 | this.state = { 21 | isAuth: false, 22 | }; 23 | } 24 | 25 | public render() { 26 | return ( 27 | 28 | {this.state.isAuth && ( 29 | 30 | 出示身份二维码 31 | 时间: 2018/8/21 上午 9:40:50 32 | 33 | 来自 12306 的授权请求 34 | 原因: 购买 G83 北京西 9∶00 长沙南 14∶40 二等座车票 35 | 时间: 2018/9/18 下午 5:13:45 36 | 37 | 出示身份二维码 38 | 时间: 2018/9/20 上午 10:50:18 39 | 40 | 来自 12306 的授权请求 41 | 原因: 购买 G86 北京西 14∶00 长沙南 21∶30 二等座车票 42 | 时间: 2018/10/1 下午 6:20:57 43 | 44 | 出示身份二维码 45 | 时间: 2018/10/2 下午 1:35:40 46 | 47 | 48 | 没有更多记录了 49 | 50 | 51 | )} 52 | 53 | ); 54 | } 55 | 56 | async componentWillMount() { 57 | /** 用户点击生成二维码按钮 */ 58 | 59 | try { 60 | const isAuthenticate = await TouchID.authenticate('请进行生物认证', { 61 | color: color.primary, 62 | fallbackTitle: '', 63 | }); 64 | if (!isAuthenticate) { 65 | this.props.navigation.goBack(); 66 | } else { 67 | this.setState({ 68 | isAuth: true, 69 | }); 70 | } 71 | } catch (error) { 72 | this.props.navigation.goBack(); 73 | } 74 | } 75 | } 76 | 77 | const MyTitle = styled.Text` 78 | font-size: 20; 79 | font-weight: 500; 80 | margin-top: 20; 81 | margin-bottom: 20; 82 | `; 83 | 84 | const MyText = styled.Text` 85 | font-size: 16; 86 | line-height: 25; 87 | margin-bottom: 20; 88 | color: #555; 89 | `; 90 | -------------------------------------------------------------------------------- /screens/MainStack/Home/Auth/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { NavigationScreenProps } from 'react-navigation'; 3 | import Container from '../../../../components/Container'; 4 | import Title from '../../../../components/Title'; 5 | import { Text, Button } from 'react-native-elements'; 6 | import { View, Alert } from 'react-native'; 7 | import { color } from '../../../../theme'; 8 | import styled from 'styled-components/native'; 9 | import TouchID from 'react-native-touch-id'; 10 | 11 | export interface AuthScreenProps extends NavigationScreenProps {} 12 | 13 | export interface AuthScreenState {} 14 | 15 | export default class AuthScreen extends React.Component { 16 | constructor(props: AuthScreenProps) { 17 | super(props); 18 | 19 | this.state = {}; 20 | } 21 | 22 | onSubmit = async () => { 23 | try { 24 | const isAuthenticate = await TouchID.authenticate('请进行生物认证', { 25 | color: color.primary, 26 | fallbackTitle: '', 27 | }); 28 | if (isAuthenticate) { 29 | Alert.alert('成功', '您已授权成功', [ 30 | { 31 | text: 'OK', 32 | onPress: () => { 33 | this.props.navigation.goBack(); 34 | }, 35 | }, 36 | ]); 37 | } 38 | } catch (error) { 39 | Alert.alert('失败', '请进行生物认证'); 40 | } 41 | }; 42 | 43 | onCancel = () => { 44 | this.props.navigation.goBack(); 45 | }; 46 | 47 | public render() { 48 | return ( 49 | 50 | 来自 12306 51 | 60 | 61 | 授权原因 62 | 购买 G83 北京西 9∶00 长沙南 14∶40 二等座车票 63 | 授权时间 64 | {new Date().toLocaleString()} 65 | 66 | 67 |