├── .eslintignore ├── .eslintrc ├── .flowconfig ├── .gitignore ├── E1FacebookMovieTutorial ├── E1FacebookMovieTutorial.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── E1FacebookMovieTutorial.xcscheme ├── iOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── main.jsbundle │ └── main.m ├── index.ios.js └── package.json ├── E2HotelTonight ├── E2HotelTonight.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── E2HotelTonight.xcscheme ├── HomeScreen.js ├── HotelDetail.js ├── HotelList.js ├── SearchBar.js ├── iOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── main.jsbundle │ └── main.m ├── index.ios.js └── package.json ├── E3WeChat ├── ChatTab.js ├── ContactDetail.js ├── ContactTab.js ├── ContactTabMain.js ├── E3WeChat.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── E3WeChat.xcscheme ├── iOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── main.jsbundle │ └── main.m ├── index.ios.js └── package.json ├── E4WeChatAndroid ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── add-item.android.js ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── e4wechatandroid │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-xxhdpi │ │ │ ├── ic_logo.png │ │ │ └── ic_menu_white.png │ │ │ ├── drawable │ │ │ └── splash.png │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── drawer-navigation-view.android.js ├── drawer-view.android.js ├── index.android.js ├── index.ios.js ├── ios │ ├── E4WeChatAndroid.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── E4WeChatAndroid.xcscheme │ ├── E4WeChatAndroid │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── E4WeChatAndroidTests │ │ ├── E4WeChatAndroidTests.m │ │ └── Info.plist │ └── main.jsbundle ├── item-detail.js ├── item-list.android.js ├── package.json ├── routes.android.js └── styles.android.js ├── E5WeReferAndroid ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── add-item-view.js ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── e5wereferandroid │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-xxhdpi │ │ │ ├── ic_logo.png │ │ │ └── ic_menu_white.png │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── drawer-layout-view.android.js ├── index.android.js ├── index.ios.js ├── ios │ ├── E5WeReferAndroid.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── E5WeReferAndroid.xcscheme │ ├── E5WeReferAndroid │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── E5WeReferAndroidTests │ │ ├── E5WeReferAndroidTests.m │ │ └── Info.plist │ └── main.jsbundle ├── item-detail-view.android.js ├── item-list-view.android.js ├── navigation-view.android.js ├── package.json ├── routes.android.js └── styles.android.js ├── HackerNews-React-Native ├── .gitignore ├── App │ ├── Network │ │ └── api.js │ ├── Utils │ │ └── functions.js │ └── Views │ │ ├── Post │ │ ├── Elements │ │ │ ├── CommentCell │ │ │ │ ├── index.js │ │ │ │ └── style.js │ │ │ └── ParseHTML.js │ │ ├── index.android.js │ │ ├── index.ios.js │ │ └── style.js │ │ ├── Posts │ │ ├── Elements │ │ │ └── PostCell │ │ │ │ ├── index.js │ │ │ │ └── style.js │ │ ├── index.android.js │ │ ├── index.ios.js │ │ └── style.js │ │ └── Web │ │ ├── index.js │ │ └── style.js ├── LICENSE ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── hackernews │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_arrow_back_white_24dp.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_arrow_back_white_24dp.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_arrow_back_white_24dp.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_arrow_back_white_24dp.png │ │ │ ├── drawable-xxxhdpi │ │ │ └── ic_arrow_back_white_24dp.png │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── index.android.js ├── index.ios.js ├── ios │ ├── HackerNews.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── HackerNews.xcscheme │ ├── HackerNews │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── HackerNewsTests │ │ ├── HackerNewsTests.m │ │ └── Info.plist │ └── main.jsbundle └── package.json ├── README.md ├── Z1PropertyFinder ├── .gitignore ├── PropertyFinder.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── PropertyFinder.xcscheme ├── PropertyView.js ├── README.md ├── SearchPage.js ├── SearchResults.js ├── iOS │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── house.imageset │ │ │ ├── Contents.json │ │ │ ├── house.png │ │ │ ├── house@2x.png │ │ │ └── house@3x.png │ ├── Info.plist │ └── main.m ├── index.ios.js └── package.json ├── ZhiHuDaily-React-Native ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── DataRepository.js ├── DetailToolbar.js ├── LICENSE ├── ListScreen.js ├── README.md ├── SplashScreen.js ├── StoryItem.js ├── StoryScreen.js ├── SwipeRereshLayout.js ├── ThemesList.js ├── WebView.js ├── android │ ├── RCTZhiHuDaily.iml │ ├── app │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── race604 │ │ │ │ ├── react │ │ │ │ └── view │ │ │ │ │ ├── MyReactPackage.java │ │ │ │ │ ├── swiperefresh │ │ │ │ │ ├── ReactSwipeRefreshLayout.java │ │ │ │ │ ├── ReactSwipeRefreshLayoutManager.java │ │ │ │ │ └── event │ │ │ │ │ │ └── RefreshEvent.java │ │ │ │ │ └── webview │ │ │ │ │ ├── ObservableWebView.java │ │ │ │ │ └── ReactWebViewManager.java │ │ │ │ └── zhihu │ │ │ │ └── daily │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ ├── drawable-xxhdpi │ │ │ ├── account_avatar.png │ │ │ ├── comment_avatar.png │ │ │ ├── home.png │ │ │ ├── ic_back_white.png │ │ │ ├── ic_collect_white.png │ │ │ ├── ic_collected_white.png │ │ │ ├── ic_comment_white.png │ │ │ ├── ic_download_white.png │ │ │ ├── ic_favorites_white.png │ │ │ ├── ic_logo.png │ │ │ ├── ic_menu_arrow.png │ │ │ ├── ic_menu_follow.png │ │ │ ├── ic_menu_white.png │ │ │ ├── ic_message_white.png │ │ │ ├── ic_more_white.png │ │ │ ├── ic_praise_white.png │ │ │ ├── ic_share_white.png │ │ │ ├── menu_home.png │ │ │ └── splash_logo.png │ │ │ ├── drawable │ │ │ └── splash.png │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-zh │ │ │ └── strings.xml │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── art │ ├── content.jpg │ ├── drawer.jpg │ └── home.jpg ├── index.android.js ├── index.ios.js ├── ios │ ├── RCTZhiHuDaily.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── RCTZhiHuDaily.xcscheme │ ├── RCTZhiHuDaily │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── RCTZhiHuDailyTests │ │ ├── Info.plist │ │ └── RCTZhiHuDailyTests.m └── package.json └── ziliun-react-native ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── ArticleListScreen.js ├── ArticleScreen.js ├── LICENSE ├── README.md ├── android ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── assets │ │ └── index.android.bundle │ │ ├── java │ │ └── com │ │ │ └── ziliunapp │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable-hdpi │ │ ├── android_back_white.png │ │ ├── android_menu_white.png │ │ ├── android_search_white.png │ │ └── ziliun_logo_large.png │ │ ├── drawable-mdpi │ │ ├── android_back_white.png │ │ ├── android_menu_white.png │ │ ├── android_search_white.png │ │ └── ziliun_logo_large.png │ │ ├── drawable-xhdpi │ │ ├── android_back_white.png │ │ ├── android_menu_white.png │ │ ├── android_search_white.png │ │ └── ziliun_logo_large.png │ │ ├── drawable-xxhdpi │ │ ├── android_back_white.png │ │ ├── android_menu_white.png │ │ ├── android_search_white.png │ │ └── ziliun_logo_large.png │ │ ├── drawable-xxxhdpi │ │ ├── android_menu_white.png │ │ └── ziliun_logo_large.png │ │ ├── drawable │ │ └── rotten_tomatoes_icon.png │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── index.android.js ├── index.android.test.js ├── index.ios.js ├── ios ├── ZiliunApp.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── ZiliunApp.xcscheme ├── ZiliunApp │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── main.m ├── ZiliunAppTests │ ├── Info.plist │ └── ZiliunAppTests.m └── main.jsbundle ├── logobig.png ├── package.json └── promo.png /.eslintignore: -------------------------------------------------------------------------------- 1 | **/node_modules/**/.*js 2 | **/staticBundle.js 3 | **/main.js 4 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js 13 | .*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js 14 | .*/node_modules/react-tools/src/browser/ui/React.js 15 | .*/node_modules/react-tools/src/core/ReactInstanceHandles.js 16 | .*/node_modules/react-tools/src/event/EventPropagators.js 17 | 18 | # Ignore jest 19 | .*/react-native/node_modules/jest-cli/.* 20 | 21 | # Ignore Website 22 | .*/website/.* 23 | 24 | [include] 25 | 26 | [libs] 27 | Libraries/react-native/react-native-interface.js 28 | Examples/UIExplorer/ImageMocks.js 29 | 30 | [options] 31 | module.system=haste 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | project.xcworkspace 3 | !**/*.xcodeproj 4 | !**/*.pbxproj 5 | !**/*.xcworkspacedata 6 | !**/*.xcsettings 7 | !**/*.xcscheme 8 | build/ 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | *.xccheckout 19 | *.moved-aside 20 | DerivedData 21 | *.hmap 22 | *.ipa 23 | *.xcuserstate 24 | 25 | # OS X 26 | .DS_Store 27 | 28 | # Node 29 | node_modules 30 | npm-debug.log 31 | 32 | # Build 33 | .gradle 34 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | // Loading JavaScript code - uncomment the one you want. 21 | 22 | // OPTION 1 23 | // Load from development server. Start the server from the repository root: 24 | // 25 | // $ npm start 26 | // 27 | // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and 28 | // iOS device are on the same Wi-Fi network. 29 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 30 | 31 | // OPTION 2 32 | // Load from pre-bundled file on disk. To re-generate the static bundle, run 33 | // 34 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 35 | // 36 | // and uncomment the next following line 37 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 38 | 39 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 40 | moduleName:@"E1FacebookMovieTutorial" 41 | launchOptions:launchOptions]; 42 | 43 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 44 | UIViewController *rootViewController = [[UIViewController alloc] init]; 45 | rootViewController.view = rootView; 46 | self.window.rootViewController = rootViewController; 47 | [self.window makeKeyAndVisible]; 48 | return YES; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/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 | 42 | 43 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from root of your project 3 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 4 | 5 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 6 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/iOS/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /E1FacebookMovieTutorial/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "E1FacebookMovieTutorial", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.3.11" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /E2HotelTonight/HomeScreen.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | View, 7 | Image, 8 | ScrollView, 9 | StyleSheet, 10 | TouchableHighlight, 11 | } = React; 12 | 13 | var SearchBar = require('./SearchBar'); 14 | var HotelList = require('./HotelList'); 15 | 16 | var HomeScreen = React.createClass({ 17 | render: function() { 18 | return ( 19 | 20 | 21 | 22 | 23 | 24 | ); 25 | } 26 | }); 27 | 28 | var styles = StyleSheet.create({ 29 | container: { 30 | flex: 1, 31 | }, 32 | spacer: { 33 | height: 65, 34 | } 35 | }) 36 | 37 | module.exports = HomeScreen; 38 | -------------------------------------------------------------------------------- /E2HotelTonight/HotelDetail.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | View, 7 | Image, 8 | ListView, 9 | ScrollView, 10 | StyleSheet, 11 | TouchableHighlight, 12 | AlertIOS 13 | } = React; 14 | 15 | var HotelDetail = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | Hotel Detail 20 | 21 | ); 22 | } 23 | }); 24 | 25 | var styles = StyleSheet.create({ 26 | container: { 27 | backgroundColor: 'aqua', 28 | marginTop: 65, //important 29 | }, 30 | }) 31 | 32 | module.exports = HotelDetail; 33 | -------------------------------------------------------------------------------- /E2HotelTonight/HotelList.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | View, 7 | Image, 8 | ListView, 9 | ScrollView, 10 | StyleSheet, 11 | TouchableHighlight, 12 | AlertIOS 13 | } = React; 14 | 15 | var HotelDetail = require('./HotelDetail'); 16 | 17 | var HotelList = React.createClass({ 18 | getInitialState: function() { 19 | var ds = new ListView.DataSource({ 20 | rowHasChanged: (r1, r2) => r1 !== r2 21 | }); 22 | return { 23 | dataSource: ds.cloneWithRows(['row 1', 'row 2']), 24 | }; 25 | }, 26 | 27 | _pressRow: function() { 28 | // AlertIOS.alert('console.log?', 'NO!'); 29 | this.props.navigator.push({ 30 | title: 'Hotel Detail', 31 | component: HotelDetail, 32 | passProps: {} 33 | }); 34 | }, 35 | 36 | _renderRow: function(rowData) { 37 | return ( 38 | 39 | this._pressRow()} 41 | style={styles.rowButton}> 42 | {rowData} 43 | 44 | 45 | ) 46 | }, 47 | 48 | 49 | render: function() { 50 | return ( 51 | 52 | 56 | 57 | ); 58 | } 59 | }); 60 | 61 | var styles = StyleSheet.create({ 62 | container: { 63 | flex: 10, 64 | backgroundColor: 'pink', 65 | }, 66 | rowContainer: { 67 | flexDirection: 'row', 68 | height: 60, 69 | backgroundColor: 'blue', 70 | justifyContent: 'center', 71 | marginBottom: 10, 72 | }, 73 | rowButton: { 74 | justifyContent: 'center', 75 | backgroundColor: 'cyan', 76 | } 77 | 78 | }) 79 | 80 | module.exports = HotelList; 81 | -------------------------------------------------------------------------------- /E2HotelTonight/SearchBar.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | View, 7 | Image, 8 | ScrollView, 9 | StyleSheet, 10 | TouchableHighlight, 11 | TextInput, 12 | } = React; 13 | 14 | var SearchBar = React.createClass({ 15 | render: function() { 16 | return ( 17 | 18 | 19 | 20 | Search 21 | 22 | 23 | ); 24 | } 25 | }); 26 | 27 | var styles = StyleSheet.create({ 28 | container: { 29 | flex: 1, 30 | flexDirection: 'row', 31 | }, 32 | textInput: { 33 | flex: 2, 34 | margin: 5, 35 | borderWidth: 1, 36 | borderRadius: 5, 37 | }, 38 | searchButton: { 39 | flex: 1, 40 | justifyContent: 'center', 41 | alignItems: 'center', 42 | borderWidth: 1, 43 | borderRadius: 5, 44 | backgroundColor: '#F2F2F2' 45 | } 46 | }) 47 | 48 | module.exports = SearchBar; 49 | -------------------------------------------------------------------------------- /E2HotelTonight/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /E2HotelTonight/iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | // Loading JavaScript code - uncomment the one you want. 21 | 22 | // OPTION 1 23 | // Load from development server. Start the server from the repository root: 24 | // 25 | // $ npm start 26 | // 27 | // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and 28 | // iOS device are on the same Wi-Fi network. 29 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 30 | 31 | // OPTION 2 32 | // Load from pre-bundled file on disk. To re-generate the static bundle, run 33 | // 34 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 35 | // 36 | // and uncomment the next following line 37 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 38 | 39 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 40 | moduleName:@"E2HotelTonight" 41 | launchOptions:launchOptions]; 42 | 43 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 44 | UIViewController *rootViewController = [[UIViewController alloc] init]; 45 | rootViewController.view = rootView; 46 | self.window.rootViewController = rootViewController; 47 | [self.window makeKeyAndVisible]; 48 | return YES; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /E2HotelTonight/iOS/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /E2HotelTonight/iOS/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 | 42 | 43 | -------------------------------------------------------------------------------- /E2HotelTonight/iOS/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from root of your project 3 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 4 | 5 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 6 | -------------------------------------------------------------------------------- /E2HotelTonight/iOS/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /E2HotelTonight/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | TabBarIOS, 14 | NavigatorIOS 15 | } = React; 16 | 17 | var HomeScreen = require('./HomeScreen'); 18 | 19 | var E2HotelTonight = React.createClass({ 20 | render: function() { 21 | return ( 22 | 29 | ); 30 | } 31 | }); 32 | 33 | var styles = StyleSheet.create({ 34 | container: { 35 | flex: 1, 36 | backgroundColor: 'red', 37 | } 38 | }); 39 | 40 | AppRegistry.registerComponent('E2HotelTonight', () => E2HotelTonight); 41 | -------------------------------------------------------------------------------- /E2HotelTonight/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "E2HotelTonight", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.3.11" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /E3WeChat/ChatTab.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | StyleSheet, 10 | Text, 11 | View, 12 | } = React; 13 | 14 | var ChatTab = React.createClass({ 15 | getInitialState: function() { 16 | return { 17 | }; 18 | }, 19 | 20 | render: function() { 21 | return ( 22 | 23 | 24 | chat tab 25 | 26 | 27 | some chat content 28 | 29 | 30 | some chat content 31 | 32 | 33 | ); 34 | } 35 | }); 36 | 37 | var styles = StyleSheet.create({ 38 | container: { 39 | flex: 1, 40 | }, 41 | header: { 42 | marginTop: 30, 43 | height: 50, 44 | backgroundColor: 'beige', 45 | alignItems: 'center', 46 | justifyContent: 'center', 47 | }, 48 | chatList: { 49 | backgroundColor: 'bisque', 50 | height: 50, 51 | justifyContent: 'center', 52 | } 53 | }); 54 | 55 | module.exports = ChatTab; 56 | -------------------------------------------------------------------------------- /E3WeChat/ContactDetail.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | StyleSheet, 10 | Text, 11 | View, 12 | TouchableHighlight, 13 | } = React; 14 | 15 | var fetch = require('fetch'); 16 | 17 | var ContactDetail = React.createClass({ 18 | getInitialState: function() { 19 | return {}; 20 | }, 21 | 22 | componentDidMount: function() { 23 | var url = 'https://en.wikipedia.org/w/api.php?format=json&action=query' 24 | + '&prop=extracts&exintro=&explaintext=&titles=' 25 | + encodeURIComponent(this.props.rowData); 26 | 27 | fetch(url) 28 | .then((response) => { 29 | this.setState({ 30 | response: response 31 | }); 32 | }) 33 | .catch((error) => { 34 | console.error('error'); 35 | }); 36 | }, 37 | 38 | render: function() { 39 | return ( 40 | 41 | {this.props.rowData} 42 | {this.state.response} 43 | 44 | ); 45 | } 46 | }); 47 | 48 | var styles = StyleSheet.create({ 49 | container: { 50 | marginTop: 64, 51 | }, 52 | }); 53 | 54 | module.exports = ContactDetail; 55 | -------------------------------------------------------------------------------- /E3WeChat/ContactTab.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | StyleSheet, 10 | Text, 11 | View, 12 | NavigatorIOS, 13 | } = React; 14 | 15 | var ContactTabMain = require('./ContactTabMain'); 16 | 17 | var ContactTab = React.createClass({ 18 | getInitialState: function() { 19 | return { 20 | }; 21 | }, 22 | 23 | render: function() { 24 | return ( 25 | 32 | ); 33 | } 34 | }); 35 | 36 | var styles = StyleSheet.create({ 37 | container: { 38 | flex: 1, 39 | }, 40 | }); 41 | 42 | module.exports = ContactTab; 43 | -------------------------------------------------------------------------------- /E3WeChat/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /E3WeChat/iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | // Loading JavaScript code - uncomment the one you want. 21 | 22 | // OPTION 1 23 | // Load from development server. Start the server from the repository root: 24 | // 25 | // $ npm start 26 | // 27 | // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and 28 | // iOS device are on the same Wi-Fi network. 29 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 30 | 31 | // OPTION 2 32 | // Load from pre-bundled file on disk. To re-generate the static bundle, run 33 | // 34 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 35 | // 36 | // and uncomment the next following line 37 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 38 | 39 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 40 | moduleName:@"E3WeChat" 41 | launchOptions:launchOptions]; 42 | 43 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 44 | UIViewController *rootViewController = [[UIViewController alloc] init]; 45 | rootViewController.view = rootView; 46 | self.window.rootViewController = rootViewController; 47 | [self.window makeKeyAndVisible]; 48 | return YES; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /E3WeChat/iOS/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /E3WeChat/iOS/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 | 42 | 43 | -------------------------------------------------------------------------------- /E3WeChat/iOS/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from root of your project 3 | // $ curl 'http://localhost:8081/index.ios.bundle?dev=false&minify=true' -o iOS/main.jsbundle 4 | 5 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 6 | -------------------------------------------------------------------------------- /E3WeChat/iOS/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /E3WeChat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "E3WeChat", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.3.11" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /E4WeChatAndroid/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/React.js 13 | .*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js 14 | .*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 15 | .*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js 16 | 17 | 18 | # Ignore commoner tests 19 | .*/node_modules/commoner/test/.* 20 | 21 | # See https://github.com/facebook/flow/issues/442 22 | .*/react-tools/node_modules/commoner/lib/reader.js 23 | 24 | # Ignore jest 25 | .*/react-native/node_modules/jest-cli/.* 26 | 27 | [include] 28 | 29 | [libs] 30 | node_modules/react-native/Libraries/react-native/react-native-interface.js 31 | 32 | [options] 33 | module.system=haste 34 | 35 | munge_underscores=true 36 | 37 | suppress_type=$FlowIssue 38 | suppress_type=$FlowFixMe 39 | suppress_type=$FixMe 40 | 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 44 | 45 | [version] 46 | 0.14.0 47 | -------------------------------------------------------------------------------- /E4WeChatAndroid/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # node.js 26 | # 27 | node_modules/ 28 | npm-debug.log 29 | 30 | # build 31 | .gradle 32 | -------------------------------------------------------------------------------- /E4WeChatAndroid/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /E4WeChatAndroid/add-item.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | TextInput, 7 | ToastAndroid, 8 | TouchableHighlight, 9 | View, 10 | } = React; 11 | var styles = require('./styles'); 12 | 13 | var AddItem = React.createClass({ 14 | getInitialState: function() { 15 | return { 16 | firstName: '', 17 | lastName: '', 18 | phoneNumber: '' 19 | }; 20 | }, 21 | 22 | onPressSubmit: function() { 23 | var state = 'First name: ' + this.state.firstName + '\n' + 24 | 'Last name: ' + this.state.lastName + '\n' + 25 | 'Phone number: ' + this.state.phoneNumber; 26 | ToastAndroid.show(state, ToastAndroid.LONG); 27 | }, 28 | 29 | render: function() { 30 | return ( 31 | 32 | this.setState({ 36 | firstName: text 37 | })} 38 | /> 39 | this.setState({ 43 | lastName: text 44 | })} 45 | /> 46 | this.setState({ 50 | phoneNumber: text 51 | })} 52 | keyboardType='numeric' 53 | /> 54 | 56 | Add a new item 57 | 58 | 59 | ); 60 | } 61 | }); 62 | 63 | module.exports = AddItem; 64 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.e4wechatandroid" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile 'com.android.support:appcompat-v7:23.0.0' 28 | compile 'com.facebook.react:react-native:0.11.+' 29 | } 30 | -------------------------------------------------------------------------------- /E4WeChatAndroid/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 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/drawable-xxhdpi/ic_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/drawable-xxhdpi/ic_logo.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/drawable/splash.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | E4WeChatAndroid 3 | 4 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /E4WeChatAndroid/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:1.3.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 | } 20 | } 21 | -------------------------------------------------------------------------------- /E4WeChatAndroid/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 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E4WeChatAndroid/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /E4WeChatAndroid/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.4-all.zip 6 | -------------------------------------------------------------------------------- /E4WeChatAndroid/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'E4WeChatAndroid' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /E4WeChatAndroid/drawer-navigation-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | DrawerLayoutAndroid, 6 | ListView, 7 | ToolbarAndroid, 8 | TouchableHighlight, 9 | Text, 10 | View, 11 | } = React; 12 | var styles = require('./styles'); 13 | 14 | var DrawerNavigationView = React.createClass({ 15 | selectMenuItem: function(menuItem) { 16 | this.props.navigator.push({ 17 | title: menuItem.title, 18 | path: menuItem.path 19 | }); 20 | }, 21 | 22 | renderMenuItem: function(menuItem) { 23 | return ( 24 | this.selectMenuItem(menuItem)} 26 | style={{ 27 | height: 60, 28 | padding: 30 29 | }} > 30 | {menuItem.title} 31 | 32 | ); 33 | }, 34 | 35 | render: function() { 36 | var dataSource = new ListView.DataSource({ 37 | rowHasChanged: (row1, row2) => row1 !== row2, 38 | }); 39 | 40 | return ( 41 | 42 | 67 | 68 | ); 69 | } 70 | }); 71 | 72 | module.exports = DrawerNavigationView; 73 | -------------------------------------------------------------------------------- /E4WeChatAndroid/drawer-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | DrawerLayoutAndroid, 6 | ToolbarAndroid, 7 | Text, 8 | View, 9 | } = React; 10 | var styles = require('./styles'); 11 | var DrawerNavigationView = require('./drawer-navigation-view'); 12 | var AddItem = require('./add-item'); 13 | var ItemList = require('./item-list'); 14 | var ItemDetail = require('./item-detail'); 15 | 16 | var DrawerView = React.createClass({ 17 | getChildren: function(path) { 18 | var children; 19 | switch (path) { 20 | case 'addItem': 21 | return (); 22 | case 'itemList': 23 | return (); 24 | case 'itemDetail': 25 | return (); 26 | default: 27 | return ( 28 | 29 | {path} 30 | 31 | ); 32 | } 33 | }, 34 | 35 | render: function() { 36 | var localDrawer; 37 | return ( 38 | { localDrawer = drawer; }} 40 | drawerWidth={300} 41 | drawerPosition={DrawerLayoutAndroid.positions.Left} 42 | renderNavigationView={() => 43 | } > 44 | 45 | localDrawer.openDrawer()} 49 | style={styles.toolbar} 50 | title={this.props.path} /> 51 | 52 | {this.getChildren(this.props.path)} 53 | 54 | 55 | ); 56 | 57 | } 58 | }); 59 | 60 | module.exports = DrawerView; 61 | -------------------------------------------------------------------------------- /E4WeChatAndroid/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | DrawerLayoutAndroid, 11 | DrawerLayout, 12 | Navigator, 13 | StyleSheet, 14 | ToolbarAndroid, 15 | Text, 16 | View, 17 | } = React; 18 | 19 | var routes = require('./routes'); 20 | var styles = require('./styles'); 21 | 22 | var E4WeChatAndroid = React.createClass({ 23 | render: function() { 24 | var initialRoute = { 25 | path: 'home' 26 | }; 27 | 28 | return ( 29 | Navigator.SceneConfigs.FadeAndroid} 31 | style={styles.container} 32 | initialRoute={initialRoute} 33 | renderScene={routes} 34 | /> 35 | ); 36 | } 37 | }); 38 | 39 | AppRegistry.registerComponent('E4WeChatAndroid', () => E4WeChatAndroid); 40 | -------------------------------------------------------------------------------- /E4WeChatAndroid/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | } = React; 14 | 15 | var E4WeChatAndroid = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.ios.js 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | }); 33 | 34 | var styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('E4WeChatAndroid', () => E4WeChatAndroid); 54 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroid/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroid/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"E4WeChatAndroid" 50 | initialProperties:nil 51 | launchOptions:launchOptions]; 52 | 53 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 54 | UIViewController *rootViewController = [[UIViewController alloc] init]; 55 | rootViewController.view = rootView; 56 | self.window.rootViewController = rootViewController; 57 | [self.window makeKeyAndVisible]; 58 | return YES; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroid/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroid/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroid/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroidTests/E4WeChatAndroidTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface E4WeChatAndroidTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation E4WeChatAndroidTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/E4WeChatAndroidTests/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 | -------------------------------------------------------------------------------- /E4WeChatAndroid/ios/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from the root of your project: 3 | // 4 | // $ react-native bundle --minify 5 | // 6 | // See http://facebook.github.io/react-native/docs/runningondevice.html for more details. 7 | 8 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 9 | -------------------------------------------------------------------------------- /E4WeChatAndroid/item-detail.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Image, 6 | Text, 7 | View, 8 | } = React; 9 | var styles = require('./styles'); 10 | 11 | var ItemDetail = React.createClass({ 12 | render: function() { 13 | return ( 14 | 15 | 19 | 20 | Welcome 21 | 22 | 23 | ); 24 | } 25 | }); 26 | 27 | module.exports = ItemDetail; 28 | -------------------------------------------------------------------------------- /E4WeChatAndroid/item-list.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | ListView, 6 | Text, 7 | TextInput, 8 | ToastAndroid, 9 | TouchableHighlight, 10 | View, 11 | } = React; 12 | var styles = require('./styles'); 13 | var range = require('lodash.range'); 14 | 15 | var ItemList = React.createClass({ 16 | getInitialState: function() { 17 | var ds = new ListView.DataSource({ 18 | rowHasChanged: (r1, r2) => r1 !== r2 19 | }); 20 | var rowList = range(50); 21 | return { 22 | dataSource: ds.cloneWithRows(rowList) 23 | }; 24 | }, 25 | 26 | onPressSubmit: function() { 27 | ToastAndroid.show('Add new item', ToastAndroid.LONG); 28 | }, 29 | 30 | render: function() { 31 | return ( 32 | 33 | {'Row: ' + rowData}} 36 | /> 37 | 39 | Add a new item 40 | 41 | 42 | ); 43 | } 44 | }); 45 | 46 | module.exports = ItemList; 47 | -------------------------------------------------------------------------------- /E4WeChatAndroid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "E4WeChatAndroid", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.11.4" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /E4WeChatAndroid/routes.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | BackAndroid, 6 | Text, 7 | View, 8 | } = React; 9 | var styles = require('./styles'); 10 | var DrawerView = require('./drawer-view'); 11 | 12 | var rnNavigator; 13 | BackAndroid.addEventListener('hardwareBackPress', () => { 14 | if (rnNavigator && rnNavigator.getCurrentRoutes().length > 1) { 15 | rnNavigator.pop(); 16 | return true; 17 | } 18 | return false; 19 | }); 20 | 21 | var Routes = function (route, navigationOperations, onComponentRef) { 22 | // connect to hardwareBackPress 23 | rnNavigator = navigationOperations; 24 | 25 | switch (route.path) { 26 | case 'home': 27 | case 'addItem': 28 | case 'itemList': 29 | case 'itemDetail': 30 | return ( 31 | 34 | ); 35 | break; 36 | case 'splash': 37 | return ( 38 | 39 | 40 | To get started, edit index.android.js 41 | 42 | 43 | ); 44 | default: 45 | } 46 | 47 | return ( 48 | Not found. 49 | ) 50 | }; 51 | 52 | module.exports = Routes; 53 | -------------------------------------------------------------------------------- /E4WeChatAndroid/styles.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | StyleSheet, 6 | } = React; 7 | 8 | var styles = StyleSheet.create({ 9 | container: { 10 | flex: 1, 11 | justifyContent: 'center', 12 | alignItems: 'stretch', 13 | backgroundColor: '#F5FCFF', 14 | }, 15 | welcome: { 16 | fontSize: 20, 17 | textAlign: 'center', 18 | margin: 10, 19 | }, 20 | instructions: { 21 | textAlign: 'center', 22 | color: '#333333', 23 | marginBottom: 5, 24 | }, 25 | toolbar: { 26 | height: 56, 27 | }, 28 | logo: { 29 | width: 100, 30 | height: 100 31 | } 32 | }); 33 | 34 | module.exports = styles; 35 | -------------------------------------------------------------------------------- /E5WeReferAndroid/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/React.js 13 | .*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js 14 | .*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 15 | .*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js 16 | 17 | # Ignore commoner tests 18 | .*/node_modules/commoner/test/.* 19 | 20 | # See https://github.com/facebook/flow/issues/442 21 | .*/react-tools/node_modules/commoner/lib/reader.js 22 | 23 | # Ignore jest 24 | .*/node_modules/jest-cli/.* 25 | 26 | # Ignore Website 27 | .*/website/.* 28 | 29 | [include] 30 | 31 | [libs] 32 | node_modules/react-native/Libraries/react-native/react-native-interface.js 33 | 34 | [options] 35 | module.system=haste 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 40 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub' 41 | 42 | suppress_type=$FlowIssue 43 | suppress_type=$FlowFixMe 44 | suppress_type=$FixMe 45 | 46 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-6]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 47 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-6]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 49 | 50 | [version] 51 | 0.16.0 52 | -------------------------------------------------------------------------------- /E5WeReferAndroid/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # node.js 26 | # 27 | node_modules/ 28 | npm-debug.log 29 | -------------------------------------------------------------------------------- /E5WeReferAndroid/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /E5WeReferAndroid/add-item-view.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | TextInput, 7 | ToastAndroid, 8 | TouchableHighlight, 9 | View, 10 | } = React; 11 | var styles = require('./styles'); 12 | 13 | var AddItemView = React.createClass({ 14 | getInitialState: function() { 15 | return { 16 | firstName: '', 17 | lastName: '', 18 | phoneNumber: '' 19 | }; 20 | }, 21 | 22 | onPressSubmit: function() { 23 | var state = 'First name: ' + this.state.firstName + '\n' + 24 | 'Last name: ' + this.state.lastName + '\n' + 25 | 'Phone number: ' + this.state.phoneNumber; 26 | ToastAndroid.show(state, ToastAndroid.LONG); 27 | }, 28 | 29 | render: function() { 30 | return ( 31 | 32 | this.setState({ 36 | firstName: text 37 | })} 38 | /> 39 | this.setState({ 43 | lastName: text 44 | })} 45 | /> 46 | this.setState({ 50 | phoneNumber: text 51 | })} 52 | keyboardType='numeric' 53 | /> 54 | 58 | Add a new item 59 | 60 | 61 | ); 62 | } 63 | }); 64 | 65 | module.exports = AddItemView; 66 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.e5wereferandroid" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile 'com.android.support:appcompat-v7:23.0.1' 28 | compile 'com.facebook.react:react-native:0.12.+' 29 | } 30 | -------------------------------------------------------------------------------- /E5WeReferAndroid/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 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/drawable-xxhdpi/ic_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/drawable-xxhdpi/ic_logo.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | E5WeReferAndroid 3 | 4 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /E5WeReferAndroid/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:1.3.1' 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 | } 20 | } 21 | -------------------------------------------------------------------------------- /E5WeReferAndroid/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 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/E5WeReferAndroid/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /E5WeReferAndroid/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.4-all.zip 6 | -------------------------------------------------------------------------------- /E5WeReferAndroid/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'E5WeReferAndroid' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /E5WeReferAndroid/drawer-layout-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | DrawerLayoutAndroid, 6 | ToolbarAndroid, 7 | Text, 8 | View, 9 | } = React; 10 | var styles = require('./styles'); 11 | var NavigationView = require('./navigation-view'); 12 | var AddItemView = require('./add-item-view'); 13 | var ItemDetailView = require('./item-detail-view'); 14 | var ItemListView = require('./item-list-view'); 15 | 16 | var DrawerLayoutView = React.createClass({ 17 | getChildren: function(path) { 18 | var children; 19 | switch (path) { 20 | case 'addItem': 21 | return ( 22 | 23 | ); 24 | case 'itemList': 25 | return ( 26 | 27 | ); 28 | case 'itemDetail': 29 | return ( 30 | 31 | ); 32 | default: 33 | return ( 34 | 35 | main view 36 | 37 | {path} 38 | 39 | ); 40 | } 41 | }, 42 | 43 | render: function() { 44 | var localDrawer; 45 | return ( 46 | { localDrawer = drawer; }} 48 | drawerWidth={200} 49 | drawerPosition={DrawerLayoutAndroid.positions.Left} 50 | renderNavigationView={() => 51 | 52 | } 53 | > 54 | 55 | localDrawer.openDrawer()} 59 | style={styles.toolbar} 60 | title={this.props.path} /> 61 | 62 | {this.getChildren(this.props.path)} 63 | 64 | 65 | ); 66 | 67 | } 68 | }); 69 | 70 | module.exports = DrawerLayoutView; 71 | -------------------------------------------------------------------------------- /E5WeReferAndroid/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | Navigator, 11 | StyleSheet, 12 | Text, 13 | View, 14 | } = React; 15 | 16 | var routes = require('./routes'); 17 | var styles = require('./styles'); 18 | 19 | var E5WeReferAndroid = React.createClass({ 20 | render: function() { 21 | var initialRoute = { 22 | path: 'home' 23 | }; 24 | 25 | return ( 26 | Navigator.SceneConfigs.FadeAndroid} 28 | style={styles.container} 29 | initialRoute={initialRoute} 30 | renderScene={routes} 31 | /> 32 | ); 33 | } 34 | }); 35 | 36 | AppRegistry.registerComponent('E5WeReferAndroid', () => E5WeReferAndroid); 37 | -------------------------------------------------------------------------------- /E5WeReferAndroid/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | } = React; 14 | 15 | var E5WeReferAndroid = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.ios.js 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | }); 33 | 34 | var styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('E5WeReferAndroid', () => E5WeReferAndroid); 54 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroid/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroid/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"E5WeReferAndroid" 50 | initialProperties:nil 51 | launchOptions:launchOptions]; 52 | 53 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 54 | UIViewController *rootViewController = [[UIViewController alloc] init]; 55 | rootViewController.view = rootView; 56 | self.window.rootViewController = rootViewController; 57 | [self.window makeKeyAndVisible]; 58 | return YES; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroid/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroid/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroid/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroidTests/E5WeReferAndroidTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface E5WeReferAndroidTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation E5WeReferAndroidTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/E5WeReferAndroidTests/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 | -------------------------------------------------------------------------------- /E5WeReferAndroid/ios/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from the root of your project: 3 | // 4 | // $ react-native bundle --minify 5 | // 6 | // See http://facebook.github.io/react-native/docs/runningondevice.html for more details. 7 | 8 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 9 | -------------------------------------------------------------------------------- /E5WeReferAndroid/item-detail-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Image, 6 | Text, 7 | View, 8 | } = React; 9 | var styles = require('./styles'); 10 | 11 | var ItemDetail = React.createClass({ 12 | render: function() { 13 | return ( 14 | 15 | 19 | 20 | Welcome 21 | 22 | 23 | ); 24 | } 25 | }); 26 | 27 | module.exports = ItemDetail; 28 | -------------------------------------------------------------------------------- /E5WeReferAndroid/item-list-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | ListView, 6 | Text, 7 | View, 8 | } = React; 9 | var styles = require('./styles'); 10 | var range = require('lodash.range'); 11 | 12 | var ItemList = React.createClass({ 13 | getInitialState: function() { 14 | var ds = new ListView.DataSource({ 15 | rowHasChanged: (r1, r2) => r1 !== r2 16 | }); 17 | var rowList = range(50); 18 | return { 19 | dataSource: ds.cloneWithRows(rowList) 20 | }; 21 | }, 22 | 23 | render: function() { 24 | return ( 25 | 26 | {'Row: ' + rowData}} 29 | /> 30 | 31 | ); 32 | } 33 | }); 34 | 35 | module.exports = ItemList; 36 | -------------------------------------------------------------------------------- /E5WeReferAndroid/navigation-view.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | DrawerLayoutAndroid, 6 | ListView, 7 | ToolbarAndroid, 8 | TouchableHighlight, 9 | Text, 10 | View, 11 | } = React; 12 | var styles = require('./styles'); 13 | 14 | var NavigationView = React.createClass({ 15 | selectMenuItem: function(menuItem) { 16 | this.props.navigator.push({ 17 | title: menuItem.title, 18 | path: menuItem.path 19 | }); 20 | }, 21 | 22 | renderMenuItem: function(menuItem) { 23 | return ( 24 | this.selectMenuItem(menuItem)} 26 | style={styles.navigationMenuItem} > 27 | {menuItem.title} 28 | 29 | ); 30 | }, 31 | 32 | render: function() { 33 | var dataSource = new ListView.DataSource({ 34 | rowHasChanged: (row1, row2) => row1 !== row2, 35 | }); 36 | 37 | return ( 38 | 39 | 64 | 65 | ); 66 | } 67 | }); 68 | 69 | module.exports = NavigationView; 70 | -------------------------------------------------------------------------------- /E5WeReferAndroid/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "E5WeReferAndroid", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "lodash.range": "^3.0.1", 10 | "react-native": "^0.12.0" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /E5WeReferAndroid/routes.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | Text, 6 | View, 7 | } = React; 8 | var styles = require('./styles'); 9 | var DrawerLayoutView = require('./drawer-layout-view'); 10 | 11 | var Routes = function (route, navigationOperations, onComponentRef) { 12 | switch (route.path) { 13 | case 'home': 14 | case 'addItem': 15 | case 'itemList': 16 | case 'itemDetail': 17 | return ( 18 | 21 | ); 22 | break; 23 | case 'splash': 24 | return ( 25 | 26 | 27 | Routes for splash 28 | 29 | 30 | ); 31 | default: 32 | } 33 | 34 | return ( 35 | Not found. 36 | ) 37 | }; 38 | 39 | module.exports = Routes; 40 | -------------------------------------------------------------------------------- /E5WeReferAndroid/styles.android.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | StyleSheet, 6 | } = React; 7 | 8 | var styles = StyleSheet.create({ 9 | container: { 10 | flex: 1, 11 | justifyContent: 'center', 12 | alignItems: 'stretch', 13 | backgroundColor: '#F5FCFF', 14 | }, 15 | welcome: { 16 | fontSize: 20, 17 | textAlign: 'center', 18 | margin: 10, 19 | }, 20 | instructions: { 21 | textAlign: 'center', 22 | color: '#333333', 23 | marginBottom: 5, 24 | }, 25 | toolbar: { 26 | height: 56, 27 | }, 28 | logo: { 29 | width: 100, 30 | height: 100 31 | }, 32 | navigationView: { 33 | flex: 1, 34 | backgroundColor: '#fff', 35 | }, 36 | navigationMenuItem: { 37 | height: 60, 38 | padding: 30, 39 | }, 40 | addItemView: { 41 | alignItems: 'center', 42 | }, 43 | addItemButton: { 44 | width: 200, 45 | height: 60, 46 | padding: 10, 47 | justifyContent: 'center', 48 | alignItems: 'center', 49 | backgroundColor: '#1EACC7', 50 | }, 51 | addItemButtonText: { 52 | color: '#fff', 53 | } 54 | }); 55 | 56 | module.exports = styles; 57 | -------------------------------------------------------------------------------- /HackerNews-React-Native/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | android/.gradle/ 25 | # node.js 26 | # 27 | node_modules/ 28 | npm-debug.log 29 | -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Network/api.js: -------------------------------------------------------------------------------- 1 | var API_KEY = 'u86xPDUfORcuSqUoaJJvxrIB9xJp0Atg' 2 | var API_URL = 'https://www.kimonolabs.com/api/d3rpj7om' 3 | var PARAMS = '?apikey=' + API_KEY; 4 | exports.REQUEST_URL = API_URL + PARAMS; 5 | exports.HN_ITEM_ENDPOINT = 'https://hacker-news.firebaseio.com/v0/item/'; -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Utils/functions.js: -------------------------------------------------------------------------------- 1 | exports.getId = function (postUrl){ return (postUrl.split("="))[1] }; 2 | exports.htmlToString = function (str) { 3 | return String(str).replace(/

/g, '\n\n').replace(///g, '/').replace('', '').replace('', '').replace(/'/g, '\'').replace(/"/g, '\"').replace(/]*?\s+)?href="([^"]*)" rel="nofollow">(.*)?<\/a>/g, "$1"); 4 | }; -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Post/Elements/CommentCell/style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | StyleSheet, 12 | } = React; 13 | 14 | module.exports = StyleSheet.create({ 15 | container: { 16 | flexDirection: 'column', 17 | borderWidth: 0.5, 18 | borderColor: 'gray', 19 | borderRadius: 5, 20 | marginRight:10, 21 | marginTop:5, 22 | padding:10, 23 | }, 24 | commentBy: { 25 | fontSize: 13, 26 | marginBottom: 3, 27 | textAlign: 'left', 28 | color: '#FF6600' 29 | }, 30 | commentText: { 31 | fontSize: 13, 32 | textAlign: 'left', 33 | color: '#000000' 34 | }, 35 | showRepliesLink:{ 36 | marginTop: 3, 37 | fontSize: 13, 38 | textAlign: 'right', 39 | color: '#FF6600', 40 | }, 41 | commentCode:{ 42 | fontFamily: 'Courier New', 43 | fontSize: 12, 44 | }, 45 | parseHTMLStyle:{ 46 | backgroundColor: '#F6F6EF', 47 | textAlign: 'left', 48 | }, 49 | }); -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Post/style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | StyleSheet, 12 | } = React; 13 | 14 | module.exports = StyleSheet.create({ 15 | container: { 16 | flex:1, 17 | backgroundColor: '#F6F6EF', 18 | flexDirection: 'column', 19 | }, 20 | head: { 21 | marginLeft:10, 22 | marginRight:10, 23 | marginBottom:5, 24 | }, 25 | foot: { 26 | flex:2 27 | }, 28 | title:{ 29 | fontSize: 20, 30 | textAlign: 'left', 31 | marginTop: 10, 32 | marginBottom: 10, 33 | color: '#FF6600', 34 | }, 35 | text:{ 36 | fontSize: 14, 37 | marginBottom: 3, 38 | }, 39 | source:{ 40 | fontSize: 15, 41 | textAlign: 'left', 42 | color: '#0089FF', 43 | }, 44 | separator: { 45 | height: 0.5, 46 | backgroundColor: '#CCCCCC', 47 | }, 48 | loadingText:{ 49 | color: '#FF6600', 50 | marginTop: 5, 51 | fontSize: 15, 52 | }, 53 | commentTitle: { 54 | marginTop: 10, 55 | color: 'gray', 56 | }, 57 | commentsLoading: { 58 | marginLeft: 10, 59 | color: '#FF6600', 60 | }, 61 | commentListView:{ 62 | color: '#000000', 63 | margin: 0, 64 | padding: 0, 65 | backgroundColor: '#F6F6EF', 66 | }, 67 | postDetailsLine: { 68 | fontSize: 12, 69 | marginBottom: 10, 70 | color: 'gray', 71 | }, 72 | }); -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Posts/Elements/PostCell/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | Text, 12 | View, 13 | TouchableHighlight 14 | } = React; 15 | 16 | var styles = require("./style"); 17 | 18 | var PostCell = React.createClass({ 19 | render: function() { 20 | return ( 21 | 22 | 23 | 24 | {this.props.post.count} 25 | 26 | 27 | 28 | {this.props.post.title.text} 29 | 30 | 31 | Posted by {this.props.post.username.text} | {(this.props.post.points).split(" ")[0]} Points | {(this.props.post.comments.text).split(" ")[0]} Comments 32 | 33 | 34 | 35 | 36 | 37 | ); 38 | } 39 | }); 40 | 41 | module.exports = PostCell; -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Posts/Elements/PostCell/style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | StyleSheet, 12 | } = React; 13 | 14 | module.exports = StyleSheet.create({ 15 | container: { 16 | flex: 1, 17 | flexDirection: 'row', 18 | justifyContent: 'center', 19 | alignItems: 'center', 20 | backgroundColor: '#F6F6EF', 21 | }, 22 | postCount: { 23 | fontSize: 20, 24 | textAlign: 'right', 25 | margin: 10, 26 | color: 'gray', 27 | marginLeft: 15, 28 | }, 29 | postDetailsContainer:{ 30 | flex: 1, 31 | }, 32 | postTitle: { 33 | fontSize: 15, 34 | textAlign: 'left', 35 | marginTop: 10, 36 | marginBottom: 4, 37 | marginRight: 10, 38 | color: '#FF6600' 39 | }, 40 | postDetailsLine: { 41 | fontSize: 12, 42 | marginBottom: 10, 43 | color: 'gray', 44 | }, 45 | separator: { 46 | height: 0.5, 47 | backgroundColor: '#CCCCCC', 48 | }, 49 | }); -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Posts/style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | StyleSheet, 12 | } = React; 13 | 14 | module.exports = StyleSheet.create({ 15 | container: { 16 | backgroundColor: '#F6F6EF', 17 | }, 18 | loadingText: { 19 | fontSize: 25, 20 | textAlign: 'center', 21 | marginTop: 10, 22 | marginBottom: 10, 23 | marginRight: 10, 24 | color: '#FF6600' 25 | }, 26 | postsListView:{ 27 | backgroundColor: '#F6F6EF', 28 | } 29 | }); -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Web/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | var { 10 | View, 11 | WebView, 12 | } = React; 13 | 14 | var styles = require('./style'); 15 | 16 | var Web = React.createClass({ 17 | render: function() { 18 | return ( 19 | 20 | 21 | 22 | ); 23 | } 24 | }); 25 | 26 | module.exports = Web; -------------------------------------------------------------------------------- /HackerNews-React-Native/App/Views/Web/style.js: -------------------------------------------------------------------------------- 1 | /* 2 | Coded by: Simar (github.com/iSimar) 3 | GitHub Project: https://github.com/iSimar/HackerNews-React-Native 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var React = require('react-native'); 9 | 10 | var { 11 | StyleSheet, 12 | } = React; 13 | 14 | module.exports = StyleSheet.create({ 15 | container: { 16 | flex: 1, 17 | backgroundColor: '#F6F6EF', 18 | flexDirection: 'column', 19 | }, 20 | }); -------------------------------------------------------------------------------- /HackerNews-React-Native/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Simar Singh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /HackerNews-React-Native/README.md: -------------------------------------------------------------------------------- 1 | [**Support me with a Follow**](https://github.com/iSimar/followers) 2 | 3 | # HackerNews-React-Native 4 | 5 | [Hacker News](https://news.ycombinator.com/) reader for iOS and Android, made with [React-Native](https://github.com/facebook/react-native). 6 | 7 | This project uses [ParseHTML](https://github.com/iSimar/ParseHTML-React-Native) to render HTML code in the Application. 8 | 9 | ## iOS Screenshots: 10 |

11 | 12 | 13 | 14 |
15 | 16 | ## Android Screenshots 17 |
18 | 19 | 20 |
21 | ## Known Issues 22 | * WebView is not working for Android App 23 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.hackernews" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile 'com.android.support:appcompat-v7:23.0.0' 28 | compile 'com.facebook.react:react-native:0.11.+' 29 | compile project(':RNWebIntent') 30 | } 31 | -------------------------------------------------------------------------------- /HackerNews-React-Native/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 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/drawable-hdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/drawable-mdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/drawable-xhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/drawable-xxxhdpi/ic_arrow_back_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/drawable-xxxhdpi/ic_arrow_back_white_24dp.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HackerNews 3 | 4 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /HackerNews-React-Native/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:1.3.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 | } 20 | } 21 | -------------------------------------------------------------------------------- /HackerNews-React-Native/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 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/HackerNews-React-Native/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /HackerNews-React-Native/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.4-all.zip 6 | -------------------------------------------------------------------------------- /HackerNews-React-Native/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'HackerNews' 2 | 3 | include ':RNWebIntent', ':app' 4 | project (':RNWebIntent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webintent') 5 | -------------------------------------------------------------------------------- /HackerNews-React-Native/index.ios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | 5 | var { 6 | AppRegistry, 7 | StyleSheet, 8 | NavigatorIOS, 9 | } = React; 10 | 11 | var PostsView = require('./App/Views/Posts'); 12 | 13 | var HackerNews = React.createClass({ 14 | render: function() { 15 | return ( 16 | 23 | ); 24 | } 25 | }); 26 | 27 | var styles = StyleSheet.create({ 28 | container: { 29 | flex: 1, 30 | backgroundColor: '#F6F6EF', 31 | }, 32 | }); 33 | 34 | AppRegistry.registerComponent('HackerNews', () => HackerNews); 35 | 36 | module.exports = HackerNews; -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNews/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNews/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"HackerNews" 50 | initialProperties:nil 51 | launchOptions:launchOptions]; 52 | 53 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 54 | UIViewController *rootViewController = [[UIViewController alloc] init]; 55 | rootViewController.view = rootView; 56 | self.window.rootViewController = rootViewController; 57 | [self.window makeKeyAndVisible]; 58 | return YES; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNews/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNews/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNews/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNewsTests/HackerNewsTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface HackerNewsTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation HackerNewsTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/HackerNewsTests/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 | -------------------------------------------------------------------------------- /HackerNews-React-Native/ios/main.jsbundle: -------------------------------------------------------------------------------- 1 | // Offline JS 2 | // To re-generate the offline bundle, run this from the root of your project: 3 | // 4 | // $ react-native bundle --minify 5 | // 6 | // See http://facebook.github.io/react-native/docs/runningondevice.html for more details. 7 | 8 | throw new Error('Offline JS file is empty. See iOS/main.jsbundle for instructions'); 9 | -------------------------------------------------------------------------------- /HackerNews-React-Native/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HackerNews", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.11.0", 10 | "react-native-webintent": "^1.0.1" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SF-React-Native-Meetup 2 | Learn React Native by building different apps 3 | -------------------------------------------------------------------------------- /Z1PropertyFinder/PropertyView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | StyleSheet, 6 | Image, 7 | View, 8 | Text, 9 | Component 10 | } = React; 11 | 12 | var styles = StyleSheet.create({ 13 | container: { 14 | marginTop: 65 15 | }, 16 | heading: { 17 | backgroundColor: '#F8F8F8', 18 | }, 19 | separator: { 20 | height: 1, 21 | backgroundColor: '#DDDDDD' 22 | }, 23 | image: { 24 | width: 400, 25 | height: 300 26 | }, 27 | price: { 28 | fontSize: 25, 29 | fontWeight: 'bold', 30 | margin: 5, 31 | color: '#48BBEC' 32 | }, 33 | title: { 34 | fontSize: 20, 35 | margin: 5, 36 | color: '#656565' 37 | }, 38 | description: { 39 | fontSize: 18, 40 | margin: 5, 41 | color: '#656565' 42 | } 43 | }); 44 | 45 | class PropertyView extends Component { 46 | 47 | render() { 48 | var property = this.props.property; 49 | var stats = property.bedroom_number + ' bed ' + property.property_type; 50 | if (property.bathroom_number) { 51 | stats += ', ' + property.bathroom_number + ' ' + (property.bathroom_number > 1 52 | ? 'bathrooms' : 'bathroom'); 53 | } 54 | 55 | var price = property.price_formatted.split(' ')[0]; 56 | 57 | return ( 58 | 59 | 61 | 62 | £{price} 63 | {property.title} 64 | 65 | 66 | {stats} 67 | {property.summary} 68 | 69 | ); 70 | } 71 | }; 72 | 73 | module.exports = PropertyView; -------------------------------------------------------------------------------- /Z1PropertyFinder/README.md: -------------------------------------------------------------------------------- 1 | # React Native PropertyFinder App 2 | 3 | This repository accompanies the [tutorial I published on Ray Wenderlich's website](http://www.raywenderlich.com/99473/introducing-react-native-building-apps-javascript), which describes the process of building a simple property search application using React Native. 4 | 5 | The project was created using the `react-native-cli` tool: 6 | 7 | react-native init PropertyFinder 8 | 9 | To run this project you need to fetch the node dependencies using the following command: 10 | 11 | npm install 12 | -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | // Loading JavaScript code - uncomment the one you want. 21 | 22 | // OPTION 1 23 | // Load from development server. Start the server from the repository root: 24 | // 25 | // $ npm start 26 | // 27 | // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and 28 | // iOS device are on the same Wi-Fi network. 29 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 30 | 31 | // OPTION 2 32 | // Load from pre-bundled file on disk. To re-generate the static bundle, run 33 | // 34 | // $ curl http://localhost:8081/index.ios.bundle -o main.jsbundle 35 | // 36 | // and uncomment the next following line 37 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 38 | 39 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 40 | moduleName:@"PropertyFinder" 41 | launchOptions:launchOptions]; 42 | 43 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 44 | UIViewController *rootViewController = [[UIViewController alloc] init]; 45 | rootViewController.view = rootView; 46 | self.window.rootViewController = rootViewController; 47 | [self.window makeKeyAndVisible]; 48 | return YES; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Images.xcassets/house.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "house.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "house@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "house@3x.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house.png -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house@2x.png -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/Z1PropertyFinder/iOS/Images.xcassets/house.imageset/house@3x.png -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSLocationWhenInUseUsageDescription 6 | Property Finder would like to find properties nearby 7 | CFBundleDevelopmentRegion 8 | en 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 | 42 | 43 | -------------------------------------------------------------------------------- /Z1PropertyFinder/iOS/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Z1PropertyFinder/index.ios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var SearchPage = require('./SearchPage'); 5 | 6 | var styles = React.StyleSheet.create({ 7 | container: { 8 | flex: 1 9 | } 10 | }); 11 | 12 | class PropertyFinderApp extends React.Component { 13 | render() { 14 | return ( 15 | 21 | ); 22 | } 23 | } 24 | 25 | class HelloWorld extends React.Component { 26 | render() { 27 | return Hello World (Again); 28 | } 29 | } 30 | 31 | React.AppRegistry.registerComponent('PropertyFinder', 32 | function() { return PropertyFinderApp }); 33 | -------------------------------------------------------------------------------- /Z1PropertyFinder/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PropertyFinder", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.3.1" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/React.js 13 | .*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js 14 | .*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 15 | .*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js 16 | 17 | 18 | # Ignore commoner tests 19 | .*/node_modules/commoner/test/.* 20 | 21 | # See https://github.com/facebook/flow/issues/442 22 | .*/react-tools/node_modules/commoner/lib/reader.js 23 | 24 | # Ignore jest 25 | .*/react-native/node_modules/jest-cli/.* 26 | 27 | [include] 28 | 29 | [libs] 30 | node_modules/react-native/Libraries/react-native/react-native-interface.js 31 | 32 | [options] 33 | module.system=haste 34 | 35 | munge_underscores=true 36 | 37 | suppress_type=$FlowIssue 38 | suppress_type=$FlowFixMe 39 | suppress_type=$FixMe 40 | 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 44 | 45 | [version] 46 | 0.14.0 47 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | .idea/ 25 | taskArtifacts/ 26 | local.properties 27 | 28 | 29 | # node.js 30 | # 31 | node_modules/ 32 | npm-debug.log 33 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 race604 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/README.md: -------------------------------------------------------------------------------- 1 | [![Android Gems](http://www.android-gems.com/badge/race604/ZhiHuDaily-React-Native.svg?branch=master)](http://www.android-gems.com/lib/race604/ZhiHuDaily-React-Native) 2 | 3 | # ZhiHuDaily-React-Native 4 | 5 | The is a [Zhihu Daily](http://daily.zhihu.com/) App client, implemented using [**React Native**](http://facebook.github.io/react-native/) for Android. The is a demo project to show how to develop a compelet app with React Native. (The data api is from [ZhihuDailyPurify](https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90)) 6 | 7 | ## How does it look like? 8 | 9 | * The home page 10 | 11 | ![](./art/home.jpg) 12 | 13 | * The drawer 14 | 15 | ![](./art/drawer.jpg) 16 | 17 | * The content page 18 | 19 | ![](./art/content.jpg) 20 | 21 | ## How to run 22 | 23 | 1. Prepare your environment: [Requirements](http://facebook.github.io/react-native/docs/getting-started.html#requirements) and [Android Setup](http://facebook.github.io/react-native/docs/android-setup.html) 24 | 2. Clone this repo, and goto the project root directory 25 | 3. run `npm install` 26 | 4. run `react-native run-android` 27 | 5. Enjoy 28 | 29 | ## Related content 30 | 31 | In this project, I used most of technology in React Native: 32 | 33 | * Flex Style 34 | * Direct Manipulation 35 | * Native UI Components 36 | * DrawerLayoutAndroid 37 | * Image/Text/ListView 38 | * TouchableHighlight/TouchableNativeFeedback 39 | * ToolbarAndroid/Navigator 40 | * StyleSheet/ToastAndroid/BackAndroid 41 | * Timers 42 | * AsyncStorage 43 | * Animations 44 | * ... 45 | 46 | ## TODO 47 | 48 | 1. ~~Add local storage to cache data~~ (done) 49 | 2. Add List header banner (Like ViewPager?) 50 | 3. ~~Add splash animation~~ (done) 51 | 4. ~~Add swipe/pull to refresh~~ (done) 52 | 5. Working on incomplete features 53 | 6. **iOS compatible** 54 | 55 | ## License 56 | 57 | This project is available under the MIT license. 58 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/WebView.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react-native'); 4 | var { 5 | requireNativeComponent, 6 | PropTypes 7 | } = React; 8 | 9 | class ObservableWebView extends React.Component { 10 | constructor() { 11 | super(); 12 | this._onChange = this._onChange.bind(this); 13 | } 14 | 15 | _onChange(event: Event) { 16 | if (!this.props.onScrollChange) { 17 | return; 18 | } 19 | this.props.onScrollChange(event.nativeEvent.ScrollY); 20 | } 21 | 22 | render() { 23 | return ; 24 | } 25 | } 26 | 27 | ObservableWebView.propTypes = { 28 | url: PropTypes.string, 29 | html: PropTypes.string, 30 | css: PropTypes.string, 31 | onScrollChange: PropTypes.func, 32 | }; 33 | 34 | var RCTWebView = requireNativeComponent('RCTWebView', ObservableWebView, { 35 | nativeOnly: {onChange: true} 36 | }); 37 | 38 | module.exports = ObservableWebView; 39 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/RCTZhiHuDaily.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.rctzhihudaily" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | 18 | signingConfigs { 19 | release { 20 | // storeFile file(RELEASE_STORE_FILE) 21 | // storePassword RELEASE_STORE_PASSWORD 22 | // keyAlias RELEASE_KEY_ALIAS 23 | // keyPassword RELEASE_KEY_PASSWORD 24 | } 25 | } 26 | 27 | buildTypes { 28 | release { 29 | signingConfig signingConfigs.release 30 | minifyEnabled false 31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | } 35 | 36 | dependencies { 37 | compile fileTree(dir: 'libs', include: ['*.jar']) 38 | compile 'com.android.support:appcompat-v7:23.0.0' 39 | compile 'com.facebook.react:react-native:0.11.+' 40 | } 41 | 42 | final def TARGET_BUNDLE_DIR = 'app/src/main/assets/' 43 | final def TARGET_BUNDLE_FILE = 'ReactNativeDevBundle.js' 44 | final def DOWNLOAD_URL = 'http://localhost:8081/index.android.bundle?platform=android' 45 | 46 | task downloadJSBundle << { 47 | def dir = new File(TARGET_BUNDLE_DIR) 48 | if (!dir.exists()) { 49 | dir.mkdirs() 50 | } 51 | def f = new File(TARGET_BUNDLE_DIR + TARGET_BUNDLE_FILE) 52 | if (f.exists()) { 53 | f.delete() 54 | } 55 | try { 56 | new URL(DOWNLOAD_URL).withInputStream{ i -> f.withOutputStream{ it << i }} 57 | } catch (Exception e) { 58 | e.printStackTrace() 59 | } 60 | 61 | } 62 | 63 | preBuild.dependsOn downloadJSBundle 64 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/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 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/java/com/race604/react/view/MyReactPackage.java: -------------------------------------------------------------------------------- 1 | package com.race604.react.view; 2 | 3 | import com.facebook.react.bridge.ReactApplicationContext; 4 | import com.facebook.react.shell.MainReactPackage; 5 | import com.facebook.react.uimanager.ViewManager; 6 | import com.race604.react.view.swiperefresh.ReactSwipeRefreshLayoutManager; 7 | import com.race604.react.view.webview.ReactWebViewManager; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * Created by Jing on 15/9/22. 14 | */ 15 | public class MyReactPackage extends MainReactPackage { 16 | 17 | @Override 18 | public List createViewManagers(ReactApplicationContext reactContext) { 19 | List main = super.createViewManagers(reactContext); 20 | List result = new ArrayList<>(); 21 | result.addAll(main); 22 | result.add(new ReactWebViewManager()); 23 | result.add(new ReactSwipeRefreshLayoutManager()); 24 | 25 | return result; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/java/com/race604/react/view/swiperefresh/ReactSwipeRefreshLayout.java: -------------------------------------------------------------------------------- 1 | package com.race604.react.view.swiperefresh; 2 | 3 | import android.support.v4.widget.SwipeRefreshLayout; 4 | import android.util.Log; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ScrollView; 9 | 10 | import com.facebook.react.bridge.ReactContext; 11 | import com.facebook.react.uimanager.events.NativeGestureUtil; 12 | 13 | /** 14 | * Created by Jing on 15/9/30. 15 | */ 16 | public class ReactSwipeRefreshLayout extends SwipeRefreshLayout { 17 | 18 | private static final String TAG = "NativeView"; 19 | private ScrollView mScrollChild = null; 20 | 21 | public ReactSwipeRefreshLayout(ReactContext context) { 22 | super(context); 23 | } 24 | 25 | @Override 26 | public boolean onInterceptTouchEvent(MotionEvent ev) { 27 | 28 | if (mScrollChild != null && mScrollChild.getScrollY() > 0) { 29 | return false; 30 | } 31 | 32 | if (super.onInterceptTouchEvent(ev)) { 33 | NativeGestureUtil.notifyNativeGestureStarted(this, ev); 34 | return true; 35 | } 36 | 37 | return false; 38 | } 39 | 40 | @Override 41 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 42 | super.onLayout(changed, left, top, right, bottom); 43 | mScrollChild = findScrollChild(this); 44 | } 45 | 46 | private ScrollView findScrollChild(View root) { 47 | View child = root; 48 | while (child instanceof ViewGroup) { 49 | child = ((ViewGroup) child).getChildAt(0); 50 | if (child instanceof ScrollView) { 51 | return (ScrollView) child; 52 | } 53 | } 54 | return null; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/java/com/race604/react/view/swiperefresh/event/RefreshEvent.java: -------------------------------------------------------------------------------- 1 | package com.race604.react.view.swiperefresh.event; 2 | 3 | import com.facebook.react.bridge.Arguments; 4 | import com.facebook.react.uimanager.events.Event; 5 | import com.facebook.react.uimanager.events.RCTEventEmitter; 6 | 7 | /** 8 | * Created by Jing on 15/10/1. 9 | */ 10 | public class RefreshEvent extends Event { 11 | 12 | public static final String EVENT_NAME = "topSwipeRefresh"; 13 | 14 | public RefreshEvent(int viewTag, long timestampMs) { 15 | super(viewTag, timestampMs); 16 | } 17 | 18 | @Override 19 | public String getEventName() { 20 | return EVENT_NAME; 21 | } 22 | 23 | @Override 24 | public short getCoalescingKey() { 25 | return 0; 26 | } 27 | 28 | @Override 29 | public void dispatch(RCTEventEmitter rctEventEmitter) { 30 | rctEventEmitter.receiveEvent(getViewTag(), getEventName(), Arguments.createMap()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/java/com/race604/react/view/webview/ObservableWebView.java: -------------------------------------------------------------------------------- 1 | package com.race604.react.view.webview; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.util.AttributeSet; 7 | import android.webkit.WebView; 8 | 9 | import com.facebook.react.bridge.Arguments; 10 | import com.facebook.react.bridge.ReactContext; 11 | import com.facebook.react.bridge.WritableMap; 12 | import com.facebook.react.uimanager.events.RCTEventEmitter; 13 | 14 | /** 15 | * Created by Jing on 15/9/22. 16 | */ 17 | public class ObservableWebView extends WebView { 18 | 19 | public ObservableWebView(Context context) { 20 | super(context); 21 | } 22 | 23 | public ObservableWebView(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | public ObservableWebView(Context context, AttributeSet attrs, int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | } 30 | 31 | @TargetApi(Build.VERSION_CODES.LOLLIPOP) 32 | public ObservableWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 33 | super(context, attrs, defStyleAttr, defStyleRes); 34 | } 35 | 36 | public ObservableWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) { 37 | super(context, attrs, defStyleAttr, privateBrowsing); 38 | } 39 | 40 | @Override 41 | protected void onScrollChanged(final int l, final int t, final int oldl, final int oldt) 42 | { 43 | super.onScrollChanged(l, t, oldl, oldt); 44 | 45 | WritableMap event = Arguments.createMap(); 46 | event.putInt("ScrollX", l); 47 | event.putInt("ScrollY", t); 48 | ReactContext reactContext = (ReactContext)getContext(); 49 | reactContext.getJSModule(RCTEventEmitter.class).receiveEvent( 50 | getId(), "topChange", event); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/java/com/race604/react/view/webview/ReactWebViewManager.java: -------------------------------------------------------------------------------- 1 | package com.race604.react.view.webview; 2 | 3 | import com.facebook.react.uimanager.CatalystStylesDiffMap; 4 | import com.facebook.react.uimanager.SimpleViewManager; 5 | import com.facebook.react.uimanager.ThemedReactContext; 6 | import com.facebook.react.uimanager.UIProp; 7 | 8 | /** 9 | * Created by Jing on 15/9/22. 10 | */ 11 | public class ReactWebViewManager extends SimpleViewManager { 12 | 13 | public static final String REACT_CLASS = "RCTWebView"; 14 | 15 | @UIProp(UIProp.Type.STRING) 16 | public static final String PROP_URL = "url"; 17 | 18 | @UIProp(UIProp.Type.STRING) 19 | public static final String PROP_HTML = "html"; 20 | 21 | @UIProp(UIProp.Type.STRING) 22 | public static final String PROP_CSS = "css"; 23 | 24 | @Override 25 | public String getName() { 26 | return REACT_CLASS; 27 | } 28 | 29 | @Override 30 | protected ObservableWebView createViewInstance(ThemedReactContext reactContext) { 31 | return new ObservableWebView(reactContext); 32 | } 33 | 34 | @Override 35 | public void updateView(final ObservableWebView webView, CatalystStylesDiffMap props) { 36 | super.updateView(webView, props); 37 | if (props.hasKey(PROP_URL)) { 38 | webView.loadUrl(props.getString(PROP_URL)); 39 | } 40 | 41 | if (props.hasKey(PROP_HTML)) { 42 | String html = props.getString(PROP_HTML); 43 | if (props.hasKey(PROP_CSS)) { 44 | String css = props.getString(PROP_CSS); 45 | html = "" + html; 46 | } 47 | webView.loadData(html, "text/html; charset=utf-8", "UTF-8"); 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/account_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/account_avatar.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/comment_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/comment_avatar.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/home.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_back_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_collect_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_collect_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_collected_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_collected_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_comment_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_comment_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_download_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_download_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_favorites_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_favorites_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_logo.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_arrow.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_follow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_follow.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_menu_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_message_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_message_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_more_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_more_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_praise_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_praise_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_share_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/ic_share_white.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/menu_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/menu_home.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/splash_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable-xxhdpi/splash_logo.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/drawable/splash.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 知乎日报-RN版 4 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ZhiHuDaily-RN 3 | 4 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/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:1.3.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 | } 20 | } 21 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/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 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/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.4-all.zip 6 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'RCTZhiHuDaily' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/art/content.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/art/content.jpg -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/art/drawer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/art/drawer.jpg -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/art/home.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ZhiHuDaily-React-Native/art/home.jpg -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | } = React; 14 | 15 | var RCTZhiHuDaily = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.ios.js 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | }); 33 | 34 | var styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('RCTZhiHuDaily', () => RCTZhiHuDaily); 54 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDaily/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDaily/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"RCTZhiHuDaily" 50 | initialProperties:nil 51 | launchOptions:launchOptions]; 52 | 53 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 54 | UIViewController *rootViewController = [[UIViewController alloc] init]; 55 | rootViewController.view = rootView; 56 | self.window.rootViewController = rootViewController; 57 | [self.window makeKeyAndVisible]; 58 | return YES; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDaily/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDaily/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDaily/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDailyTests/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 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/ios/RCTZhiHuDailyTests/RCTZhiHuDailyTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface RCTZhiHuDailyTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation RCTZhiHuDailyTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /ZhiHuDaily-React-Native/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RCTZhiHuDaily", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.11.0", 10 | "react-timer-mixin": "^0.13.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ziliun-react-native/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/React.js 13 | .*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js 14 | .*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 15 | .*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js 16 | 17 | 18 | # Ignore commoner tests 19 | .*/node_modules/commoner/test/.* 20 | 21 | # See https://github.com/facebook/flow/issues/442 22 | .*/react-tools/node_modules/commoner/lib/reader.js 23 | 24 | # Ignore jest 25 | .*/react-native/node_modules/jest-cli/.* 26 | 27 | [include] 28 | 29 | [libs] 30 | node_modules/react-native/Libraries/react-native/react-native-interface.js 31 | 32 | [options] 33 | module.system=haste 34 | 35 | munge_underscores=true 36 | 37 | suppress_type=$FlowIssue 38 | suppress_type=$FlowFixMe 39 | suppress_type=$FixMe 40 | 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-4]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 43 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 44 | 45 | [version] 46 | 0.14.0 47 | -------------------------------------------------------------------------------- /ziliun-react-native/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | android/app/build 9 | android/gradle 10 | android/build 11 | 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | *.xccheckout 22 | *.moved-aside 23 | DerivedData 24 | *.hmap 25 | *.ipa 26 | *.xcuserstate 27 | project.xcworkspace 28 | 29 | # node.js 30 | # 31 | node_modules/ 32 | npm-debug.log 33 | -------------------------------------------------------------------------------- /ziliun-react-native/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /ziliun-react-native/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Sonny Lazuardi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /ziliun-react-native/README.md: -------------------------------------------------------------------------------- 1 | # Ziliun React Native 2 | Ziliun article reader app built with React Native 3 | 4 | ![ziliun](https://lh3.googleusercontent.com/-dfTUwYSOERo/VfwDPBBO-2I/AAAAAAAABu0/fj-U8Ty4lvQ/s0/promo.png "promo.png") 5 | 6 | [![download](https://lh3.googleusercontent.com/v8DXc8EpIgPZCFJSJcE8me4_-PCnAZSTSm-eq5ZtCIA=s0 "google play") 7 | ](http://bit.ly/ziliun) 8 | 9 | # Installation 10 | 11 | Follow react native getting started guide : https://facebook.github.io/react-native/docs/getting-started.html#content 12 | 13 | # Running 14 | 15 | `react-native android` 16 | 17 | `react-native run-android` 18 | 19 | # MIT License 20 | 21 | © 2015 by @sonnylazuardi -------------------------------------------------------------------------------- /ziliun-react-native/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.ziliunapp" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile 'com.android.support:appcompat-v7:23.0.0' 28 | compile 'com.facebook.react:react-native:0.11.+' 29 | } 30 | -------------------------------------------------------------------------------- /ziliun-react-native/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 | -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/java/com/ziliunapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.ziliunapp; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | 7 | import com.facebook.react.LifecycleState; 8 | import com.facebook.react.ReactInstanceManager; 9 | import com.facebook.react.ReactRootView; 10 | import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; 11 | import com.facebook.react.shell.MainReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | 14 | public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { 15 | 16 | private ReactInstanceManager mReactInstanceManager; 17 | private ReactRootView mReactRootView; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | mReactRootView = new ReactRootView(this); 23 | 24 | mReactInstanceManager = ReactInstanceManager.builder() 25 | .setApplication(getApplication()) 26 | .setBundleAssetName("index.android.bundle") 27 | .setJSMainModuleName("index.android") 28 | .addPackage(new MainReactPackage()) 29 | .setUseDeveloperSupport(BuildConfig.DEBUG) 30 | .setInitialLifecycleState(LifecycleState.RESUMED) 31 | .build(); 32 | 33 | mReactRootView.startReactApplication(mReactInstanceManager, "ZiliunApp", null); 34 | 35 | setContentView(mReactRootView); 36 | } 37 | 38 | @Override 39 | public boolean onKeyUp(int keyCode, KeyEvent event) { 40 | if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { 41 | mReactInstanceManager.showDevOptionsDialog(); 42 | return true; 43 | } 44 | return super.onKeyUp(keyCode, event); 45 | } 46 | 47 | @Override 48 | public void invokeDefaultOnBackPressed() { 49 | super.onBackPressed(); 50 | } 51 | 52 | @Override 53 | protected void onPause() { 54 | super.onPause(); 55 | 56 | if (mReactInstanceManager != null) { 57 | mReactInstanceManager.onPause(); 58 | } 59 | } 60 | 61 | @Override 62 | protected void onResume() { 63 | super.onResume(); 64 | 65 | if (mReactInstanceManager != null) { 66 | mReactInstanceManager.onResume(this); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_back_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_menu_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-hdpi/android_search_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-hdpi/ziliun_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-hdpi/ziliun_logo_large.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_back_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_menu_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-mdpi/android_search_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-mdpi/ziliun_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-mdpi/ziliun_logo_large.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_back_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_menu_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xhdpi/android_search_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xhdpi/ziliun_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xhdpi/ziliun_logo_large.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_back_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_back_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_menu_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_search_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/android_search_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/ziliun_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxhdpi/ziliun_logo_large.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxxhdpi/android_menu_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxxhdpi/android_menu_white.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable-xxxhdpi/ziliun_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable-xxxhdpi/ziliun_logo_large.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/drawable/rotten_tomatoes_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/drawable/rotten_tomatoes_icon.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ZiliunApp 3 | 4 | -------------------------------------------------------------------------------- /ziliun-react-native/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ziliun-react-native/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:1.3.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 | } 20 | } 21 | -------------------------------------------------------------------------------- /ziliun-react-native/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 | -------------------------------------------------------------------------------- /ziliun-react-native/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ZiliunApp' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /ziliun-react-native/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | } = React; 14 | 15 | var ZiliunApp = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.ios.js 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | }); 33 | 34 | var styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('ZiliunApp', () => ZiliunApp); 54 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. To re-generate the static bundle 39 | * from the root of your project directory, run 40 | * 41 | * $ react-native bundle --minify 42 | * 43 | * see http://facebook.github.io/react-native/docs/runningondevice.html 44 | */ 45 | 46 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | 48 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 49 | moduleName:@"ZiliunApp" 50 | initialProperties:nil 51 | launchOptions:launchOptions]; 52 | 53 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 54 | UIViewController *rootViewController = [[UIViewController alloc] init]; 55 | rootViewController.view = rootView; 56 | self.window.rootViewController = rootViewController; 57 | [self.window makeKeyAndVisible]; 58 | return YES; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunApp/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 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunApp/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunAppTests/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 | -------------------------------------------------------------------------------- /ziliun-react-native/ios/ZiliunAppTests/ZiliunAppTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface ZiliunAppTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation ZiliunAppTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /ziliun-react-native/logobig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/logobig.png -------------------------------------------------------------------------------- /ziliun-react-native/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ZiliunApp", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "^0.11.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ziliun-react-native/promo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaohua/sf-react-native-meetup/637b8f9496796082528999cb850b6c108d7ef28a/ziliun-react-native/promo.png --------------------------------------------------------------------------------