├── 36627.jpg ├── Chapter_5 ├── App.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── shudan │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── logo.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── logo.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ ├── local.properties │ └── settings.gradle ├── app.json ├── app │ ├── common │ │ ├── CommonStyle.js │ │ └── Constant.js │ ├── component │ │ └── BaseComponent.js │ ├── img │ │ ├── default.png │ │ ├── default_icon@2x.png │ │ ├── default_icon@3x.png │ │ ├── drawer_arrow@2x.png │ │ ├── drawer_arrow@3x.png │ │ ├── drawer_icon1@2x.png │ │ ├── drawer_icon1@3x.png │ │ ├── drawer_icon2@2x.png │ │ ├── drawer_icon2@3x.png │ │ ├── drawer_icon3@2x.png │ │ ├── drawer_icon3@3x.png │ │ ├── home_unselect@2x.png │ │ ├── home_unselect@3x.png │ │ ├── icon1@2x.png │ │ ├── icon1@3x.png │ │ ├── icon2@2x.png │ │ ├── icon2@3x.png │ │ ├── icon3@2x.png │ │ ├── icon3@3x.png │ │ ├── login_btn@2x.png │ │ ├── login_btn@3x.png │ │ ├── me_dianzan@2x.png │ │ ├── me_dianzan@3x.png │ │ ├── me_header@2x.png │ │ ├── me_header@3x.png │ │ ├── me_like@2x.png │ │ ├── me_like@3x.png │ │ ├── me_lingqu@2x.png │ │ ├── me_lingqu@3x.png │ │ ├── me_rect@2x.png │ │ ├── me_rect@3x.png │ │ ├── me_selected@2x.png │ │ ├── me_selected@3x.png │ │ ├── me_setting@2x.png │ │ ├── me_setting@3x.png │ │ ├── me_shoucang@2x.png │ │ ├── me_shoucang@3x.png │ │ ├── register_btn@2x.png │ │ ├── register_btn@3x.png │ │ ├── register_header@2x.png │ │ ├── register_header@3x.png │ │ ├── right_arrow.png │ │ ├── shudan_dianzan@2x.png │ │ ├── shudan_dianzan@3x.png │ │ ├── shudan_shoucang@2x.png │ │ ├── shudan_shoucang@3x.png │ │ ├── shudan_underline@2x.png │ │ ├── shudan_underline@3x.png │ │ ├── shudan_unshoucang@2x.png │ │ └── shudan_unshoucang@3x.png │ ├── navigate │ │ └── AppStack.js │ ├── util │ │ ├── AsyncStorageUtil.js │ │ ├── HttpUtil.js │ │ ├── StringUtil.js │ │ └── ToastUtil.js │ └── view │ │ ├── account │ │ └── MeView.js │ │ ├── drawer │ │ └── DrawerView.js │ │ ├── login │ │ ├── LoginView.js │ │ ├── RegisterView.js │ │ └── SplashView.js │ │ └── shudan │ │ ├── ShanDanListView.js │ │ ├── ShuDanDetailView.js │ │ └── ShuDanView.js ├── index.js ├── ios │ ├── ShuDan-tvOS │ │ └── Info.plist │ ├── ShuDan-tvOSTests │ │ └── Info.plist │ ├── ShuDan.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── ShuDan-tvOS.xcscheme │ │ │ └── ShuDan.xcscheme │ ├── ShuDan │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-20@2x.png │ │ │ │ ├── icon-20@3x.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ └── icon-60@3x.png │ │ │ ├── Contents.json │ │ │ └── logo.png │ │ ├── Info.plist │ │ └── main.m │ ├── ShuDanTests │ │ ├── Info.plist │ │ └── ShuDanTests.m │ └── bundle │ │ ├── assets │ │ └── app │ │ │ └── img │ │ │ ├── default.png │ │ │ ├── default_icon@2x.png │ │ │ ├── default_icon@3x.png │ │ │ ├── drawer_arrow@2x.png │ │ │ ├── drawer_arrow@3x.png │ │ │ ├── drawer_icon1@2x.png │ │ │ ├── drawer_icon1@3x.png │ │ │ ├── drawer_icon2@2x.png │ │ │ ├── drawer_icon2@3x.png │ │ │ ├── drawer_icon3@2x.png │ │ │ ├── drawer_icon3@3x.png │ │ │ ├── home_unselect@2x.png │ │ │ ├── home_unselect@3x.png │ │ │ ├── icon1@2x.png │ │ │ ├── icon1@3x.png │ │ │ ├── icon2@2x.png │ │ │ ├── icon2@3x.png │ │ │ ├── icon3@2x.png │ │ │ ├── icon3@3x.png │ │ │ ├── login_btn@2x.png │ │ │ ├── login_btn@3x.png │ │ │ ├── me_dianzan@2x.png │ │ │ ├── me_dianzan@3x.png │ │ │ ├── me_header@2x.png │ │ │ ├── me_header@3x.png │ │ │ ├── me_like@2x.png │ │ │ ├── me_like@3x.png │ │ │ ├── me_lingqu@2x.png │ │ │ ├── me_lingqu@3x.png │ │ │ ├── me_rect@2x.png │ │ │ ├── me_rect@3x.png │ │ │ ├── me_selected@2x.png │ │ │ ├── me_selected@3x.png │ │ │ ├── me_setting@2x.png │ │ │ ├── me_setting@3x.png │ │ │ ├── me_shoucang@2x.png │ │ │ ├── me_shoucang@3x.png │ │ │ ├── register_btn@2x.png │ │ │ ├── register_btn@3x.png │ │ │ ├── register_header@2x.png │ │ │ ├── register_header@3x.png │ │ │ ├── shudan_dianzan@2x.png │ │ │ ├── shudan_dianzan@3x.png │ │ │ ├── shudan_shoucang@2x.png │ │ │ ├── shudan_shoucang@3x.png │ │ │ ├── shudan_underline@2x.png │ │ │ └── shudan_underline@3x.png │ │ └── index.jsbundle.meta ├── package-lock.json ├── package.json ├── shudan.keystore └── yarn.lock ├── Chapter_6 ├── app.js ├── app.json ├── app.wxss ├── pages │ ├── container-base │ │ ├── container-base.js │ │ ├── container-base.json │ │ ├── container-base.wxml │ │ └── container-base.wxss │ ├── container-form │ │ ├── container-form.js │ │ ├── container-form.json │ │ ├── container-form.wxml │ │ └── container-form.wxss │ ├── container-map │ │ ├── container-map.js │ │ ├── container-map.json │ │ ├── container-map.wxml │ │ └── container-map.wxss │ ├── container-media │ │ ├── container-media.js │ │ ├── container-media.json │ │ ├── container-media.wxml │ │ └── container-media.wxss │ ├── container-scroll-view │ │ ├── container-scroll-view.js │ │ ├── container-scroll-view.json │ │ ├── container-scroll-view.wxml │ │ └── container-scroll-view.wxss │ ├── container-swiper │ │ ├── container-swiper.js │ │ ├── container-swiper.json │ │ ├── container-swiper.wxml │ │ └── container-swiper.wxss │ ├── container-view │ │ ├── container-view.js │ │ ├── container-view.json │ │ ├── container-view.wxml │ │ └── container-view.wxss │ ├── container-web-view │ │ ├── container-web-view.js │ │ ├── container-web-view.json │ │ ├── container-web-view.wxml │ │ └── container-web-view.wxss │ └── tab1 │ │ ├── tab1.js │ │ ├── tab1.json │ │ ├── tab1.wxml │ │ └── tab1.wxss └── project.config.json ├── Chapter_7 ├── app.js ├── app.json ├── app.wxss ├── config │ ├── api.js │ └── config.js ├── images │ ├── book.jpg │ ├── detail │ │ ├── ic_agree_2x.png │ │ ├── ic_favorite_normal_2x.png │ │ └── ic_favorite_selected_2x.png │ ├── logo.png │ ├── mine │ │ ├── bg_mine_hot_2x.png │ │ ├── btn_get_2x.png │ │ ├── ic_agree_2x.png │ │ ├── ic_collect_2x.png │ │ └── ic_favorite_2x.png │ ├── sign_in │ │ └── btn_sign_in_2x.png │ ├── sign_up │ │ ├── bg_avatar_2x.png │ │ └── btn_sign_up_2x.png │ └── tabbar │ │ ├── ic_home_normal_2x.png │ │ ├── ic_home_selected_2x.png │ │ ├── ic_mine_normal_2x.png │ │ └── ic_mine_selected_2x.png ├── pages │ ├── detail │ │ ├── detail.js │ │ ├── detail.json │ │ ├── detail.wxml │ │ └── detail.wxss │ ├── favorite │ │ ├── favorite.js │ │ ├── favorite.json │ │ ├── favorite.wxml │ │ └── favorite.wxss │ ├── home │ │ ├── home.js │ │ ├── home.json │ │ ├── home.wxml │ │ └── home.wxss │ ├── mine │ │ ├── mine.js │ │ ├── mine.json │ │ ├── mine.wxml │ │ └── mine.wxss │ ├── settings │ │ ├── settings.js │ │ ├── settings.wxml │ │ └── settings.wxss │ ├── sign-in │ │ ├── sign-in.js │ │ ├── sign-in.json │ │ ├── sign-in.wxml │ │ └── sign-in.wxss │ └── sign-up │ │ ├── sign-up.js │ │ ├── sign-up.json │ │ ├── sign-up.wxml │ │ └── sign-up.wxss ├── project.config.json ├── sitemap.json └── utils │ ├── data.js │ ├── date.js │ └── money.js ├── Chapter_9 ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── yugangtalk │ │ │ │ └── read │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── icon_logo.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── images │ ├── icon_arrow_right.png │ ├── icon_collection.png │ ├── icon_home.png │ ├── icon_home_default.png │ ├── icon_love.png │ ├── icon_love_card.png │ ├── icon_my.png │ ├── icon_my_default.png │ ├── icon_praise.png │ ├── icon_setting.png │ ├── icon_star.png │ ├── icon_star_checked.png │ ├── icon_star_default.png │ ├── icon_user.png │ ├── img_bg.png │ ├── img_book_card.png │ ├── img_book_yskf.jpg │ ├── img_card.png │ ├── img_header.jpeg │ ├── img_login.png │ └── img_register.png ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── icon_logo58.png │ │ │ └── icon_logo87.png │ │ ├── Contents.json │ │ ├── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── main.m ├── lib │ ├── api │ │ ├── Api.dart │ │ └── NetUtils.dart │ ├── common │ │ ├── ColorsUtil.dart │ │ ├── DbProvider.dart │ │ └── DialogUtils.dart │ ├── main.dart │ ├── models │ │ ├── Book.dart │ │ ├── BookTab.dart │ │ ├── Comment.dart │ │ └── Constants.dart │ ├── pages │ │ ├── BookDetailPage.dart │ │ ├── BookList.dart │ │ ├── BookStore.dart │ │ ├── CollectBooksPage.dart │ │ ├── DrawerPage.dart │ │ ├── LoginPage.dart │ │ ├── MyInfoPage.dart │ │ ├── RegisterPage.dart │ │ └── SettingPage.dart │ └── widgets │ │ └── CommentBar.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── LICENSE.md └── README.md /36627.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/36627.jpg -------------------------------------------------------------------------------- /Chapter_5/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | Platform, 10 | StyleSheet, 11 | Text, 12 | View, 13 | BackHandler 14 | } from 'react-native'; 15 | import { RootStack } from './app/navigate/AppStack'; 16 | 17 | export default class App extends Component { 18 | constructor(props) { 19 | super(props); 20 | 21 | } 22 | 23 | render() { 24 | return ( 25 | 26 | ); 27 | } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /Chapter_5/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.shudan", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.shudan", 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 | -------------------------------------------------------------------------------- /Chapter_5/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 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/java/com/shudan/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.shudan; 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 "ShuDan"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/java/com/shudan/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.shudan; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | 29 | @Override 30 | protected String getJSMainModuleName() { 31 | return "index"; 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | SoLoader.init(this, /* native exopackage */ false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-xhdpi/logo.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/mipmap-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/app/src/main/res/mipmap-xxhdpi/logo.png -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ShuDan 3 | 4 | -------------------------------------------------------------------------------- /Chapter_5/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter_5/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Chapter_5/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 | 20 | android.useDeprecatedNdk=true 21 | STORE_FILE=../../shudan.keystore 22 | KEY_ALIAS=shudan-alias 23 | STORE_FILE_PASSWORD=123456 24 | KEY_ALIAS_PASSWORD=123456 -------------------------------------------------------------------------------- /Chapter_5/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Chapter_5/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-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Chapter_5/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Chapter_5/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Chapter_5/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 | -------------------------------------------------------------------------------- /Chapter_5/android/local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Tue Jan 15 21:34:52 CST 2019 8 | sdk.dir=D\:\\mySpace\\android\\android-sdk 9 | -------------------------------------------------------------------------------- /Chapter_5/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ShuDan' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Chapter_5/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShuDan", 3 | "displayName": "ShuDan" 4 | } -------------------------------------------------------------------------------- /Chapter_5/app/common/CommonStyle.js: -------------------------------------------------------------------------------- 1 | import{StyleSheet}from'react-native'; 2 | 3 | const CommonStyle= StyleSheet.create({ 4 | root:{ 5 | flex:1, 6 | backgroundColor:'#F4F4F4' 7 | } 8 | }); 9 | 10 | export default CommonStyle; -------------------------------------------------------------------------------- /Chapter_5/app/common/Constant.js: -------------------------------------------------------------------------------- 1 | import{Dimensions}from'react-native'; 2 | 3 | const Constant={ 4 | screenWidth:Dimensions.get('window').width, 5 | screenHeight:Dimensions.get('window').height, 6 | baseUrl:'http://renyugang.io/api/read.php?' 7 | } 8 | 9 | export default Constant; -------------------------------------------------------------------------------- /Chapter_5/app/component/BaseComponent.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { BackHandler } from 'react-native'; 3 | class BaseComponent extends Component { 4 | constructor(props) { 5 | super(props); 6 | this.backHandler = BackHandler.addEventListener('hardwareBackPress', this._onBackAndroid); 7 | } 8 | componentWillMount() { 9 | 10 | } 11 | componentWillUnmount() { 12 | this.backHandler && this.backHandler.remove(); 13 | } 14 | 15 | _onBackAndroid = () => { 16 | if (!this.props.navigation) { 17 | return false; 18 | } 19 | let { routeName } = this.props.navigation.state; 20 | if (routeName == "Login" || routeName == 'ShuDan'||routeName=='Me') { 21 | BackHandler.exitApp() 22 | return true; 23 | }else{ 24 | this.props.navigation.goBack(); 25 | return true; 26 | } 27 | } 28 | 29 | } 30 | 31 | export default BaseComponent; -------------------------------------------------------------------------------- /Chapter_5/app/img/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/default.png -------------------------------------------------------------------------------- /Chapter_5/app/img/default_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/default_icon@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/default_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/default_icon@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_arrow@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_arrow@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon1@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon1@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon2@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon2@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon3@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/drawer_icon3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/drawer_icon3@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/home_unselect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/home_unselect@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/home_unselect@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/home_unselect@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon1@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon1@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon2@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon2@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon3@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/icon3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/icon3@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/login_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/login_btn@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/login_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/login_btn@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_dianzan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_dianzan@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_dianzan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_dianzan@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_header@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_header@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_header@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_like@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_like@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_like@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_like@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_lingqu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_lingqu@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_lingqu@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_lingqu@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_rect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_rect@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_rect@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_rect@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_selected@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_selected@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_setting@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_setting@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_setting@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_setting@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_shoucang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_shoucang@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/me_shoucang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/me_shoucang@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/register_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/register_btn@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/register_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/register_btn@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/register_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/register_header@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/register_header@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/register_header@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/right_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/right_arrow.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_dianzan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_dianzan@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_dianzan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_dianzan@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_shoucang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_shoucang@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_shoucang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_shoucang@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_underline@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_underline@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_underline@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_underline@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_unshoucang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_unshoucang@2x.png -------------------------------------------------------------------------------- /Chapter_5/app/img/shudan_unshoucang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/app/img/shudan_unshoucang@3x.png -------------------------------------------------------------------------------- /Chapter_5/app/navigate/AppStack.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Image, Text, View } from 'react-native'; 3 | import { createBottomTabNavigator, createDrawerNavigator, createStackNavigator, } from 'react-navigation'; 4 | import ShuDanView from '../view/shudan/ShuDanView'; 5 | import MeView from '../view/account/MeView'; 6 | import SplashView from '../view/login/SplashView'; 7 | import LoginView from '../view/login/LoginView'; 8 | import RegisterView from '../view/login/RegisterView'; 9 | import ShuDanDetailView from '../view/shudan/ShuDanDetailView'; 10 | import DrawerView from '../view/drawer/DrawerView'; 11 | import Constant from '../common/Constant'; 12 | 13 | export const TabBottomBar = createBottomTabNavigator({ 14 | ShuDan: { 15 | screen: ShuDanView, 16 | navigationOptions: { 17 | tabBarPosition: 'bottom', 18 | tabBarLabel: '首页', 19 | 20 | tabBarIcon: ({ focused, tintColor }) => { 21 | let imgSource = focused ? require('../img/icon2.png') : require('../img/home_unselect.png'); 22 | return ; 24 | } 25 | } 26 | }, 27 | Me: { 28 | screen: MeView, 29 | navigationOptions: { 30 | tabBarPosition: 'bottom', 31 | tabBarLabel: '我的', 32 | 33 | tabBarIcon: ({ focused, tintColor }) => { 34 | let imgSource = focused ? require('../img/me_selected.png') : require('../img/icon3.png'); 35 | return ; 36 | }, 37 | } 38 | } 39 | }, 40 | { 41 | tabBarOptions: { 42 | activeTintColor: ' #636362', 43 | } 44 | } 45 | ); 46 | 47 | 48 | 49 | 50 | 51 | export const StackNavigator = createStackNavigator( 52 | { 53 | Splash: { 54 | screen: SplashView, 55 | navigationOptions: { 56 | header: null 57 | } 58 | }, 59 | Login: { 60 | screen: LoginView, 61 | navigationOptions: { 62 | header: null 63 | } 64 | }, 65 | Register: { 66 | screen: RegisterView, 67 | navigationOptions: { 68 | title: '注册' 69 | } 70 | }, 71 | ShuDanDetail: { 72 | screen: ShuDanDetailView, 73 | navigationOptions: { 74 | title: '书单详情' 75 | } 76 | }, 77 | Tab: { 78 | screen: TabBottomBar, 79 | navigationOptions: { 80 | header: null 81 | } 82 | } 83 | }, 84 | { 85 | initialRouteName: 'Splash', 86 | navigationOptions: { 87 | headerStyle: { 88 | backgroundColor: '#353535', 89 | height: 44 90 | }, 91 | headerTintColor: '#FFFFFF', 92 | headerTitleStyle: { 93 | fontWeight: 'bold', 94 | flex: 1, 95 | textAlign: 'center', 96 | fontSize: 18 97 | }, 98 | headerRight: 99 | } 100 | } 101 | ); 102 | 103 | export const RootStack = createDrawerNavigator({ 104 | Tab: { 105 | screen: StackNavigator, 106 | navigationOptions: { 107 | drawerLabel: 108 | } 109 | } 110 | }) 111 | -------------------------------------------------------------------------------- /Chapter_5/app/util/AsyncStorageUtil.js: -------------------------------------------------------------------------------- 1 | import { AsyncStorage } from 'react-native'; 2 | /** 3 | * 持久存储工具 4 | */ 5 | 6 | var AsyncStorageUtil = { 7 | setValue: function (key, value, callBcak) { 8 | if (value) { 9 | return AsyncStorage.setItem(key, value, (error) => callBcak(error)); 10 | } 11 | }, 12 | setValues: function (multiParis, callBcak) { 13 | if (multiParis) { 14 | return AsyncStorage.multiSet(multiParis, (errors) => callBcak(errors)); 15 | } 16 | }, 17 | getValue: function (key, callBcak) { 18 | 19 | return AsyncStorage.getItem(key, (error, result) => callBcak(error, result)); 20 | }, 21 | removeValue: function (key, callBcak) { 22 | 23 | return AsyncStorage.removeItem(key, (error) => callBcak(error)); 24 | } 25 | } 26 | 27 | export default AsyncStorageUtil; 28 | -------------------------------------------------------------------------------- /Chapter_5/app/util/HttpUtil.js: -------------------------------------------------------------------------------- 1 | import { toastShort } from './ToastUtil'; 2 | 3 | function httpFetch(url, method, formData, callBack) { 4 | 5 | let headParams = { 6 | 'Content-Type': 'application/x-www-form-urlencoded', 7 | 'Param-Decode': 'false', 8 | } 9 | let paramsArray = []; 10 | 11 | if (formData) { 12 | Object.keys(formData).forEach(key => { 13 | formData[key] ? paramsArray.push(key + '=' + encodeURIComponent(formData[key])) : '' 14 | }); 15 | } 16 | let parms = { 17 | method: method, 18 | headers: headParams, 19 | timeout: 10 * 1000, 20 | body: method === 'GET' ? null : paramsArray.join('&'), 21 | } 22 | 23 | 24 | fetch(url, parms).then((response) => { 25 | if (response.ok) { 26 | 27 | return response.json(); 28 | } else { 29 | if (callBack.onError) { 30 | callBack.onError(response.code, "") 31 | } else { 32 | toastShort(response.code, false) 33 | } 34 | } 35 | }).then((responseJson) => { 36 | // console.log("http:" + url + "response:" + JSON.parse(responseJson)); 37 | if (responseJson&&responseJson.code==0) { 38 | callBack.onSuccess(responseJson); 39 | }else{ 40 | if(callBack.onError){ 41 | callBack.onError(responseJson.code,responseJson.message); 42 | } 43 | } 44 | }).catch((error) => { 45 | // console.log("http:" + url + "response:" + error); 46 | let errMsg = error.toString(); 47 | if (callBack.onError) { 48 | callBack.onError("-1", errMsg); 49 | } else { 50 | toastShort(errMsg, false); 51 | } 52 | }) 53 | } 54 | 55 | export { httpFetch }; -------------------------------------------------------------------------------- /Chapter_5/app/util/StringUtil.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 判断是否未空 3 | * @param {*字符串} str 4 | */ 5 | export function isEmpity(str){ 6 | if(str==null||str==""||str.legth==0){ 7 | return true; 8 | } 9 | return false; 10 | } -------------------------------------------------------------------------------- /Chapter_5/app/util/ToastUtil.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 弹框的工具类 4 | */ 5 | import { Alert, ToastAndroid, Platform } from 'react-native'; 6 | 7 | export const toastShort = (content, isAlert) => { 8 | if (isAlert || Platform.OS === 'ios') { 9 | setTimeout(() => { Alert.alert('提示', content.toString()) }, 500); 10 | } else { 11 | ToastAndroid.show(content.toString(), ToastAndroid.SHORT); 12 | } 13 | }; 14 | 15 | export const promptEvent = (content, isAlert) => { 16 | if (isAlert || Platform.OS === 'ios') { 17 | setTimeout(() => { Alert.alert('提示', content.toString()) }, 500); 18 | } else { 19 | ToastAndroid.show(content.toString(), ToastAndroid.SHORT); 20 | } 21 | }; 22 | 23 | export const toastLong = (content, isAlert) => { 24 | if (isAlert || Platform.OS === 'ios') { 25 | Alert.alert('提示', content.toString()); 26 | } else { 27 | ToastAndroid.show(content.toString(), ToastAndroid.LONG); 28 | } 29 | }; -------------------------------------------------------------------------------- /Chapter_5/app/view/drawer/DrawerView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Text, View, StyleSheet, BackHandler, Image, TouchableOpacity, ImageBackground } from 'react-native'; 3 | import CommonStyle from '../../common/CommonStyle'; 4 | 5 | class DrawerView extends Component { 6 | render() { 7 | return ( 8 | 9 | 10 | 11 | 14 | 15 | 16 | Jack 17 | 18 | 送给程序员的爱心书单 19 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ); 32 | } 33 | } 34 | const styles = StyleSheet.create({ 35 | imgbackground: { 36 | width: '100%', 37 | height: 185, 38 | marginTop: 10, 39 | marginBottom: 10, 40 | justifyContent: 'center' 41 | }, 42 | text_name: { 43 | flexDirection: 'row', 44 | alignItems: 'center', 45 | marginLeft: 16 46 | }, 47 | img: { 48 | position: 'absolute', 49 | bottom: 0, 50 | right: 0 51 | }, 52 | text_desc: { 53 | color: '#FFFFFF', 54 | fontSize: 14, marginTop: 16, 55 | marginLeft: 16 56 | }, 57 | top_text: { 58 | color: '#FFFFFF', 59 | fontSize: 14, 60 | marginLeft: 10 61 | }, 62 | bottom_view: { 63 | borderBottomColor: '#828181', 64 | borderBottomWidth: 0.5, 65 | flexDirection: 'row', 66 | justifyContent: 'space-between', 67 | marginTop: 42, 68 | paddingBottom: 16, 69 | marginLeft: 8, 70 | marginRight: 8 71 | }, 72 | top_view: { 73 | flexDirection: 'row', 74 | alignItems: 'center', 75 | marginLeft: 16 76 | 77 | } 78 | }) 79 | export default DrawerView; -------------------------------------------------------------------------------- /Chapter_5/app/view/login/SplashView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View, Text, StyleSheet, Image } from 'react-native'; 3 | import BaseComponent from '../../component/BaseComponent'; 4 | import AsyncStorageUtil from '../../util/AsyncStorageUtil'; 5 | class SplashView extends BaseComponent { 6 | static navigationOptions = { 7 | headerStyle: { 8 | height: 0 9 | } 10 | 11 | }; 12 | /** 13 | * 设置定时器 14 | */ 15 | componentDidMount() { 16 | this.timer = setTimeout(() => { 17 | AsyncStorageUtil.getValue("userName", (error, result) => { 18 | if (result) { 19 | this.props.navigation.navigate('Tab'); 20 | }else{ 21 | this.props.navigation.navigate('Login'); 22 | } 23 | }); 24 | 25 | }, 1000); 26 | } 27 | /** 28 | * 清除定时器 29 | */ 30 | componentWillUnmount() { 31 | this.timer && clearTimeout(this.timer); 32 | } 33 | render() { 34 | return ( 35 | 36 | 37 | 38 | ); 39 | } 40 | } 41 | 42 | 43 | const styles = StyleSheet.create({ 44 | root: { 45 | alignItems: "center", 46 | justifyContent: "center", 47 | backgroundColor:'#FFFFFF', 48 | flex:1 49 | } 50 | }) 51 | 52 | export default SplashView -------------------------------------------------------------------------------- /Chapter_5/app/view/shudan/ShanDanListView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Text, View, StyleSheet, FlatList, TouchableOpacity, Image } from 'react-native'; 3 | import Constant from '../../common/Constant'; 4 | import { httpFetch } from '../../util/HttpUtil'; 5 | class ShanDanListView extends Component { 6 | 7 | constructor(props) { 8 | super(props); 9 | this.state = { 10 | shuDanItemArray: [], 11 | } 12 | } 13 | /** 14 | * item的点击事件,在该方法中调用书单组件的onPress()方法 15 | */ 16 | onPress = (id) => { 17 | this.props.onPress(id); 18 | } 19 | 20 | componentDidMount = () => { 21 | this.getList(); 22 | } 23 | 24 | getList = () => { 25 | let url = Constant.baseUrl + 'action=list&q=' + this.props.tabLabel; 26 | let _this = this; 27 | let callBack = { 28 | onSuccess(resultObject) { 29 | _this.setState({ 30 | shuDanItemArray: _this.state.shuDanItemArray.concat(resultObject.data) 31 | }); 32 | }, 33 | onError(code, errorMsg) { 34 | 35 | } 36 | }; 37 | httpFetch(url, 'GET', null, callBack); 38 | } 39 | /** 40 | * 返回每个Item的布局 41 | */ 42 | renderItem = ({ item }) => { 43 | let imageSource = require('../../img/default.png'); 44 | if (item.image) { 45 | imageSource = { uri: item.image }; 46 | } 47 | return ( this.onPress(item.id)}> 48 | 49 | 50 | {item.name} 51 | ) 52 | } 53 | 54 | render() { 55 | return ( 56 | 62 | ); 63 | } 64 | } 65 | const styles = StyleSheet.create({ 66 | item_root: { 67 | alignItems: 'center', 68 | marginTop: 42 69 | }, 70 | img: { 71 | width: 100, 72 | height: 140, 73 | borderWidth: 1, 74 | backgroundColor: '#FFFFFF', 75 | borderColor: '#B9B9BB' 76 | }, 77 | text: { 78 | color: '#343434', 79 | fontSize: 12, 80 | marginTop: 12 81 | } 82 | 83 | }) 84 | 85 | export default ShanDanListView; -------------------------------------------------------------------------------- /Chapter_5/app/view/shudan/ShuDanView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { Text, View, StyleSheet, FlatList, TouchableOpacity, Image } from 'react-native'; 3 | import ScrollableTabView, { ScrollableTabBar } from 'react-native-scrollable-tab-view'; 4 | import ShanDanListView from './ShanDanListView'; 5 | import BaseComponent from '../../component/BaseComponent'; 6 | import { httpFetch } from '../../util/HttpUtil'; 7 | import Constant from '../../common/Constant'; 8 | import CommonStyle from '../../common/CommonStyle'; 9 | class ShuDanView extends BaseComponent { 10 | 11 | 12 | constructor(props) { 13 | super(props); 14 | this.state = { 15 | shuDanTabsArray: [] 16 | } 17 | } 18 | 19 | componentDidMount = () => { 20 | this.getTabs(); 21 | } 22 | 23 | getTabs = () => { 24 | let url = Constant.baseUrl + 'action=category'; 25 | let _this = this; 26 | let callBack = { 27 | onSuccess(resultObject) { 28 | _this.setState({ 29 | shuDanTabsArray: _this.state.shuDanTabsArray.concat(resultObject.data) 30 | }); 31 | 32 | }, 33 | onError(code, errorMsg) { 34 | 35 | } 36 | }; 37 | httpFetch(url, 'GET', null, callBack); 38 | } 39 | /** 40 | * 点击列表Item的回调并调用路由的跳转方法,第二个参数是传递到下一个页面的参数 41 | */ 42 | onPress = (id) => { 43 | this.props.navigation.navigate('ShuDanDetail', { id: id }); 44 | } 45 | 46 | /** 47 | * 返回列表组件 48 | */ 49 | renderList = () => { 50 | return ( 51 | this.state.shuDanTabsArray.map((value, index) => { 52 | return this.onPress(id)} 55 | /> 56 | }) 57 | ) 58 | } 59 | 60 | 61 | render() { 62 | return ( 63 | 64 | 65 | 66 | 首页 67 | 68 | 69 | 70 | } 73 | style={{ flex: 1, backgroundColor: '#EAE9E7' }} 74 | tabBarBackgroundColor="#FFFFFF" 75 | tabBarActiveTextColor="#636362" 76 | tabBarUnderlineStyle={styles.line_view} 77 | > 78 | { 79 | this.renderList() 80 | } 81 | 82 | 83 | 84 | ); 85 | } 86 | } 87 | 88 | const styles = StyleSheet.create({ 89 | header_layout: { 90 | flexDirection: 'row', 91 | alignItems: 'center', 92 | justifyContent: 'space-between', 93 | height: 44, 94 | backgroundColor: '#353535', 95 | paddingLeft: 20, 96 | paddingRight: 20 97 | }, 98 | header_text: { color: '#FFFFFF', 99 | fontSize: 18, alignSelf: 'center' }, 100 | line_view: { backgroundColor: '#636362', height: 2 } 101 | }) 102 | export default ShuDanView; -------------------------------------------------------------------------------- /Chapter_5/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './App'; 3 | 4 | AppRegistry.registerComponent('ShuDan', () => App); 5 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan-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 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan-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 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/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 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/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 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 20 | 21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 22 | moduleName:@"ShuDan" 23 | initialProperties:nil 24 | launchOptions:launchOptions]; 25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 26 | 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | UIViewController *rootViewController = [UIViewController new]; 29 | rootViewController.view = rootView; 30 | self.window.rootViewController = rootViewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "icon-20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "icon-20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "icon-29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "icon-40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon-60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon-60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "1024x1024", 53 | "idiom" : "ios-marketing", 54 | "filename" : "icon-1024.png", 55 | "scale" : "1x" 56 | } 57 | ], 58 | "info" : { 59 | "version" : 1, 60 | "author" : "xcode" 61 | } 62 | } -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Images.xcassets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/ShuDan/Images.xcassets/logo.png -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ShuDan 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | NSAllowsArbitraryLoads 46 | 47 | NSExceptionDomains 48 | 49 | localhost 50 | 51 | NSExceptionAllowsInsecureHTTPLoads 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDan/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 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDanTests/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 | -------------------------------------------------------------------------------- /Chapter_5/ios/ShuDanTests/ShuDanTests.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 ShuDanTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ShuDanTests 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 | -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/default.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/default_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/default_icon@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/default_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/default_icon@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_arrow@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_arrow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_arrow@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon1@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon1@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon2@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon2@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon3@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/drawer_icon3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/drawer_icon3@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/home_unselect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/home_unselect@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/home_unselect@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/home_unselect@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon1@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon1@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon1@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon2@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon2@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon3@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/icon3@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/icon3@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/login_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/login_btn@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/login_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/login_btn@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_dianzan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_dianzan@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_dianzan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_dianzan@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_header@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_header@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_header@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_like@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_like@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_like@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_like@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_lingqu@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_lingqu@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_lingqu@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_lingqu@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_rect@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_rect@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_rect@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_rect@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_selected@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_selected@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_selected@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_setting@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_setting@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_setting@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_setting@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_shoucang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_shoucang@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/me_shoucang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/me_shoucang@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/register_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/register_btn@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/register_btn@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/register_btn@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/register_header@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/register_header@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/register_header@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/register_header@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_dianzan@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_dianzan@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_dianzan@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_dianzan@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_shoucang@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_shoucang@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_shoucang@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_shoucang@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_underline@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_underline@2x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/assets/app/img/shudan_underline@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/assets/app/img/shudan_underline@3x.png -------------------------------------------------------------------------------- /Chapter_5/ios/bundle/index.jsbundle.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/ios/bundle/index.jsbundle.meta -------------------------------------------------------------------------------- /Chapter_5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShuDanApp", 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 | "bundle-ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --platform ios --dev false --bundle-output ./ios/bundle/index.ios.jsbundle --assets-dest ./ios/bundle" 9 | }, 10 | "dependencies": { 11 | "react": "16.3.0-alpha.0", 12 | "react-native": "0.55.0", 13 | "react-native-scrollable-tab-view": "^0.8.0", 14 | "react-navigation": "^2.11.2" 15 | }, 16 | "devDependencies": { 17 | "babel-jest": "23.4.2", 18 | "babel-preset-react-native": "4.0.0", 19 | "jest": "23.5.0", 20 | "react-test-renderer": "16.3.0-alpha.0" 21 | }, 22 | "jest": { 23 | "preset": "react-native" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Chapter_5/shudan.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-exchange/cross-platform-guide/e52f6fcc90f3a63e0e8fac01d2b57f81d48689d2/Chapter_5/shudan.keystore -------------------------------------------------------------------------------- /Chapter_6/app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | 5 | }, 6 | globalData: { 7 | } 8 | }) -------------------------------------------------------------------------------- /Chapter_6/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/tab1/tab1", 4 | "pages/container-view/container-view", 5 | "pages/container-scroll-view/container-scroll-view", 6 | "pages/container-swiper/container-swiper", 7 | "pages/container-base/container-base", 8 | "pages/container-form/container-form", 9 | "pages/container-media/container-media", 10 | "pages/container-map/container-map", 11 | "pages/container-web-view/container-web-view" 12 | ], 13 | "window": { 14 | "backgroundTextStyle": "light", 15 | "navigationBarBackgroundColor": "#fff", 16 | "navigationBarTitleText": "DEMO", 17 | "navigationBarTextStyle": "black" 18 | } 19 | } -------------------------------------------------------------------------------- /Chapter_6/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } 11 | -------------------------------------------------------------------------------- /Chapter_6/pages/container-base/container-base.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | 3 | data: { 4 | text: "这是一个 text!" 5 | }, 6 | onLoad: function (options) { 7 | 8 | }, 9 | onReady: function () { 10 | 11 | }, 12 | onShow: function () { 13 | 14 | }, 15 | onHide: function () { 16 | 17 | }, 18 | onUnload: function () { 19 | 20 | } 21 | }) -------------------------------------------------------------------------------- /Chapter_6/pages/container-base/container-base.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "基础组件" 3 | } -------------------------------------------------------------------------------- /Chapter_6/pages/container-base/container-base.wxml: -------------------------------------------------------------------------------- 1 | 2 | text 3 | 4 | {{text}} 5 | {{text}} 6 | {{text}} 7 | 8 | progress 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Chapter_6/pages/container-base/container-base.wxss: -------------------------------------------------------------------------------- 1 | page { 2 | background-color: #f2f2f2; 3 | } 4 | 5 | .title { 6 | height: 100rpx; 7 | color: #808080; 8 | line-height: 100rpx; 9 | font-size: 32rpx; 10 | margin: 20rpx 40rpx; 11 | } 12 | 13 | .item-container { 14 | margin: 20rpx 40rpx; 15 | } -------------------------------------------------------------------------------- /Chapter_6/pages/container-form/container-form.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | checkBoxItems: [ 4 | { name: 'USA', value: '美国' }, 5 | { name: 'CHN', value: '中国', checked: 'true' }, 6 | { name: 'BRA', value: '巴西' }, 7 | { name: 'JPN', value: '日本' }, 8 | { name: 'ENG', value: '英国' }, 9 | { name: 'TUR', value: '法国' }], 10 | radioItems: [ 11 | { name: '男', value: '1' }, 12 | { name: '女', value: '2', checked: 'true' }], 13 | array: ['美国', '中国', '巴西', '日本'], 14 | index: 1 15 | }, 16 | onLoad: function (options) { 17 | 18 | 19 | }, 20 | onReady: function () { 21 | 22 | }, 23 | onShow: function () { 24 | 25 | }, 26 | onHide: function () { 27 | 28 | }, 29 | onUnload: function () { 30 | 31 | }, 32 | checkboxChange: function (e) { 33 | console.log('checkbox 发生 change 事件,携带 value 值为:', e.detail.value); 34 | }, 35 | radioChange: function (e) { 36 | console.log('radio 发生 change 事件,携带 value 值为:', e.detail.value); 37 | }, 38 | formSubmit: function () { 39 | console.log('表单提交 formSubmit'); 40 | }, 41 | formReset: function () { 42 | console.log('表单重置 formReset'); 43 | }, 44 | sliderChange: function (e) { 45 | console.log('slider 发生 change 事件,携带 value 值为:', e.detail.value); 46 | }, 47 | switchChange: function (e) { 48 | console.log('switch 发生 change 事件,携带 value 值为:', e.detail.value); 49 | } 50 | }) -------------------------------------------------------------------------------- /Chapter_6/pages/container-form/container-form.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "表单组件" 3 | } -------------------------------------------------------------------------------- /Chapter_6/pages/container-form/container-form.wxml: -------------------------------------------------------------------------------- 1 | 2 | button 3 | 4 | 5 | 6 | 7 | 8 | checkbox 9 | 10 | 11 | 15 | 16 | 17 | radio 18 | 19 | 20 | 24 | 25 | 26 | input 27 | 28 | 29 | 30 | textarea 31 | 32 |