diff --git a/example-redux/.flowconfig b/example-redux/.flowconfig index f56848d2fe8..45fd3ccb45f 100644 --- a/example-redux/.flowconfig +++ b/example-redux/.flowconfig @@ -15,8 +15,6 @@ # Ignore react and fbjs where there are overlaps, but don't ignore # anything that react-native relies on .*/node_modules/fbjs/lib/Map.js -.*/node_modules/fbjs/lib/fetch.js -.*/node_modules/fbjs/lib/ExecutionEnvironment.js .*/node_modules/fbjs/lib/ErrorUtils.js # Flow has a built-in definition for the 'react' module which we prefer to use @@ -48,6 +46,9 @@ # Ignore BUCK generated folders .*\.buckd/ +# Ignore RNPM +.*/local-cli/rnpm/.* + .*/node_modules/is-my-json-valid/test/.*\.json .*/node_modules/iconv-lite/encodings/tables/.*\.json .*/node_modules/y18n/test/.*\.json @@ -82,15 +83,15 @@ esproposal.class_instance_fields=enable munge_underscores=true module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy [version] -0.23.0 +^0.25.0 diff --git a/example-redux/android/app/proguard-rules.pro b/example-redux/android/app/proguard-rules.pro index 347a13ce103..9852871bd0d 100644 --- a/example-redux/android/app/proguard-rules.pro +++ b/example-redux/android/app/proguard-rules.pro @@ -51,9 +51,9 @@ -keepattributes Signature -keepattributes *Annotation* --keep class com.squareup.okhttp.** { *; } --keep interface com.squareup.okhttp.** { *; } --dontwarn com.squareup.okhttp.** +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-dontwarn okhttp3.** # okio diff --git a/example-redux/android/settings.gradle b/example-redux/android/settings.gradle index 4c89e87a9ba..c618989a781 100644 --- a/example-redux/android/settings.gradle +++ b/example-redux/android/settings.gradle @@ -2,5 +2,4 @@ rootProject.name = 'exampleRedux' include ':app' include ':react-native-navigation' -project(':react-native-navigation').projectDir = new File( - rootProject.projectDir, '../node_modules/react-native-navigation/android/app/') \ No newline at end of file +project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app') diff --git a/example-redux/ios/exampleRedux.xcodeproj/project.pbxproj b/example-redux/ios/exampleRedux.xcodeproj/project.pbxproj index 2e92c55c5b7..4de2e55e34d 100644 --- a/example-redux/ios/exampleRedux.xcodeproj/project.pbxproj +++ b/example-redux/ios/exampleRedux.xcodeproj/project.pbxproj @@ -21,8 +21,8 @@ 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 497C3B4D1D1CF88A005F31FC /* libReactNativeControllers.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 497C3B4C1D1CF879005F31FC /* libReactNativeControllers.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - CCCF23211C9C238500455574 /* libReactNativeControllers.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CCCF23201C9C236100455574 /* libReactNativeControllers.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -89,6 +89,13 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; + 497C3B4B1D1CF879005F31FC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 497C3B3D1D1CF879005F31FC /* ReactNativeControllers.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D8AFADBD1BEE6F3F00A4592D; + remoteInfo = ReactNativeControllers; + }; 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; @@ -103,13 +110,6 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; - CCCF231F1C9C236100455574 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = CCCF23111C9C236100455574 /* ReactNativeControllers.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = D8AFADBD1BEE6F3F00A4592D; - remoteInfo = ReactNativeControllers; - }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ @@ -132,9 +132,9 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = exampleRedux/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = exampleRedux/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; + 497C3B3D1D1CF879005F31FC /* ReactNativeControllers.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeControllers.xcodeproj; path = "../node_modules/react-native-controllers/ios/ReactNativeControllers.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; - CCCF23111C9C236100455574 /* ReactNativeControllers.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeControllers.xcodeproj; path = "../node_modules/react-native-controllers/ios/ReactNativeControllers.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -149,7 +149,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CCCF23211C9C238500455574 /* libReactNativeControllers.a in Frameworks */, + 497C3B4D1D1CF88A005F31FC /* libReactNativeControllers.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, @@ -261,6 +261,14 @@ name = Products; sourceTree = ""; }; + 497C3B3E1D1CF879005F31FC /* Products */ = { + isa = PBXGroup; + children = ( + 497C3B4C1D1CF879005F31FC /* libReactNativeControllers.a */, + ); + name = Products; + sourceTree = ""; + }; 78C398B11ACF4ADC00677621 /* Products */ = { isa = PBXGroup; children = ( @@ -272,6 +280,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 497C3B3D1D1CF879005F31FC /* ReactNativeControllers.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -282,7 +291,6 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - CCCF23111C9C236100455574 /* ReactNativeControllers.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -316,14 +324,6 @@ name = Products; sourceTree = ""; }; - CCCF23121C9C236100455574 /* Products */ = { - isa = PBXGroup; - children = ( - CCCF23201C9C236100455574 /* libReactNativeControllers.a */, - ); - name = Products; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -431,8 +431,8 @@ ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, { - ProductGroup = CCCF23121C9C236100455574 /* Products */; - ProjectRef = CCCF23111C9C236100455574 /* ReactNativeControllers.xcodeproj */; + ProductGroup = 497C3B3E1D1CF879005F31FC /* Products */; + ProjectRef = 497C3B3D1D1CF879005F31FC /* ReactNativeControllers.xcodeproj */; }, ); projectRoot = ""; @@ -500,6 +500,13 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 497C3B4C1D1CF879005F31FC /* libReactNativeControllers.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libReactNativeControllers.a; + remoteRef = 497C3B4B1D1CF879005F31FC /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -514,13 +521,6 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - CCCF23201C9C236100455574 /* libReactNativeControllers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReactNativeControllers.a; - remoteRef = CCCF231F1C9C236100455574 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -604,10 +604,6 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -625,10 +621,6 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = exampleReduxTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -650,7 +642,10 @@ ); INFOPLIST_FILE = exampleRedux/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = exampleRedux; }; name = Debug; @@ -667,7 +662,10 @@ ); INFOPLIST_FILE = exampleRedux/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = exampleRedux; }; name = Release; @@ -711,7 +709,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -751,7 +749,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/example-redux/ios/exampleRedux/AppDelegate.m b/example-redux/ios/exampleRedux/AppDelegate.m index 022eb4ca4c9..5a220021e7a 100644 --- a/example-redux/ios/exampleRedux/AppDelegate.m +++ b/example-redux/ios/exampleRedux/AppDelegate.m @@ -1,13 +1,14 @@ -#import "AppDelegate.h" +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ -// ********************************************** -// *** DON'T MISS: THE NEXT LINE IS IMPORTANT *** -// ********************************************** +#import "AppDelegate.h" #import "RCCManager.h" - -// IMPORTANT: if you're getting an Xcode error that RCCManager.h isn't found, you've probably ran "npm install" -// with npm ver 2. You'll need to "npm install" with npm 3 (see https://github.com/wix/react-native-navigation/issues/1) - #import "RCTRootView.h" @implementation AppDelegate @@ -15,31 +16,36 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *jsCodeLocation; + + /** + * Loading JavaScript code - uncomment the one you want. + * + * OPTION 1 + * Load from development server. Start the server from the repository root: + * + * $ npm start + * + * To run on device, change `localhost` to the IP address of your computer + * (you can get this by typing `ifconfig` into the terminal and selecting the + * `inet` value under `en0:`) and make sure your computer and iOS device are + * on the same Wi-Fi network. + */ + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; - // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; - - - // ********************************************** - // *** DON'T MISS: THIS IS HOW WE BOOTSTRAP ***** - // ********************************************** + + /** + * OPTION 2 + * Load from pre-bundled file on disk. The static bundle is automatically + * generated by the "Bundle React Native code and images" build step when + * running the project on an actual device or running the project on the + * simulator in the "Release" build configuration. + */ + +// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; + self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; [[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation]; - - /* - // original RN bootstrap - remove this part - RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation - moduleName:@"example" - initialProperties:nil - launchOptions:launchOptions]; - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - */ - - return YES; } diff --git a/example-redux/ios/exampleRedux/Info.plist b/example-redux/ios/exampleRedux/Info.plist index 3f1e7c11331..91963b26707 100644 --- a/example-redux/ios/exampleRedux/Info.plist +++ b/example-redux/ios/exampleRedux/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.0 CFBundleSignature ???? CFBundleVersion @@ -35,13 +35,14 @@ UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance - + NSLocationWhenInUseUsageDescription - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - + NSAppTransportSecurity + + + NSAllowsArbitraryLoads + + diff --git a/example-redux/ios/exampleReduxTests/exampleReduxTests.m b/example-redux/ios/exampleReduxTests/exampleReduxTests.m index b127111620a..d0f49f5622a 100644 --- a/example-redux/ios/exampleReduxTests/exampleReduxTests.m +++ b/example-redux/ios/exampleReduxTests/exampleReduxTests.m @@ -13,7 +13,7 @@ #import "RCTLog.h" #import "RCTRootView.h" -#define TIMEOUT_SECONDS 240 +#define TIMEOUT_SECONDS 600 #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" @interface exampleReduxTests : XCTestCase diff --git a/example-redux/package.json b/example-redux/package.json index c2391cb0d9c..5f4010403f0 100644 --- a/example-redux/package.json +++ b/example-redux/package.json @@ -9,8 +9,8 @@ "_fix_npm2_step2": "cd node_modules; find . -name .babelrc | grep -v packager | xargs rm" }, "dependencies": { - "react-native": "0.25.1", - "react": "0.14.5", + "react": "15.1.0", + "react-native": "0.27.2", "fbjs": "^0.6.1", "react-redux": "^4.0.6", "redux": "^3.0.5", diff --git a/example/package.json b/example/package.json index aec52d629fb..aeecc303d72 100644 --- a/example/package.json +++ b/example/package.json @@ -6,8 +6,8 @@ "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { - "react-native": "0.25.1", - "react": "0.14.5", + "react": "15.1.0", + "react-native": "0.27.2", "react-native-navigation": "latest" } } diff --git a/example/src/screens/FirstTabScreen.android.js b/example/src/screens/FirstTabScreen.android.js deleted file mode 100644 index aca8fdc844a..00000000000 --- a/example/src/screens/FirstTabScreen.android.js +++ /dev/null @@ -1,111 +0,0 @@ -import React, {Component} from 'react'; -import { - Text, - View, - ScrollView, - TouchableOpacity, - StyleSheet -} from 'react-native'; - -export default class FirstTabScreen extends Component { - static navigatorButtons = { - leftButtons: [{ - icon: require('../../img/navicon_menu.png'), - id: 'menu' - }], - rightButtons: [ - { - title: 'Edit', - id: 'edit' - }, - { - icon: require('../../img/navicon_add.png'), - id: 'add' - } - ] - }; - static navigatorStyle = { - drawUnderTabBar: true - }; - constructor(props) { - super(props); - // if you want to listen on navigator events, set this up - // this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)); - } - onNavigatorEvent(event) { - if (event.id == 'menu') { - this.props.navigator.toggleDrawer({ - side: 'left', - animated: true - }); - } - if (event.id == 'edit') { - // AlertIOS.alert('NavBar', 'Edit button pressed'); - } - if (event.id == 'add') { - // AlertIOS.alert('NavBar', 'Add button pressed'); - } - } - render() { - return ( - - - - Push Plain Screen - - - - Push Styled Screen - - - - Show Modal Screen - - - - Show LightBox - - - - ); - } - onPushPress() { - this.props.navigator.push({ - title: "More", - screen: "example.PushedScreen" - }); - } - onPushStyledPress() { - console.warn('navigator.push not implemented yet'); - // this.props.navigator.push({ - // title: "Styled", - // screen: "example.StyledScreen" - // }); - } - onModalPress() { - console.warn('navigator.showModal not implemented yet'); - // this.props.navigator.showModal({ - // title: "Modal", - // screen: "example.ModalScreen" - // }); - } - onLightBoxPress() { - console.warn('navigator.showLightBox not implemented yet'); - // this.props.navigator.showLightBox({ - // screen: "example.LightBoxScreen", - // style: { - // backgroundBlur: "dark" - // } - // }); - } -} - -const styles = StyleSheet.create({ - button: { - textAlign: 'center', - fontSize: 18, - marginBottom: 10, - marginTop:10, - color: 'blue' - } -}); diff --git a/example/src/screens/FirstTabScreen.ios.js b/example/src/screens/FirstTabScreen.js similarity index 95% rename from example/src/screens/FirstTabScreen.ios.js rename to example/src/screens/FirstTabScreen.js index b35aee14b52..4425ce08479 100644 --- a/example/src/screens/FirstTabScreen.ios.js +++ b/example/src/screens/FirstTabScreen.js @@ -5,7 +5,7 @@ import { ScrollView, TouchableOpacity, StyleSheet, - AlertIOS + Alert } from 'react-native'; export default class FirstTabScreen extends Component { @@ -41,10 +41,10 @@ export default class FirstTabScreen extends Component { }); } if (event.id == 'edit') { - AlertIOS.alert('NavBar', 'Edit button pressed'); + Alert.alert('NavBar', 'Edit button pressed'); } if (event.id == 'add') { - AlertIOS.alert('NavBar', 'Add button pressed'); + Alert.alert('NavBar', 'Add button pressed'); } } render() { diff --git a/example/src/screens/ModalScreen.js b/example/src/screens/ModalScreen.js index 1a875083dd1..e2aa3feff5f 100644 --- a/example/src/screens/ModalScreen.js +++ b/example/src/screens/ModalScreen.js @@ -21,7 +21,7 @@ export default class ModalScreen extends Component { } render() { return ( - + Push Plain Screen diff --git a/example/src/screens/SecondTabScreen.android.js b/example/src/screens/SecondTabScreen.android.js deleted file mode 100644 index 89d4b43826d..00000000000 --- a/example/src/screens/SecondTabScreen.android.js +++ /dev/null @@ -1,133 +0,0 @@ -import React, {Component} from 'react'; -import { - Text, - View, - ScrollView, - TouchableOpacity, - StyleSheet -} from 'react-native'; - -export default class SecondTabScreen extends Component { - static navigatorStyle = { - drawUnderTabBar: true - }; - constructor(props) { - super(props); - this.buttonsCounter = 0; - // if you want to listen on navigator events, set this up - // this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)); - } - render() { - return ( - - - - Change Buttons - - - - Change Title - - - - Switch To Tab#1 - - - - Set Tab Badge - - - - Toggle Tabs - - - - ); - } - onChangeTitlePress() { - this.props.navigator.setTitle({ - title: Math.round(Math.random() * 100000).toString() - }); - } - onChangeButtonsPress() { - let buttons; - if (this.buttonsCounter % 3 == 0) { - buttons = [ - { - title: 'Edit', - id: 'edit', - disabled: true - }, - { - icon: require('../../img/navicon_add.png'), - id: 'add' - } - ]; - } else if (this.buttonsCounter % 3 == 1) { - buttons = [{ - title: 'Save', - id: 'save' - }]; - } else { - buttons = []; - } - this.buttonsCounter++; - - this.props.navigator.setButtons({ - rightButtons: buttons, - animated: true - }); - } - onSwitchTabPress() { - this.props.navigator.switchToTab({ - tabIndex: 0 - }); - } - onSetTabBadgePress() { - this.props.navigator.setTabBadge({ - badge: 12 - }); - } - onToggleTabsPress() { - this.props.navigator.toggleTabs({ - to: this.tabsHidden ? 'shown' : 'hidden' - }); - this.tabsHidden = !this.tabsHidden; - } - onNavigatorEvent(event) { - // handle a deep link - if (event.type == 'DeepLink') { - const parts = event.link.split('/'); - if (parts[0] == 'tab2') { - this.props.navigator.resetTo({ - title: "Replaced Root", - screen: parts[1], - animated: true - }); - this.props.navigator.switchToTab(); - } - } - // handle a button press - // if (event.type == 'NavBarButtonPress') { - // if (event.id == 'edit') { - // AlertIOS.alert('NavBar', 'Dynamic Edit button pressed'); - // } - // if (event.id == 'add') { - // AlertIOS.alert('NavBar', 'Dynamic Add button pressed'); - // } - // if (event.id == 'save') { - // AlertIOS.alert('NavBar', 'Dynamic Save button pressed'); - // } - // } - } -} - -const styles = StyleSheet.create({ - button: { - textAlign: 'center', - fontSize: 18, - marginBottom: 10, - marginTop:10, - color: 'blue' - } -}); diff --git a/example/src/screens/SecondTabScreen.ios.js b/example/src/screens/SecondTabScreen.js similarity index 91% rename from example/src/screens/SecondTabScreen.ios.js rename to example/src/screens/SecondTabScreen.js index e5e3452672c..81d9bf786d9 100644 --- a/example/src/screens/SecondTabScreen.ios.js +++ b/example/src/screens/SecondTabScreen.js @@ -5,7 +5,7 @@ import { ScrollView, TouchableOpacity, StyleSheet, - AlertIOS + Alert } from 'react-native'; export default class SecondTabScreen extends Component { @@ -107,17 +107,16 @@ export default class SecondTabScreen extends Component { }); this.props.navigator.switchToTab(); } - } - // handle a button press - if (event.type == 'NavBarButtonPress') { + } else { + // handle a button press if (event.id == 'edit') { - AlertIOS.alert('NavBar', 'Dynamic Edit button pressed'); + Alert.alert('NavBar', 'Dynamic Edit button pressed'); } if (event.id == 'add') { - AlertIOS.alert('NavBar', 'Dynamic Add button pressed'); + Alert.alert('NavBar', 'Dynamic Add button pressed'); } if (event.id == 'save') { - AlertIOS.alert('NavBar', 'Dynamic Save button pressed'); + Alert.alert('NavBar', 'Dynamic Save button pressed'); } } } diff --git a/example/src/screens/SideMenu.js b/example/src/screens/SideMenu.js index d49754f86ee..9fc777997da 100644 --- a/example/src/screens/SideMenu.js +++ b/example/src/screens/SideMenu.js @@ -4,8 +4,7 @@ import { View, ScrollView, TouchableOpacity, - StyleSheet, - AlertIOS + StyleSheet } from 'react-native'; export default class SideMenu extends Component { @@ -14,7 +13,7 @@ export default class SideMenu extends Component { } render() { return ( - + Side Menu diff --git a/example/src/screens/StyledScreen.js b/example/src/screens/StyledScreen.js index 7591e123644..3e0c3c74ced 100644 --- a/example/src/screens/StyledScreen.js +++ b/example/src/screens/StyledScreen.js @@ -6,7 +6,7 @@ import { TouchableOpacity, Image, StyleSheet, - AlertIOS + Alert } from 'react-native'; export default class StyledScreen extends Component { @@ -54,7 +54,7 @@ export default class StyledScreen extends Component { } onNavigatorEvent(event) { if (event.id == 'compose') { - AlertIOS.alert('NavBar', 'Compose button pressed'); + Alert.alert('NavBar', 'Compose button pressed'); } } onPushPress() { diff --git a/example/src/screens/index.android.js b/example/src/screens/index.android.js index 17f934b33a7..c6b77df52ab 100644 --- a/example/src/screens/index.android.js +++ b/example/src/screens/index.android.js @@ -16,5 +16,7 @@ export function registerScreens() { Navigation.registerComponent('example.ThirdTabScreen', () => ThirdTabScreen); Navigation.registerComponent('example.PushedScreen', () => PushedScreen); Navigation.registerComponent('example.StyledScreen', () => StyledScreen); + Navigation.registerComponent('example.ModalScreen', () => ModalScreen); + Navigation.registerComponent('example.LightBoxScreen', () => LightBoxScreen); Navigation.registerComponent('example.SideMenu', () => SideMenu); }