├── .watchmanconfig ├── .idea ├── .name ├── vcs.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── jsLibraryMappings.xml ├── modules.xml ├── UIExplorerApp.iml ├── libraries │ └── UIExplorerApp_node_modules.xml └── misc.xml ├── android ├── .gradle │ └── 2.4 │ │ └── taskArtifacts │ │ ├── cache.properties │ │ ├── fileHashes.bin │ │ ├── fileSnapshots.bin │ │ ├── taskArtifacts.bin │ │ ├── cache.properties.lock │ │ └── outputFileStates.bin ├── settings.gradle ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable │ │ │ │ ├── launcher_icon.png │ │ │ │ ├── uie_thumb_normal.png │ │ │ │ ├── ic_menu_black_24dp.png │ │ │ │ ├── uie_comment_normal.png │ │ │ │ ├── uie_thumb_selected.png │ │ │ │ ├── ic_create_black_48dp.png │ │ │ │ ├── ic_settings_black_48dp.png │ │ │ │ └── uie_comment_highlighted.png │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── com │ │ │ └── uiexplorerapp │ │ │ └── MainActivity.java │ ├── proguard-rules.pro │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradle.properties └── gradlew.bat ├── UIExplorerUnitTests ├── libOCMock.a ├── Info.plist ├── OCMock │ ├── NSNotificationCenter+OCMAdditions.h │ ├── OCMRecorder.h │ ├── OCMLocation.h │ ├── OCMMacroState.h │ ├── OCMArg.h │ ├── OCMConstraint.h │ ├── OCMStubRecorder.h │ ├── OCMockObject.h │ └── OCMock.h ├── RCTSparseArrayTests.m ├── RCTImageLoaderHelpers.h ├── RCTJSONTests.m ├── RCTGzipTests.m ├── LayoutSubviewsOrderingTest.m ├── RCTConvert_NSURLTests.m ├── RCTImageLoaderHelpers.m └── RCTImageUtilTests.m ├── UIExplorer ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ ├── Icon-Small@2x.png │ │ ├── Icon-Small@3x.png │ │ └── Contents.json │ ├── tabnav_list.imageset │ │ ├── tabnav_list@3x.png │ │ └── Contents.json │ ├── uie_thumb_big.imageset │ │ ├── uie_thumb_big.png │ │ └── Contents.json │ ├── tabnav_settings.imageset │ │ ├── tabnav_settings@3x.png │ │ └── Contents.json │ ├── NavBarButtonPlus.imageset │ │ ├── NavBarButtonPlus@3x.png │ │ └── Contents.json │ ├── story-background.imageset │ │ ├── story-background@2x.png │ │ └── Contents.json │ ├── uie_thumb_normal.imageset │ │ ├── uie_thumb_normal@2x.png │ │ └── Contents.json │ ├── uie_comment_normal.imageset │ │ ├── uie_comment_normal@2x.png │ │ └── Contents.json │ ├── uie_thumb_selected.imageset │ │ ├── uie_thumb_selected@2x.png │ │ └── Contents.json │ ├── tabnav_notification.imageset │ │ ├── tabnav_notification@3x.png │ │ └── Contents.json │ └── uie_comment_highlighted.imageset │ │ ├── uie_comment_highlighted@2x.png │ │ └── Contents.json ├── AppDelegate.h ├── main.m ├── Info.plist ├── AppDelegate.m └── Base.lproj │ └── LaunchScreen.xib ├── UIExplorerIntegrationTests ├── ReferenceImages │ ├── Examples-UIExplorer-UIExplorerApp.ios │ │ ├── testTextExample_1@2x.png │ │ ├── testViewExample_1@2x.png │ │ ├── testLayoutExample_1@2x.png │ │ ├── testSliderExample_1@2x.png │ │ ├── testSwitchExample_1@2x.png │ │ └── testTabBarExample_1@2x.png │ └── Examples-UIExplorer-UIExplorerIntegrationTests-js-IntegrationTestsApp │ │ └── testSimpleSnapshot_1@2x.png ├── Info.plist ├── js │ ├── SimpleSnapshotTest.js │ ├── IntegrationTestHarnessTest.js │ ├── AppEventsTest.js │ ├── PromiseTest.js │ └── IntegrationTestsApp.js ├── UIExplorerSnapshotTests.m └── UIExplorerIntegrationTests.m ├── package.json ├── README.md ├── ios ├── main.jsbundle ├── UIExplorerApp │ ├── AppDelegate.h │ ├── main.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.m │ └── Base.lproj │ │ └── LaunchScreen.xib └── UIExplorerAppTests │ ├── Info.plist │ └── UIExplorerAppTests.m ├── .gitignore ├── ExampleTypes.js ├── CustomTabBarExample.js ├── .flowconfig ├── UIExplorerTitle.js ├── VibrationIOSExample.js ├── UIExplorerButton.js ├── SliderIOSExample.js ├── AccessibilityIOSExample.js ├── UIExplorerApp.ios.js ├── index.ios.js ├── ImageCapInsetsExample.js ├── ProgressBarAndroidExample.android.js ├── ToastAndroidExample.android.js ├── UIExplorerPage.js ├── ScrollViewSimpleExample.js ├── GeolocationExample.js ├── SwitchAndroidExample.android.js ├── NavigatorIOSColorsExample.js ├── ProgressViewIOSExample.js ├── components └── CustomTabBar.js ├── AssetScaledImageExample.js ├── UIExplorerBlock.js ├── AdSupportIOSExample.js ├── AnimatedGratuitousApp ├── AnExSlides.md └── AnExScroll.js ├── ScrollableTabViewExample.js ├── AppStateIOSExample.js ├── ActionSheetIOSExample.js ├── createExamplePage.js ├── AsyncStorageExample.js ├── StatusBarIOSExample.js ├── PickerIOSExample.js ├── NetInfoExample.js ├── CameraRollExample.ios.js ├── ResponderExample.js ├── PushNotificationIOSExample.js └── UIExplorerList.android.js /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | UIExplorerApp -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 28 11:00:33 CST 2015 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'UIExplorerApp' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | UIExplorer App 3 | 4 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/libOCMock.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerUnitTests/libOCMock.a -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/.gradle/2.4/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/.gradle/2.4/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/.gradle/2.4/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/launcher_icon.png -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/.gradle/2.4/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /android/.gradle/2.4/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/.gradle/2.4/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/uie_thumb_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/uie_thumb_normal.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/uie_comment_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/uie_comment_normal.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/uie_thumb_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/uie_thumb_selected.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_create_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/ic_create_black_48dp.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_settings_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/ic_settings_black_48dp.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/uie_comment_highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/android/app/src/main/res/drawable/uie_comment_highlighted.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/tabnav_list.imageset/tabnav_list@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_big.imageset/uie_thumb_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/uie_thumb_big.imageset/uie_thumb_big.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/tabnav_settings.imageset/tabnav_settings@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/NavBarButtonPlus.imageset/NavBarButtonPlus@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/NavBarButtonPlus.imageset/NavBarButtonPlus@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/story-background.imageset/story-background@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/story-background.imageset/story-background@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_normal.imageset/uie_thumb_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/uie_thumb_normal.imageset/uie_thumb_normal@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_comment_normal.imageset/uie_comment_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/uie_comment_normal.imageset/uie_comment_normal@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_selected.imageset/uie_thumb_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/uie_thumb_selected.imageset/uie_thumb_selected@2x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/tabnav_notification.imageset/tabnav_notification@3x.png -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_comment_highlighted.imageset/uie_comment_highlighted@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorer/Images.xcassets/uie_comment_highlighted.imageset/uie_comment_highlighted@2x.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testTextExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testTextExample_1@2x.png -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testViewExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testViewExample_1@2x.png -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testLayoutExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testLayoutExample_1@2x.png -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testSliderExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testSliderExample_1@2x.png -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testSwitchExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testSwitchExample_1@2x.png -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testTabBarExample_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerApp.ios/testTabBarExample_1@2x.png -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_big.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "uie_thumb_big.png" 7 | } 8 | ], 9 | "info" : { 10 | "version" : 1, 11 | "author" : "xcode" 12 | } 13 | } -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UIExplorerApp", 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.13.0-rc", 10 | "react-timer-mixin": "^0.13.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-UIExplorerApp 2 | 3 | facebook UIExplorerApp Extensions 4 | 5 | All useful components are collected from Github 6 | 7 | #CustomeBar && react-native-scrollable-tab-view: 8 | 9 | author brentvatne 10 | 11 | [github](https://github.com/brentvatne/react-native-scrollable-tab-view) 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerIntegrationTests-js-IntegrationTestsApp/testSimpleSnapshot_1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marsprince/react-native-UIExplorerApp/HEAD/UIExplorerIntegrationTests/ReferenceImages/Examples-UIExplorer-UIExplorerIntegrationTests-js-IntegrationTestsApp/testSimpleSnapshot_1@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/UIExplorerApp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_list.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x", 14 | "filename" : "tabnav_list@3x.png" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/NavBarButtonPlus.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "NavBarButtonPlus@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/story-background.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "story-background@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_settings.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x", 14 | "filename" : "tabnav_settings@3x.png" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "uie_thumb_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_comment_normal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "uie_comment_normal@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_thumb_selected.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "uie_thumb_selected@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/tabnav_notification.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "scale" : "3x", 14 | "filename" : "tabnav_notification@3x.png" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/uie_comment_highlighted.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "uie_comment_highlighted@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /.idea/libraries/UIExplorerApp_node_modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/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 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/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 | } -------------------------------------------------------------------------------- /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.uiexplorerapp" 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.13.+' 29 | } 30 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /UIExplorer/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (nonatomic, strong) UIWindow *window; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ios/UIExplorerAppTests/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 | -------------------------------------------------------------------------------- /UIExplorer/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | #import "AppDelegate.h" 17 | 18 | int main(int argc, char * argv[]) { 19 | @autoreleasepool { 20 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCObserverMockObject; 20 | 21 | 22 | @interface NSNotificationCenter(OCMAdditions) 23 | 24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /UIExplorer/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-Small@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-Small@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ExampleTypes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule ExampleTypes 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | export type Example = { 20 | title: string, 21 | /* $FlowFixMe(>=0.16.0) */ 22 | render: () => ?ReactElement, 23 | description?: string, 24 | platform?: string; 25 | }; 26 | 27 | export type ExampleModule = { 28 | title: string; 29 | description: string; 30 | examples: Array; 31 | external?: bool; 32 | }; 33 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMockObject; 20 | @class OCMInvocationMatcher; 21 | 22 | 23 | @interface OCMRecorder : NSProxy 24 | { 25 | OCMockObject *mockObject; 26 | OCMInvocationMatcher *invocationMatcher; 27 | } 28 | 29 | - (instancetype)init; 30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject; 31 | 32 | - (void)setMockObject:(OCMockObject *)aMockObject; 33 | 34 | - (OCMInvocationMatcher *)invocationMatcher; 35 | 36 | - (id)classMethod; 37 | - (id)ignoringNonObjectArgs; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMLocation : NSObject 20 | { 21 | id testCase; 22 | NSString *file; 23 | NSUInteger line; 24 | } 25 | 26 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 27 | 28 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 29 | 30 | - (id)testCase; 31 | - (NSString *)file; 32 | - (NSUInteger)line; 33 | 34 | @end 35 | 36 | extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); 37 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMRecorder; 21 | @class OCMStubRecorder; 22 | @class OCMockObject; 23 | 24 | 25 | @interface OCMMacroState : NSObject 26 | { 27 | OCMRecorder *recorder; 28 | } 29 | 30 | + (void)beginStubMacro; 31 | + (OCMStubRecorder *)endStubMacro; 32 | 33 | + (void)beginExpectMacro; 34 | + (OCMStubRecorder *)endExpectMacro; 35 | 36 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation; 37 | + (void)endVerifyMacro; 38 | 39 | + (OCMMacroState *)globalState; 40 | 41 | - (OCMRecorder *)recorder; 42 | 43 | - (void)switchToClassMethod; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CustomTabBarExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author brentvatne 3 | * @github https://github.com/brentvatne/react-native-scrollable-tab-view 4 | * @name CustomTabBar 5 | * @edited marsprince 6 | */ 7 | 'use strict'; 8 | 9 | var Platform = require('Platform'); 10 | var React = require('react-native'); 11 | var CustomTabBar=require('./components/CustomTabBar'); 12 | var TAB_BAR_REF = 'TAB_BAR'; 13 | var { 14 | StyleSheet, 15 | Text, 16 | View, 17 | ToastAndroid, 18 | } = React; 19 | 20 | var CustomTabBarExample= React.createClass({ 21 | getInitialState(){ 22 | return { 23 | currentPage: 0, 24 | }; 25 | }, 26 | _goToPage(pageNumber) { 27 | 28 | this.setState({currentPage: pageNumber}); 29 | this.refs[TAB_BAR_REF].setAnimationValue(pageNumber); 30 | }, 31 | render() 32 | { 33 | return( 34 | 35 | 36 | ) 37 | } 38 | }); 39 | exports.title = ''; 40 | exports.description = 'Basic tabBar ' + 41 | 'show different pages.'; 42 | 43 | exports.displayName = 'CustomeTabBarExample'; 44 | exports.examples = [ 45 | { 46 | title: 'Basic CustomeTabBar', 47 | render: function() { 48 | return ( 49 | 50 | 51 | ); 52 | }, 53 | }, 54 | ]; 55 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/js/SimpleSnapshotTest.js: -------------------------------------------------------------------------------- 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 | 'use strict'; 10 | 11 | var React = require('react-native'); 12 | var { 13 | StyleSheet, 14 | View, 15 | } = React; 16 | 17 | var { TestModule } = React.addons; 18 | 19 | var SimpleSnapshotTest = React.createClass({ 20 | componentDidMount() { 21 | if (!TestModule.verifySnapshot) { 22 | throw new Error('TestModule.verifySnapshot not defined.'); 23 | } 24 | requestAnimationFrame(() => TestModule.verifySnapshot(this.done)); 25 | }, 26 | 27 | done(success) { 28 | TestModule.markTestPassed(success); 29 | }, 30 | 31 | render() { 32 | return ( 33 | 34 | 35 | 36 | 37 | ); 38 | } 39 | }); 40 | 41 | var styles = StyleSheet.create({ 42 | box1: { 43 | width: 80, 44 | height: 50, 45 | backgroundColor: 'red', 46 | }, 47 | box2: { 48 | top: -10, 49 | left: 20, 50 | width: 70, 51 | height: 90, 52 | backgroundColor: 'blue', 53 | }, 54 | }); 55 | 56 | SimpleSnapshotTest.displayName = 'SimpleSnapshotTest'; 57 | 58 | module.exports = SimpleSnapshotTest; 59 | -------------------------------------------------------------------------------- /UIExplorerTitle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule UIExplorerTitle 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | StyleSheet, 22 | Text, 23 | View, 24 | } = React; 25 | 26 | var UIExplorerTitle = React.createClass({ 27 | render: function() { 28 | return ( 29 | 30 | 31 | {this.props.title} 32 | 33 | 34 | ); 35 | } 36 | }); 37 | 38 | var styles = StyleSheet.create({ 39 | container: { 40 | borderRadius: 4, 41 | borderWidth: 0.5, 42 | borderColor: '#d6d7da', 43 | margin: 10, 44 | marginBottom: 0, 45 | height: 45, 46 | padding: 10, 47 | backgroundColor: 'white', 48 | }, 49 | text: { 50 | fontSize: 19, 51 | fontWeight: '500', 52 | }, 53 | }); 54 | 55 | module.exports = UIExplorerTitle; 56 | -------------------------------------------------------------------------------- /VibrationIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | StyleSheet, 21 | View, 22 | Text, 23 | TouchableHighlight, 24 | VibrationIOS 25 | } = React; 26 | 27 | exports.framework = 'React'; 28 | exports.title = 'VibrationIOS'; 29 | exports.description = 'Vibration API for iOS'; 30 | exports.examples = [{ 31 | title: 'VibrationIOS.vibrate()', 32 | render() { 33 | return ( 34 | VibrationIOS.vibrate()}> 37 | 38 | Vibrate 39 | 40 | 41 | ); 42 | }, 43 | }]; 44 | 45 | var styles = StyleSheet.create({ 46 | wrapper: { 47 | borderRadius: 5, 48 | marginBottom: 5, 49 | }, 50 | button: { 51 | backgroundColor: '#eeeeee', 52 | padding: 10, 53 | }, 54 | }); 55 | -------------------------------------------------------------------------------- /UIExplorerButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | StyleSheet, 21 | Text, 22 | TouchableHighlight, 23 | } = React; 24 | 25 | var UIExplorerButton = React.createClass({ 26 | propTypes: { 27 | onPress: React.PropTypes.func, 28 | }, 29 | render: function() { 30 | return ( 31 | 35 | 36 | {this.props.children} 37 | 38 | 39 | ); 40 | }, 41 | }); 42 | 43 | var styles = StyleSheet.create({ 44 | button: { 45 | borderColor: '#696969', 46 | borderRadius: 8, 47 | borderWidth: 1, 48 | padding: 10, 49 | margin: 5, 50 | alignItems: 'center', 51 | justifyContent: 'center', 52 | backgroundColor: '#d3d3d3', 53 | }, 54 | }); 55 | 56 | module.exports = UIExplorerButton; 57 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/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 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArg : NSObject 20 | 21 | // constraining arguments 22 | 23 | + (id)any; 24 | + (SEL)anySelector; 25 | + (void *)anyPointer; 26 | + (id __autoreleasing *)anyObjectRef; 27 | + (id)isNil; 28 | + (id)isNotNil; 29 | + (id)isEqual:(id)value; 30 | + (id)isNotEqual:(id)value; 31 | + (id)isKindOfClass:(Class)cls; 32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; 33 | + (id)checkWithBlock:(BOOL (^)(id obj))block; 34 | 35 | // manipulating arguments 36 | 37 | + (id *)setTo:(id)value; 38 | + (void *)setToValue:(NSValue *)value; 39 | 40 | // internal use only 41 | 42 | + (id)resolveSpecialValues:(NSValue *)value; 43 | 44 | @end 45 | 46 | #define OCMOCK_ANY [OCMArg any] 47 | 48 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 49 | #define OCMOCK_VALUE(variable) \ 50 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; }) 51 | #else 52 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] 53 | #endif 54 | -------------------------------------------------------------------------------- /UIExplorer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSLocationWhenInUseUsageDescription 26 | You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation, otherwise it is going to *fail silently*! 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /SliderIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | SliderIOS, 21 | Text, 22 | StyleSheet, 23 | View, 24 | } = React; 25 | 26 | var SliderExample = React.createClass({ 27 | getInitialState() { 28 | return { 29 | value: 0, 30 | }; 31 | }, 32 | 33 | render() { 34 | return ( 35 | 36 | 37 | {this.state.value} 38 | 39 | this.setState({value: value})} /> 42 | 43 | ); 44 | } 45 | }); 46 | 47 | var styles = StyleSheet.create({ 48 | slider: { 49 | height: 10, 50 | margin: 10, 51 | }, 52 | text: { 53 | fontSize: 14, 54 | textAlign: 'center', 55 | fontWeight: '500', 56 | margin: 10, 57 | }, 58 | }); 59 | 60 | exports.title = ''; 61 | exports.displayName = 'SliderExample'; 62 | exports.description = 'Slider input for numeric values'; 63 | exports.examples = [ 64 | { 65 | title: 'SliderIOS', 66 | render(): ReactElement { return ; } 67 | } 68 | ]; 69 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/js/IntegrationTestHarnessTest.js: -------------------------------------------------------------------------------- 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 | 'use strict'; 10 | 11 | var RCTTestModule = require('NativeModules').TestModule; 12 | var React = require('react-native'); 13 | var { 14 | Text, 15 | View, 16 | } = React; 17 | 18 | var IntegrationTestHarnessTest = React.createClass({ 19 | propTypes: { 20 | shouldThrow: React.PropTypes.bool, 21 | waitOneFrame: React.PropTypes.bool, 22 | }, 23 | 24 | getInitialState() { 25 | return { 26 | done: false, 27 | }; 28 | }, 29 | 30 | componentDidMount() { 31 | if (this.props.waitOneFrame) { 32 | requestAnimationFrame(this.runTest); 33 | } else { 34 | this.runTest(); 35 | } 36 | }, 37 | 38 | runTest() { 39 | if (this.props.shouldThrow) { 40 | throw new Error('Throwing error because shouldThrow'); 41 | } 42 | if (!RCTTestModule) { 43 | throw new Error('RCTTestModule is not registered.'); 44 | } else if (!RCTTestModule.markTestCompleted) { 45 | throw new Error('RCTTestModule.markTestCompleted not defined.'); 46 | } 47 | this.setState({done: true}, RCTTestModule.markTestCompleted); 48 | }, 49 | 50 | render() { 51 | return ( 52 | 53 | 54 | {this.constructor.displayName + ': '} 55 | {this.state.done ? 'Done' : 'Testing...'} 56 | 57 | 58 | ); 59 | } 60 | }); 61 | 62 | IntegrationTestHarnessTest.displayName = 'IntegrationTestHarnessTest'; 63 | 64 | module.exports = IntegrationTestHarnessTest; 65 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/js/AppEventsTest.js: -------------------------------------------------------------------------------- 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 | * @providesModule AppEventsTest 10 | * @flow 11 | */ 12 | 'use strict'; 13 | 14 | var React = require('react-native'); 15 | var { 16 | NativeAppEventEmitter, 17 | NativeModules, 18 | StyleSheet, 19 | Text, 20 | View, 21 | } = React; 22 | var TestModule = NativeModules.TestModule; 23 | 24 | var deepDiffer = require('deepDiffer'); 25 | 26 | var TEST_PAYLOAD = {foo: 'bar'}; 27 | 28 | var AppEventsTest = React.createClass({ 29 | getInitialState: function() { 30 | return {sent: 'none', received: 'none'}; 31 | }, 32 | componentDidMount: function() { 33 | NativeAppEventEmitter.addListener('testEvent', this.receiveEvent); 34 | var event = {data: TEST_PAYLOAD, ts: Date.now()}; 35 | TestModule.sendAppEvent('testEvent', event); 36 | this.setState({sent: event}); 37 | }, 38 | receiveEvent: function(event: any) { 39 | if (deepDiffer(event.data, TEST_PAYLOAD)) { 40 | throw new Error('Received wrong event: ' + JSON.stringify(event)); 41 | } 42 | var elapsed = (Date.now() - event.ts) + 'ms'; 43 | this.setState({received: event, elapsed}, TestModule.markTestCompleted); 44 | }, 45 | render: function() { 46 | return ( 47 | 48 | 49 | {JSON.stringify(this.state, null, ' ')} 50 | 51 | 52 | ); 53 | } 54 | }); 55 | 56 | AppEventsTest.displayName = 'AppEventsTest'; 57 | 58 | var styles = StyleSheet.create({ 59 | container: { 60 | margin: 40, 61 | }, 62 | }); 63 | 64 | module.exports = AppEventsTest; 65 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTSparseArrayTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | 17 | #import "RCTSparseArray.h" 18 | #import "UIView+React.h" 19 | 20 | @interface RCTSparseArrayTests : XCTestCase 21 | 22 | @end 23 | 24 | @implementation RCTSparseArrayTests 25 | 26 | - (void)testDictionary 27 | { 28 | id myView = [UIView new]; 29 | myView.reactTag = @4; 30 | 31 | id myOtherView = [UIView new]; 32 | myOtherView.reactTag = @5; 33 | 34 | RCTSparseArray *registry = [RCTSparseArray new]; 35 | XCTAssertNil(registry[@4], @"how did you have a view when none are registered?"); 36 | XCTAssertNil(registry[@5], @"how did you have a view when none are registered?"); 37 | 38 | registry[myView.reactTag] = myView; 39 | XCTAssertEqual(registry[@4], myView); 40 | XCTAssertNil(registry[@5], @"didn't register other view yet"); 41 | 42 | registry[myOtherView.reactTag] = myOtherView; 43 | XCTAssertEqual(registry[@4], myView); 44 | XCTAssertEqual(registry[@5], myOtherView); 45 | 46 | registry[myView.reactTag] = nil; 47 | XCTAssertNil(registry[@4]); 48 | XCTAssertEqual(registry[@5], myOtherView); 49 | 50 | registry[myOtherView.reactTag] = nil; 51 | XCTAssertNil(registry[@4], @"how did you have a view when none are registered?"); 52 | XCTAssertNil(registry[@5], @"how did you have a view when none are registered?"); 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /AccessibilityIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | Text, 21 | View, 22 | } = React; 23 | 24 | var AccessibilityIOSExample = React.createClass({ 25 | render() { 26 | return ( 27 | 28 | alert('onAccessibilityTap success')} 30 | accessible={true}> 31 | 32 | Accessibility normal tap example 33 | 34 | 35 | alert('onMagicTap success')} 36 | accessible={true}> 37 | 38 | Accessibility magic tap example 39 | 40 | 41 | 43 | 44 | Accessibility label example 45 | 46 | 47 | 49 | 50 | Accessibility traits example 51 | 52 | 53 | 54 | ); 55 | }, 56 | }); 57 | 58 | exports.title = 'AccessibilityIOS'; 59 | exports.description = 'Interface to show iOS\' accessibility samples'; 60 | exports.examples = [ 61 | { 62 | title: 'Accessibility elements', 63 | render(): ReactElement { return ; } 64 | }, 65 | ]; 66 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/js/PromiseTest.js: -------------------------------------------------------------------------------- 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 | * @providesModule PromiseTest 10 | */ 11 | 'use strict'; 12 | 13 | var RCTTestModule = require('NativeModules').TestModule; 14 | var React = require('react-native'); 15 | 16 | var PromiseTest = React.createClass({ 17 | 18 | shouldResolve: false, 19 | shouldReject: false, 20 | shouldSucceedAsync: false, 21 | shouldThrowAsync: false, 22 | 23 | componentDidMount() { 24 | Promise.all([ 25 | this.testShouldResolve(), 26 | this.testShouldReject(), 27 | this.testShouldSucceedAsync(), 28 | this.testShouldThrowAsync(), 29 | ]).then(() => RCTTestModule.markTestPassed( 30 | this.shouldResolve && this.shouldReject && 31 | this.shouldSucceedAsync && this.shouldThrowAsync 32 | )); 33 | }, 34 | 35 | testShouldResolve() { 36 | return RCTTestModule 37 | .shouldResolve() 38 | .then(() => this.shouldResolve = true) 39 | .catch(() => this.shouldResolve = false); 40 | }, 41 | 42 | testShouldReject() { 43 | return RCTTestModule 44 | .shouldReject() 45 | .then(() => this.shouldReject = false) 46 | .catch(() => this.shouldReject = true); 47 | }, 48 | 49 | async testShouldSucceedAsync() { 50 | try { 51 | await RCTTestModule.shouldResolve(); 52 | this.shouldSucceedAsync = true; 53 | } catch (e) { 54 | this.shouldSucceedAsync = false; 55 | } 56 | }, 57 | 58 | async testShouldThrowAsync() { 59 | try { 60 | await RCTTestModule.shouldReject(); 61 | this.shouldThrowAsync = false; 62 | } catch (e) { 63 | this.shouldThrowAsync = true; 64 | } 65 | }, 66 | 67 | render() { 68 | return ; 69 | } 70 | 71 | }); 72 | 73 | PromiseTest.displayName = 'PromiseTest'; 74 | 75 | module.exports = PromiseTest; 76 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMConstraint : NSObject 21 | 22 | + (instancetype)constraint; 23 | - (BOOL)evaluate:(id)value; 24 | 25 | // if you are looking for any, isNil, etc, they have moved to OCMArg 26 | 27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below 28 | 29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 31 | 32 | 33 | @end 34 | 35 | @interface OCMAnyConstraint : OCMConstraint 36 | @end 37 | 38 | @interface OCMIsNilConstraint : OCMConstraint 39 | @end 40 | 41 | @interface OCMIsNotNilConstraint : OCMConstraint 42 | @end 43 | 44 | @interface OCMIsNotEqualConstraint : OCMConstraint 45 | { 46 | @public 47 | id testValue; 48 | } 49 | 50 | @end 51 | 52 | @interface OCMInvocationConstraint : OCMConstraint 53 | { 54 | @public 55 | NSInvocation *invocation; 56 | } 57 | 58 | @end 59 | 60 | @interface OCMBlockConstraint : OCMConstraint 61 | { 62 | BOOL (^block)(id); 63 | } 64 | 65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; 66 | 67 | @end 68 | 69 | 70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 72 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/UIExplorerSnapshotTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | #import 17 | 18 | #import 19 | 20 | #import "RCTAssert.h" 21 | #import "RCTRedBox.h" 22 | #import "RCTRootView.h" 23 | 24 | @interface UIExplorerSnapshotTests : XCTestCase 25 | { 26 | RCTTestRunner *_runner; 27 | } 28 | 29 | @end 30 | 31 | @implementation UIExplorerSnapshotTests 32 | 33 | - (void)setUp 34 | { 35 | #if __LP64__ 36 | RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)"); 37 | #endif 38 | 39 | NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion; 40 | RCTAssert(version.majorVersion == 8 || version.minorVersion >= 3, @"Snapshot tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion); 41 | _runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios", nil); 42 | _runner.recordMode = NO; 43 | } 44 | 45 | #define RCT_TEST(name) \ 46 | - (void)test##name \ 47 | { \ 48 | [_runner runTest:_cmd module:@#name]; \ 49 | } 50 | 51 | RCT_TEST(ViewExample) 52 | RCT_TEST(LayoutExample) 53 | RCT_TEST(TextExample) 54 | RCT_TEST(SwitchExample) 55 | RCT_TEST(SliderExample) 56 | RCT_TEST(TabBarExample) 57 | 58 | - (void)testZZZNotInRecordMode 59 | { 60 | XCTAssertFalse(_runner.recordMode, @"Don't forget to turn record mode back to off"); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMStubRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMRecorder.h" 18 | 19 | 20 | @interface OCMStubRecorder : OCMRecorder 21 | 22 | - (id)andReturn:(id)anObject; 23 | - (id)andReturnValue:(NSValue *)aValue; 24 | - (id)andThrow:(NSException *)anException; 25 | - (id)andPost:(NSNotification *)aNotification; 26 | - (id)andCall:(SEL)selector onObject:(id)anObject; 27 | - (id)andDo:(void (^)(NSInvocation *invocation))block; 28 | - (id)andForwardToRealObject; 29 | 30 | @end 31 | 32 | 33 | @interface OCMStubRecorder (Properties) 34 | 35 | #define andReturn(aValue) _andReturn(({ __typeof__(aValue) _v = (aValue); [NSValue value:&_v withObjCType:@encode(__typeof__(_v))]; })) 36 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *); 37 | 38 | #define andThrow(anException) _andThrow(anException) 39 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *); 40 | 41 | #define andPost(aNotification) _andPost(aNotification) 42 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *); 43 | 44 | #define andCall(anObject, aSelector) _andCall(anObject, aSelector) 45 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL); 46 | 47 | #define andDo(aBlock) _andDo(aBlock) 48 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *)); 49 | 50 | #define andForwardToRealObject() _andForwardToRealObject() 51 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void); 52 | 53 | @end 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/UIExplorerIntegrationTests.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 14 | 15 | #import "RCTAssert.h" 16 | 17 | #define RCT_TEST(name) \ 18 | - (void)test##name \ 19 | { \ 20 | [_runner runTest:_cmd module:@#name]; \ 21 | } 22 | 23 | @interface UIExplorerIntegrationTests : XCTestCase 24 | 25 | @end 26 | 27 | @implementation UIExplorerIntegrationTests 28 | { 29 | RCTTestRunner *_runner; 30 | } 31 | 32 | - (void)setUp 33 | { 34 | #if __LP64__ 35 | RCTAssert(NO, @"Tests should be run on 32-bit device simulators (e.g. iPhone 5)"); 36 | #endif 37 | 38 | NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion; 39 | RCTAssert(version.majorVersion == 8 || version.minorVersion >= 3, @"Tests should be run on iOS 8.3+, found %zd.%zd.%zd", version.majorVersion, version.minorVersion, version.patchVersion); 40 | _runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp", nil); 41 | } 42 | 43 | #pragma mark Logic Tests 44 | 45 | - (void)testTheTester_waitOneFrame 46 | { 47 | [_runner runTest:_cmd 48 | module:@"IntegrationTestHarnessTest" 49 | initialProps:@{@"waitOneFrame": @YES} 50 | expectErrorBlock:nil]; 51 | } 52 | 53 | - (void)testTheTester_ExpectError 54 | { 55 | [_runner runTest:_cmd 56 | module:@"IntegrationTestHarnessTest" 57 | initialProps:@{@"shouldThrow": @YES} 58 | expectErrorRegex:@"because shouldThrow"]; 59 | } 60 | 61 | RCT_TEST(TimersTest) 62 | RCT_TEST(IntegrationTestHarnessTest) 63 | RCT_TEST(AsyncStorageTest) 64 | // RCT_TEST(LayoutEventsTest) -- Disabled: #8153468 65 | RCT_TEST(AppEventsTest) 66 | RCT_TEST(PromiseTest) 67 | // RCT_TEST(SimpleSnapshotTest) -- Disabled: #8153475 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /UIExplorerApp.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule UIExplorerApp 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var UIExplorerList = require('./UIExplorerList.ios'); 21 | var { 22 | AppRegistry, 23 | NavigatorIOS, 24 | StyleSheet, 25 | } = React; 26 | 27 | var UIExplorerApp = React.createClass({ 28 | 29 | getInitialState: function() { 30 | return { 31 | openExternalExample: (null: ?React.Component), 32 | }; 33 | }, 34 | 35 | render: function() { 36 | if (this.state.openExternalExample) { 37 | var Example = this.state.openExternalExample; 38 | return ( 39 | { 41 | this.setState({ openExternalExample: null, }); 42 | }} 43 | /> 44 | ); 45 | } 46 | 47 | return ( 48 | { 55 | this.setState({ openExternalExample: example, }); 56 | }, 57 | } 58 | }} 59 | itemWrapperStyle={styles.itemWrapper} 60 | tintColor="#008888" 61 | /> 62 | ); 63 | } 64 | }); 65 | 66 | var styles = StyleSheet.create({ 67 | container: { 68 | flex: 1, 69 | }, 70 | itemWrapper: { 71 | backgroundColor: '#eaeaea', 72 | }, 73 | }); 74 | 75 | AppRegistry.registerComponent('UIExplorerApp', () => UIExplorerApp); 76 | 77 | module.exports = UIExplorerApp; 78 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule UIExplorerApp 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var UIExplorerList = require('./UIExplorerList.ios'); 21 | var { 22 | AppRegistry, 23 | NavigatorIOS, 24 | StyleSheet, 25 | } = React; 26 | 27 | var UIExplorerApp = React.createClass({ 28 | 29 | getInitialState: function() { 30 | return { 31 | openExternalExample: (null: ?React.Component), 32 | }; 33 | }, 34 | 35 | render: function() { 36 | if (this.state.openExternalExample) { 37 | var Example = this.state.openExternalExample; 38 | return ( 39 | { 41 | this.setState({ openExternalExample: null, }); 42 | }} 43 | /> 44 | ); 45 | } 46 | 47 | return ( 48 | { 55 | this.setState({ openExternalExample: example, }); 56 | }, 57 | } 58 | }} 59 | itemWrapperStyle={styles.itemWrapper} 60 | tintColor="#008888" 61 | /> 62 | ); 63 | } 64 | }); 65 | 66 | var styles = StyleSheet.create({ 67 | container: { 68 | flex: 1, 69 | }, 70 | itemWrapper: { 71 | backgroundColor: '#eaeaea', 72 | }, 73 | }); 74 | 75 | AppRegistry.registerComponent('UIExplorerApp', () => UIExplorerApp); 76 | 77 | module.exports = UIExplorerApp; 78 | -------------------------------------------------------------------------------- /ImageCapInsetsExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule ImageCapInsetsExample 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | Image, 22 | StyleSheet, 23 | Text, 24 | View, 25 | } = React; 26 | 27 | var ImageCapInsetsExample = React.createClass({ 28 | render: function() { 29 | return ( 30 | 31 | 32 | 33 | capInsets: none 34 | 35 | 40 | 41 | 42 | 43 | capInsets: 15 44 | 45 | 50 | 51 | 52 | ); 53 | } 54 | }); 55 | 56 | var styles = StyleSheet.create({ 57 | background: { 58 | backgroundColor: '#F6F6F6', 59 | justifyContent: 'center', 60 | alignItems: 'center', 61 | }, 62 | horizontal: { 63 | flexDirection: 'row', 64 | }, 65 | storyBackground: { 66 | width: 250, 67 | height: 150, 68 | borderWidth: 1, 69 | resizeMode: Image.resizeMode.stretch, 70 | }, 71 | text: { 72 | fontSize: 13.5, 73 | } 74 | }); 75 | 76 | module.exports = ImageCapInsetsExample; 77 | -------------------------------------------------------------------------------- /ProgressBarAndroidExample.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var ProgressBar = require('ProgressBarAndroid'); 19 | var React = require('React'); 20 | var UIExplorerBlock = require('UIExplorerBlock'); 21 | var UIExplorerPage = require('UIExplorerPage'); 22 | 23 | var ProgressBarAndroidExample = React.createClass({ 24 | 25 | statics: { 26 | title: '', 27 | description: 'Visual indicator of progress of some operation. ' + 28 | 'Shows either a cyclic animation or a horizontal bar.', 29 | }, 30 | 31 | render: function() { 32 | return ( 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ); 59 | }, 60 | }); 61 | 62 | module.exports = ProgressBarAndroidExample; 63 | -------------------------------------------------------------------------------- /ToastAndroidExample.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | StyleSheet, 22 | Text, 23 | ToastAndroid, 24 | TouchableWithoutFeedback 25 | } = React; 26 | 27 | var UIExplorerBlock = require('UIExplorerBlock'); 28 | var UIExplorerPage = require('UIExplorerPage'); 29 | 30 | var ToastExample = React.createClass({ 31 | 32 | statics: { 33 | title: 'Toast Example', 34 | description: 'Example that demostrates the use of an Android Toast to provide feedback.', 35 | }, 36 | 37 | getInitialState: function() { 38 | return {}; 39 | }, 40 | 41 | render: function() { 42 | return ( 43 | 44 | 45 | 47 | ToastAndroid.show('This is a toast with short duration', ToastAndroid.SHORT)}> 48 | Click me. 49 | 50 | 51 | 52 | 54 | ToastAndroid.show('This is a toast with long duration', ToastAndroid.LONG)}> 55 | Click me too. 56 | 57 | 58 | 59 | ); 60 | }, 61 | }); 62 | 63 | var styles = StyleSheet.create({ 64 | text: { 65 | color: 'black', 66 | }, 67 | }); 68 | 69 | module.exports = ToastExample; 70 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/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:@"UIExplorerApp" 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 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMInvocationStub; 21 | @class OCMStubRecorder; 22 | @class OCMInvocationMatcher; 23 | @class OCMInvocationExpectation; 24 | 25 | 26 | @interface OCMockObject : NSProxy 27 | { 28 | BOOL isNice; 29 | BOOL expectationOrderMatters; 30 | NSMutableArray *stubs; 31 | NSMutableArray *expectations; 32 | NSMutableArray *exceptions; 33 | NSMutableArray *invocations; 34 | } 35 | 36 | + (id)mockForClass:(Class)aClass; 37 | + (id)mockForProtocol:(Protocol *)aProtocol; 38 | + (id)partialMockForObject:(NSObject *)anObject; 39 | 40 | + (id)niceMockForClass:(Class)aClass; 41 | + (id)niceMockForProtocol:(Protocol *)aProtocol; 42 | 43 | + (id)observerMock; 44 | 45 | - (instancetype)init; 46 | 47 | - (void)setExpectationOrderMatters:(BOOL)flag; 48 | 49 | - (id)stub; 50 | - (id)expect; 51 | - (id)reject; 52 | 53 | - (id)verify; 54 | - (id)verifyAtLocation:(OCMLocation *)location; 55 | 56 | - (void)verifyWithDelay:(NSTimeInterval)delay; 57 | - (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location; 58 | 59 | - (void)stopMocking; 60 | 61 | // internal use only 62 | 63 | - (void)addStub:(OCMInvocationStub *)aStub; 64 | - (void)addExpectation:(OCMInvocationExpectation *)anExpectation; 65 | 66 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation; 67 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation; 68 | - (BOOL)handleSelector:(SEL)sel; 69 | 70 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher; 71 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location; 72 | 73 | @end 74 | 75 | -------------------------------------------------------------------------------- /ios/UIExplorerAppTests/UIExplorerAppTests.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 UIExplorerAppTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation UIExplorerAppTests 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 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/uiexplorerapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.uiexplorerapp; 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, "UIExplorerApp", 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 | -------------------------------------------------------------------------------- /UIExplorerPage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule UIExplorerPage 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | ScrollView, 22 | StyleSheet, 23 | View, 24 | } = React; 25 | 26 | var UIExplorerTitle = require('./UIExplorerTitle'); 27 | 28 | var UIExplorerPage = React.createClass({ 29 | 30 | propTypes: { 31 | keyboardShouldPersistTaps: React.PropTypes.bool, 32 | noScroll: React.PropTypes.bool, 33 | noSpacer: React.PropTypes.bool, 34 | }, 35 | 36 | render: function() { 37 | var ContentWrapper; 38 | var wrapperProps = {}; 39 | if (this.props.noScroll) { 40 | ContentWrapper = (View: ReactClass); 41 | } else { 42 | ContentWrapper = (ScrollView: ReactClass); 43 | wrapperProps.automaticallyAdjustContentInsets = !this.props.title; 44 | wrapperProps.keyboardShouldPersistTaps = true; 45 | wrapperProps.keyboardDismissMode = 'interactive'; 46 | } 47 | var title = this.props.title ? 48 | : 49 | null; 50 | var spacer = this.props.noSpacer ? null : ; 51 | return ( 52 | 53 | {title} 54 | 57 | {this.props.children} 58 | {spacer} 59 | 60 | 61 | ); 62 | }, 63 | }); 64 | 65 | var styles = StyleSheet.create({ 66 | container: { 67 | backgroundColor: '#e9eaed', 68 | flex: 1, 69 | }, 70 | spacer: { 71 | height: 270, 72 | }, 73 | wrapper: { 74 | flex: 1, 75 | paddingTop: 10, 76 | }, 77 | }); 78 | 79 | module.exports = UIExplorerPage; 80 | -------------------------------------------------------------------------------- /ScrollViewSimpleExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | ScrollView, 21 | StyleSheet, 22 | Text, 23 | TouchableOpacity 24 | } = React; 25 | 26 | var NUM_ITEMS = 20; 27 | 28 | var ScrollViewSimpleExample = React.createClass({ 29 | statics: { 30 | title: '', 31 | description: 'Component that enables scrolling through child components.' 32 | }, 33 | makeItems: function(nItems: number, styles): Array { 34 | var items = []; 35 | for (var i = 0; i < nItems; i++) { 36 | items[i] = ( 37 | 38 | {'Item ' + i} 39 | 40 | ); 41 | } 42 | return items; 43 | }, 44 | 45 | render: function() { 46 | // One of the items is a horizontal scroll view 47 | var items = this.makeItems(NUM_ITEMS, styles.itemWrapper); 48 | items[4] = ( 49 | 50 | {this.makeItems(NUM_ITEMS, [styles.itemWrapper, styles.horizontalItemWrapper])} 51 | 52 | ); 53 | 54 | var verticalScrollView = ( 55 | 56 | {items} 57 | 58 | ); 59 | 60 | return verticalScrollView; 61 | } 62 | }); 63 | 64 | var styles = StyleSheet.create({ 65 | verticalScrollView: { 66 | margin: 10, 67 | }, 68 | itemWrapper: { 69 | backgroundColor: '#dddddd', 70 | alignItems: 'center', 71 | borderRadius: 5, 72 | borderWidth: 5, 73 | borderColor: '#a52a2a', 74 | padding: 30, 75 | margin: 5, 76 | }, 77 | horizontalItemWrapper: { 78 | padding: 50 79 | } 80 | }); 81 | 82 | module.exports = ScrollViewSimpleExample; 83 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTImageLoaderHelpers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import "RCTImageLoader.h" 16 | 17 | typedef BOOL (^RCTImageURLLoaderCanLoadImageURLHandler)(NSURL *requestURL); 18 | typedef RCTImageLoaderCancellationBlock (^RCTImageURLLoaderLoadImageURLHandler)(NSURL *imageURL, CGSize size, CGFloat scale, UIViewContentMode resizeMode, RCTImageLoaderProgressBlock progressHandler, RCTImageLoaderCompletionBlock completionHandler); 19 | 20 | @interface RCTConcreteImageURLLoader : NSObject 21 | 22 | - (instancetype)initWithPriority:(float)priority 23 | canLoadImageURLHandler:(RCTImageURLLoaderCanLoadImageURLHandler)canLoadImageURLHandler 24 | loadImageURLHandler:(RCTImageURLLoaderLoadImageURLHandler)loadImageURLHandler; 25 | 26 | @end 27 | 28 | typedef BOOL (^RCTImageDecoderCanDecodeImageDataHandler)(NSData *imageData); 29 | typedef RCTImageLoaderCancellationBlock (^RCTImageDecoderDecodeImageDataHandler)(NSData *imageData, CGSize size, CGFloat scale, UIViewContentMode resizeMode, RCTImageLoaderCompletionBlock completionHandler); 30 | 31 | @interface RCTConcreteImageDecoder : NSObject 32 | 33 | - (instancetype)initWithPriority:(float)priority 34 | canDecodeImageDataHandler:(RCTImageDecoderCanDecodeImageDataHandler)canDecodeImageDataHandler 35 | decodeImageDataHandler:(RCTImageDecoderDecodeImageDataHandler)decodeImageDataHandler; 36 | 37 | @end 38 | 39 | #define _RCTDefineImageHandler(SUPERCLASS, CLASS_NAME) \ 40 | @interface CLASS_NAME : SUPERCLASS @end \ 41 | @implementation CLASS_NAME RCT_EXPORT_MODULE() @end 42 | 43 | #define RCTDefineImageURLLoader(CLASS_NAME) \ 44 | _RCTDefineImageHandler(RCTConcreteImageURLLoader, CLASS_NAME) 45 | 46 | #define RCTDefineImageDecoder(CLASS_NAME) \ 47 | _RCTDefineImageHandler(RCTConcreteImageDecoder, CLASS_NAME) 48 | -------------------------------------------------------------------------------- /GeolocationExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | /* eslint no-console: 0 */ 17 | 'use strict'; 18 | 19 | 20 | var React = require('react-native'); 21 | var { 22 | StyleSheet, 23 | Text, 24 | View, 25 | } = React; 26 | 27 | exports.framework = 'React'; 28 | exports.title = 'Geolocation'; 29 | exports.description = 'Examples of using the Geolocation API.'; 30 | 31 | exports.examples = [ 32 | { 33 | title: 'navigator.geolocation', 34 | render: function(): ReactElement { 35 | return ; 36 | }, 37 | } 38 | ]; 39 | 40 | var GeolocationExample = React.createClass({ 41 | watchID: (null: ?number), 42 | 43 | getInitialState: function() { 44 | return { 45 | initialPosition: 'unknown', 46 | lastPosition: 'unknown', 47 | }; 48 | }, 49 | 50 | componentDidMount: function() { 51 | navigator.geolocation.getCurrentPosition( 52 | (initialPosition) => this.setState({initialPosition}), 53 | (error) => alert(error.message), 54 | {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000} 55 | ); 56 | this.watchID = navigator.geolocation.watchPosition((lastPosition) => { 57 | this.setState({lastPosition}); 58 | }); 59 | }, 60 | 61 | componentWillUnmount: function() { 62 | navigator.geolocation.clearWatch(this.watchID); 63 | }, 64 | 65 | render: function() { 66 | return ( 67 | 68 | 69 | Initial position: 70 | {JSON.stringify(this.state.initialPosition)} 71 | 72 | 73 | Current position: 74 | {JSON.stringify(this.state.lastPosition)} 75 | 76 | 77 | ); 78 | } 79 | }); 80 | 81 | var styles = StyleSheet.create({ 82 | title: { 83 | fontWeight: '500', 84 | }, 85 | }); 86 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTJSONTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | #import "RCTUtils.h" 17 | 18 | @interface RCTJSONTests : XCTestCase 19 | 20 | @end 21 | 22 | @implementation RCTJSONTests 23 | 24 | - (void)testEncodingObject 25 | { 26 | NSDictionary *obj = @{@"foo": @"bar"}; 27 | NSString *json = @"{\"foo\":\"bar\"}"; 28 | XCTAssertEqualObjects(json, RCTJSONStringify(obj, NULL)); 29 | } 30 | 31 | - (void)testEncodingArray 32 | { 33 | NSArray *array = @[@"foo", @"bar"]; 34 | NSString *json = @"[\"foo\",\"bar\"]"; 35 | XCTAssertEqualObjects(json, RCTJSONStringify(array, NULL)); 36 | } 37 | 38 | - (void)testEncodingString 39 | { 40 | NSString *text = @"Hello\nWorld"; 41 | NSString *json = @"\"Hello\\nWorld\""; 42 | XCTAssertEqualObjects(json, RCTJSONStringify(text, NULL)); 43 | } 44 | 45 | - (void)testDecodingObject 46 | { 47 | NSDictionary *obj = @{@"foo": @"bar"}; 48 | NSString *json = @"{\"foo\":\"bar\"}"; 49 | XCTAssertEqualObjects(obj, RCTJSONParse(json, NULL)); 50 | } 51 | 52 | - (void)testDecodingArray 53 | { 54 | NSArray *array = @[@"foo", @"bar"]; 55 | NSString *json = @"[\"foo\",\"bar\"]"; 56 | XCTAssertEqualObjects(array, RCTJSONParse(json, NULL)); 57 | } 58 | 59 | - (void)testDecodingString 60 | { 61 | NSString *text = @"Hello\nWorld"; 62 | NSString *json = @"\"Hello\\nWorld\""; 63 | XCTAssertEqualObjects(text, RCTJSONParse(json, NULL)); 64 | } 65 | 66 | - (void)testDecodingMutableArray 67 | { 68 | NSString *json = @"[1,2,3]"; 69 | NSMutableArray *array = RCTJSONParseMutable(json, NULL); 70 | XCTAssertNoThrow([array addObject:@4]); 71 | XCTAssertEqualObjects(array, (@[@1, @2, @3, @4])); 72 | } 73 | 74 | - (void)testLeadingWhitespace 75 | { 76 | NSDictionary *obj = @{@"foo": @"bar"}; 77 | NSString *json = @" \r\n\t{\"foo\":\"bar\"}"; 78 | XCTAssertEqualObjects(obj, RCTJSONParse(json, NULL)); 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /SwitchAndroidExample.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2004-present Facebook. All Rights Reserved. 3 | */ 4 | 'use strict'; 5 | 6 | var React = require('React'); 7 | 8 | var SwitchAndroid = require('SwitchAndroid'); 9 | var Text = require('Text'); 10 | var UIExplorerBlock = require('UIExplorerBlock'); 11 | var UIExplorerPage = require('UIExplorerPage'); 12 | 13 | var SwitchAndroidExample = React.createClass({ 14 | statics: { 15 | title: '', 16 | description: 'Standard Android two-state toggle component.' 17 | }, 18 | 19 | getInitialState : function() { 20 | return { 21 | trueSwitchIsOn: true, 22 | falseSwitchIsOn: false, 23 | colorTrueSwitchIsOn: true, 24 | colorFalseSwitchIsOn: false, 25 | eventSwitchIsOn: false, 26 | }; 27 | }, 28 | 29 | render: function() { 30 | return ( 31 | 32 | 33 | this.setState({falseSwitchIsOn: value})} 35 | style={{marginBottom: 10}} 36 | value={this.state.falseSwitchIsOn} /> 37 | this.setState({trueSwitchIsOn: value})} 39 | value={this.state.trueSwitchIsOn} /> 40 | 41 | 42 | 46 | 49 | 50 | 51 | this.setState({eventSwitchIsOn: value})} 53 | style={{marginBottom: 10}} 54 | value={this.state.eventSwitchIsOn} /> 55 | this.setState({eventSwitchIsOn: value})} 57 | style={{marginBottom: 10}} 58 | value={this.state.eventSwitchIsOn} /> 59 | {this.state.eventSwitchIsOn ? "On" : "Off"} 60 | 61 | 62 | 63 | 64 | 65 | 66 | ); 67 | } 68 | }); 69 | 70 | module.exports = SwitchAndroidExample; 71 | -------------------------------------------------------------------------------- /NavigatorIOSColorsExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 'use strict'; 15 | 16 | var React = require('react-native'); 17 | var { 18 | NavigatorIOS, 19 | StatusBarIOS, 20 | StyleSheet, 21 | Text, 22 | View 23 | } = React; 24 | 25 | var EmptyPage = React.createClass({ 26 | 27 | render: function() { 28 | return ( 29 | 30 | 31 | {this.props.text} 32 | 33 | 34 | ); 35 | }, 36 | 37 | }); 38 | 39 | var NavigatorIOSColors = React.createClass({ 40 | 41 | statics: { 42 | title: ' - Custom', 43 | description: 'iOS navigation with custom nav bar colors', 44 | }, 45 | 46 | render: function() { 47 | // Set StatusBar with light contents to get better contrast 48 | StatusBarIOS.setStyle('light-content'); 49 | 50 | return ( 51 | ', 56 | rightButtonTitle: 'Done', 57 | onRightButtonPress: () => { 58 | StatusBarIOS.setStyle('default'); 59 | this.props.onExampleExit(); 60 | }, 61 | passProps: { 62 | text: 'The nav bar has custom colors with tintColor, ' + 63 | 'barTintColor and titleTextColor props.', 64 | }, 65 | }} 66 | tintColor="#FFFFFF" 67 | barTintColor="#183E63" 68 | titleTextColor="#FFFFFF" 69 | translucent="true" 70 | /> 71 | ); 72 | }, 73 | 74 | }); 75 | 76 | var styles = StyleSheet.create({ 77 | container: { 78 | flex: 1, 79 | }, 80 | emptyPage: { 81 | flex: 1, 82 | paddingTop: 64, 83 | }, 84 | emptyPageText: { 85 | margin: 10, 86 | }, 87 | }); 88 | 89 | NavigatorIOSColors.external = true; 90 | 91 | module.exports = NavigatorIOSColors; 92 | -------------------------------------------------------------------------------- /UIExplorerIntegrationTests/js/IntegrationTestsApp.js: -------------------------------------------------------------------------------- 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 | * @providesModule IntegrationTestsApp 10 | */ 11 | 'use strict'; 12 | 13 | require('regenerator/runtime'); 14 | 15 | var React = require('react-native'); 16 | 17 | var { 18 | AppRegistry, 19 | ScrollView, 20 | StyleSheet, 21 | Text, 22 | TouchableOpacity, 23 | View, 24 | } = React; 25 | 26 | var TESTS = [ 27 | require('./IntegrationTestHarnessTest'), 28 | require('./TimersTest'), 29 | require('./AsyncStorageTest'), 30 | require('./LayoutEventsTest'), 31 | require('./AppEventsTest'), 32 | require('./SimpleSnapshotTest'), 33 | require('./PromiseTest'), 34 | ]; 35 | 36 | TESTS.forEach( 37 | (test) => AppRegistry.registerComponent(test.displayName, () => test) 38 | ); 39 | 40 | var IntegrationTestsApp = React.createClass({ 41 | getInitialState: function() { 42 | return { 43 | test: null, 44 | }; 45 | }, 46 | render: function() { 47 | if (this.state.test) { 48 | return ( 49 | 50 | 51 | 52 | ); 53 | } 54 | return ( 55 | 56 | 57 | Click on a test to run it in this shell for easier debugging and 58 | development. Run all tests in the testing environment with cmd+U in 59 | Xcode. 60 | 61 | 62 | 63 | {TESTS.map((test) => [ 64 | this.setState({test})} 66 | style={styles.row}> 67 | 68 | {test.displayName} 69 | 70 | , 71 | 72 | ])} 73 | 74 | 75 | ); 76 | } 77 | }); 78 | 79 | var styles = StyleSheet.create({ 80 | container: { 81 | backgroundColor: 'white', 82 | marginTop: 40, 83 | margin: 15, 84 | }, 85 | row: { 86 | padding: 10, 87 | }, 88 | testName: { 89 | fontWeight: '500', 90 | }, 91 | separator: { 92 | height: 1, 93 | backgroundColor: '#bbbbbb', 94 | }, 95 | }); 96 | 97 | AppRegistry.registerComponent('IntegrationTestsApp', () => IntegrationTestsApp); 98 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /ProgressViewIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | ProgressViewIOS, 21 | StyleSheet, 22 | View, 23 | } = React; 24 | var TimerMixin = require('react-timer-mixin'); 25 | 26 | var ProgressViewExample = React.createClass({ 27 | mixins: [TimerMixin], 28 | 29 | getInitialState() { 30 | return { 31 | progress: 0, 32 | }; 33 | }, 34 | 35 | componentDidMount() { 36 | this.updateProgress(); 37 | }, 38 | 39 | updateProgress() { 40 | var progress = this.state.progress + 0.01; 41 | this.setState({ progress }); 42 | this.requestAnimationFrame(() => this.updateProgress()); 43 | }, 44 | 45 | getProgress(offset) { 46 | var progress = this.state.progress + offset; 47 | return Math.sin(progress % Math.PI) % 1; 48 | }, 49 | 50 | render() { 51 | return ( 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | ); 60 | }, 61 | }); 62 | 63 | exports.displayName = (undefined: ?string); 64 | exports.framework = 'React'; 65 | exports.title = 'ProgressViewIOS'; 66 | exports.description = 'ProgressViewIOS'; 67 | exports.examples = [{ 68 | title: 'ProgressViewIOS', 69 | render() { 70 | return ( 71 | 72 | ); 73 | } 74 | }]; 75 | 76 | var styles = StyleSheet.create({ 77 | container: { 78 | marginTop: -20, 79 | backgroundColor: 'transparent', 80 | }, 81 | progressView: { 82 | marginTop: 20, 83 | } 84 | }); 85 | -------------------------------------------------------------------------------- /components/CustomTabBar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author brentvatne 3 | * @github https://github.com/brentvatne/react-native-scrollable-tab-view 4 | * @name CustomTabBar 5 | * @edited marsprince 6 | */ 7 | 'use strict'; 8 | 9 | var React = require('react-native'); 10 | var { 11 | StyleSheet, 12 | Text, 13 | View, 14 | TouchableOpacity, 15 | } = React; 16 | 17 | var deviceWidth = require('Dimensions').get('window').width; 18 | //var precomputeStyle = require('precomputeStyle'); 19 | var TAB_UNDERLINE_REF = 'TAB_UNDERLINE'; 20 | var TAB_MAIN= 'TAB_MAIN'; 21 | 22 | var styles = StyleSheet.create({ 23 | tab: { 24 | flex: 1, 25 | alignItems: 'center', 26 | justifyContent: 'center', 27 | paddingBottom: 10, 28 | }, 29 | 30 | tabs: { 31 | height: 50, 32 | flexDirection: 'row', 33 | marginTop: 20, 34 | borderWidth: 1, 35 | borderTopWidth: 0, 36 | borderLeftWidth: 0, 37 | borderRightWidth: 0, 38 | borderBottomColor: '#ccc', 39 | }, 40 | }); 41 | 42 | var CustomTabBar = React.createClass({ 43 | propTypes: { 44 | goToPage: React.PropTypes.func, 45 | activeTab: React.PropTypes.number, 46 | tabs: React.PropTypes.array 47 | }, 48 | 49 | renderTabOption(name, page) { 50 | var isTabActive = this.props.activeTab === page; 51 | 52 | return ( 53 | this.props.goToPage(page)}> 54 | {name} 55 | 56 | ); 57 | }, 58 | 59 | setAnimationValue(value) { 60 | this.refs[TAB_MAIN].measure((ox, oy, width, height) => { 61 | this.refs[TAB_UNDERLINE_REF].setNativeProps({ 62 | style: { left: (width * value) / this.props.tabs.length} 63 | }); 64 | }); 65 | }, 66 | componentDidMount() { 67 | setTimeout(this.measureHeader); 68 | }, 69 | 70 | measureHeader() { 71 | this.refs[TAB_MAIN].measure((ox, oy, width, height) => { 72 | this.refs[TAB_UNDERLINE_REF].setNativeProps({ 73 | style: { width: width / this.props.tabs.length} 74 | }); 75 | }); 76 | }, 77 | render() { 78 | var tabUnderlineStyle = { 79 | position: 'absolute', 80 | height: 4, 81 | backgroundColor: 'navy', 82 | bottom: 0, 83 | }; 84 | 85 | return ( 86 | 87 | 88 | {this.props.tabs.map((tab, i) => this.renderTabOption(tab, i))} 89 | 90 | 91 | 92 | ); 93 | }, 94 | }); 95 | 96 | module.exports = CustomTabBar; -------------------------------------------------------------------------------- /AssetScaledImageExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | Image, 21 | StyleSheet, 22 | View, 23 | ScrollView 24 | } = React; 25 | 26 | var AssetScaledImageExample = React.createClass({ 27 | 28 | getInitialState() { 29 | return { 30 | asset: this.props.asset 31 | }; 32 | }, 33 | 34 | render() { 35 | var image = this.state.asset.node.image; 36 | return ( 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ); 52 | }, 53 | }); 54 | 55 | var styles = StyleSheet.create({ 56 | row: { 57 | padding: 5, 58 | flex: 1, 59 | flexDirection: 'row', 60 | alignSelf: 'center', 61 | }, 62 | textColumn: { 63 | flex: 1, 64 | flexDirection: 'column', 65 | }, 66 | imageWide: { 67 | borderWidth: 1, 68 | borderColor: 'black', 69 | width: 320, 70 | height: 240, 71 | margin: 5, 72 | }, 73 | imageThumb: { 74 | borderWidth: 1, 75 | borderColor: 'black', 76 | width: 100, 77 | height: 100, 78 | margin: 5, 79 | }, 80 | imageT1: { 81 | borderWidth: 1, 82 | borderColor: 'black', 83 | width: 212, 84 | height: 320, 85 | margin: 5, 86 | }, 87 | imageT2: { 88 | borderWidth: 1, 89 | borderColor: 'black', 90 | width: 100, 91 | height: 320, 92 | margin: 5, 93 | }, 94 | }); 95 | 96 | exports.title = ''; 97 | exports.description = 'Example component that displays the automatic scaling capabilities of the tag'; 98 | module.exports = AssetScaledImageExample; 99 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTGzipTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | #import "RCTUtils.h" 17 | #import "RCTNetworking.h" 18 | 19 | extern BOOL RCTIsGzippedData(NSData *data); 20 | 21 | @interface RCTNetworking (Private) 22 | 23 | - (void)buildRequest:(NSDictionary *)query 24 | completionBlock:(void (^)(NSURLRequest *request))block; 25 | 26 | @end 27 | 28 | @interface RCTGzipTests : XCTestCase 29 | 30 | @end 31 | 32 | @implementation RCTGzipTests 33 | 34 | - (void)testGzip 35 | { 36 | //set up data 37 | NSString *inputString = @"Hello World!"; 38 | NSData *inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; 39 | 40 | //compress 41 | NSData *outputData = RCTGzipData(inputData, -1); 42 | XCTAssertTrue(RCTIsGzippedData(outputData)); 43 | } 44 | 45 | - (void)testDontRezipZippedData 46 | { 47 | //set up data 48 | NSString *inputString = @"Hello World!"; 49 | NSData *inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; 50 | 51 | //compress 52 | NSData *compressedData = RCTGzipData(inputData, -1); 53 | inputString = [[NSString alloc] initWithData:compressedData encoding:NSUTF8StringEncoding]; 54 | 55 | //compress again 56 | NSData *outputData = RCTGzipData(inputData, -1); 57 | NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding]; 58 | XCTAssertEqualObjects(outputString, inputString); 59 | } 60 | 61 | - (void)testRequestBodyEncoding 62 | { 63 | NSDictionary *query = @{ 64 | @"url": @"http://example.com", 65 | @"method": @"POST", 66 | @"data": @{@"string": @"Hello World"}, 67 | @"headers": @{@"Content-Encoding": @"gzip"}, 68 | }; 69 | 70 | RCTNetworking *networker = [RCTNetworking new]; 71 | __block NSURLRequest *request = nil; 72 | [networker buildRequest:query completionBlock:^(NSURLRequest *_request) { 73 | request = _request; 74 | }]; 75 | 76 | XCTAssertNotNil(request); 77 | XCTAssertNotNil(request.HTTPBody); 78 | XCTAssertTrue(RCTIsGzippedData(request.HTTPBody)); 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /UIExplorerBlock.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule UIExplorerBlock 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | StyleSheet, 22 | Text, 23 | View, 24 | } = React; 25 | 26 | var UIExplorerBlock = React.createClass({ 27 | propTypes: { 28 | title: React.PropTypes.string, 29 | description: React.PropTypes.string, 30 | }, 31 | 32 | getInitialState: function() { 33 | return {description: (null: ?string)}; 34 | }, 35 | 36 | render: function() { 37 | var description; 38 | if (this.props.description) { 39 | description = 40 | 41 | {this.props.description} 42 | ; 43 | } 44 | 45 | return ( 46 | 47 | 48 | 49 | {this.props.title} 50 | 51 | {description} 52 | 53 | 54 | {this.props.children} 55 | 56 | 57 | ); 58 | } 59 | }); 60 | 61 | var styles = StyleSheet.create({ 62 | container: { 63 | borderRadius: 3, 64 | borderWidth: 0.5, 65 | borderColor: '#d6d7da', 66 | backgroundColor: '#ffffff', 67 | margin: 10, 68 | marginVertical: 5, 69 | overflow: 'hidden', 70 | }, 71 | titleContainer: { 72 | borderBottomWidth: 0.5, 73 | borderTopLeftRadius: 3, 74 | borderTopRightRadius: 2.5, 75 | borderBottomColor: '#d6d7da', 76 | backgroundColor: '#f6f7f8', 77 | paddingHorizontal: 10, 78 | paddingVertical: 5, 79 | }, 80 | titleText: { 81 | fontSize: 14, 82 | fontWeight: '500', 83 | }, 84 | descriptionText: { 85 | fontSize: 14, 86 | }, 87 | disclosure: { 88 | position: 'absolute', 89 | top: 0, 90 | right: 0, 91 | padding: 10, 92 | }, 93 | disclosureIcon: { 94 | width: 12, 95 | height: 8, 96 | }, 97 | children: { 98 | margin: 10, 99 | } 100 | }); 101 | 102 | module.exports = UIExplorerBlock; 103 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/OCMock/OCMock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2014 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | 26 | 27 | #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] 28 | 29 | #define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls] 30 | 31 | #define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol] 32 | 33 | #define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol] 34 | 35 | #define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj] 36 | 37 | #define OCMObserverMock() [OCMockObject observerMock] 38 | 39 | 40 | #define OCMStub(invocation) \ 41 | ({ \ 42 | _OCMSilenceWarnings( \ 43 | [OCMMacroState beginStubMacro]; \ 44 | invocation; \ 45 | [OCMMacroState endStubMacro]; \ 46 | ); \ 47 | }) 48 | 49 | #define OCMExpect(invocation) \ 50 | ({ \ 51 | _OCMSilenceWarnings( \ 52 | [OCMMacroState beginExpectMacro]; \ 53 | invocation; \ 54 | [OCMMacroState endExpectMacro]; \ 55 | ); \ 56 | }) 57 | 58 | #define ClassMethod(invocation) \ 59 | _OCMSilenceWarnings( \ 60 | [[OCMMacroState globalState] switchToClassMethod]; \ 61 | invocation; \ 62 | ); 63 | 64 | 65 | #define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 66 | 67 | #define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 68 | 69 | #define OCMVerify(invocation) \ 70 | ({ \ 71 | _OCMSilenceWarnings( \ 72 | [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \ 73 | invocation; \ 74 | [OCMMacroState endVerifyMacro]; \ 75 | ); \ 76 | }) 77 | 78 | #define _OCMSilenceWarnings(macro) \ 79 | ({ \ 80 | _Pragma("clang diagnostic push") \ 81 | _Pragma("clang diagnostic ignored \"-Wunused-value\"") \ 82 | macro \ 83 | _Pragma("clang diagnostic pop") \ 84 | }) 85 | -------------------------------------------------------------------------------- /AdSupportIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | AdSupportIOS, 21 | StyleSheet, 22 | Text, 23 | View, 24 | } = React; 25 | 26 | exports.framework = 'React'; 27 | exports.title = 'Advertising ID'; 28 | exports.description = 'Example of using the ad support API.'; 29 | 30 | exports.examples = [ 31 | { 32 | title: 'Ad Support IOS', 33 | render: function(): ReactElement { 34 | return ; 35 | }, 36 | } 37 | ]; 38 | 39 | var AdSupportIOSExample = React.createClass({ 40 | getInitialState: function() { 41 | return { 42 | deviceID: 'No IDFA yet', 43 | hasAdvertiserTracking: 'unset', 44 | }; 45 | }, 46 | 47 | componentDidMount: function() { 48 | AdSupportIOS.getAdvertisingId( 49 | this._onDeviceIDSuccess, 50 | this._onDeviceIDFailure 51 | ); 52 | 53 | AdSupportIOS.getAdvertisingTrackingEnabled( 54 | this._onHasTrackingSuccess, 55 | this._onHasTrackingFailure 56 | ); 57 | }, 58 | 59 | _onHasTrackingSuccess: function(hasTracking) { 60 | this.setState({ 61 | 'hasAdvertiserTracking': hasTracking, 62 | }); 63 | }, 64 | 65 | _onHasTrackingFailure: function(e) { 66 | this.setState({ 67 | 'hasAdvertiserTracking': 'Error!', 68 | }); 69 | }, 70 | 71 | _onDeviceIDSuccess: function(deviceID) { 72 | this.setState({ 73 | 'deviceID': deviceID, 74 | }); 75 | }, 76 | 77 | _onDeviceIDFailure: function(e) { 78 | this.setState({ 79 | 'deviceID': 'Error!', 80 | }); 81 | }, 82 | 83 | render: function() { 84 | return ( 85 | 86 | 87 | Advertising ID: 88 | {JSON.stringify(this.state.deviceID)} 89 | 90 | 91 | Has Advertiser Tracking: 92 | {JSON.stringify(this.state.hasAdvertiserTracking)} 93 | 94 | 95 | ); 96 | } 97 | }); 98 | 99 | var styles = StyleSheet.create({ 100 | title: { 101 | fontWeight: '500', 102 | }, 103 | }); 104 | -------------------------------------------------------------------------------- /AnimatedGratuitousApp/AnExSlides.md: -------------------------------------------------------------------------------- 1 |

2 | # React Native: Animated 3 | 4 | ReactEurope 2015, Paris - Spencer Ahrens - Facebook 5 | 6 |

7 | 8 | ## Fluid Interactions 9 | 10 | - People expect smooth, delightful experiences 11 | - Complex interactions are hard 12 | - Common patterns can be optimized 13 | 14 |

15 | 16 | 17 | ## Declarative Interactions 18 | 19 | - Wire up inputs (events) to outputs (props) + transforms (springs, easing, etc.) 20 | - Arbitrary code can define/update this config 21 | - Config can be serialized -> native/main thread 22 | - No refs or lifecycle to worry about 23 | 24 |

25 | 26 | 27 | ## var { Animated } = require('react-native'); 28 | 29 | - New library soon to be released for React Native 30 | - 100% JS implementation -> X-Platform 31 | - Per-platform native optimizations planned 32 | - This talk -> usage examples, not implementation 33 | 34 |

35 | 36 | 37 | ## Gratuitous Animation Demo App 38 | 39 | - Layout uses `flexWrap: 'wrap'` 40 | - longPress -> drag to reorder 41 | - Tap to open example sets 42 | 43 |

44 | 45 | ## Gratuitous Animation Codez 46 | 47 | - Step 1: 2D tracking pan gesture 48 | - Step 2: Simple pop-out spring on select 49 | - Step 3: Animate grid reordering with `LayoutAnimation` 50 | - Step 4: Opening animation 51 | 52 |

53 | 54 | ## Animation Example Set 55 | 56 | - `Animated.Value` `this.props.open` passed in from parent 57 | - `interpolate` works with string "shapes," e.g. `'rgb(0, 0, 255)'`, `'45deg'` 58 | - Examples easily composed as separate components 59 | - Dismissing tracks interpolated gesture 60 | - Custom release logic 61 | 62 |

63 | 64 | 65 | ## Tilting Photo 66 | 67 | - Pan -> translateX * 2, rotate, opacity (via tracking) 68 | - Gesture release triggers separate animations 69 | - `addListener` for async, arbitrary logic on animation progress 70 | - `interpolate` easily creates parallax and other effects 71 | 72 |

73 | 74 | ## Bobbles 75 | 76 | - Static positions defined 77 | - Listens to events to maybe change selection 78 | - Springs previous selection back 79 | - New selection tracks selector 80 | - `getTranslateTransform` adds convenience 81 | 82 |

83 | 84 | ## Chained 85 | 86 | - Classic "Chat Heads" animation 87 | - Each sticker tracks the one before it with a soft spring 88 | - `decay` maintains gesture velocity, followed by `spring` to home 89 | - `stopAnimation` provides the last value for `setOffset` 90 | 91 |

92 | 93 | ## Scrolling 94 | 95 | - `Animated.event` can track all sorts of stuff 96 | - Multi-part ranges and extrapolation options 97 | - Transforms decompose into ordered components 98 | 99 |

100 | 101 | # React Native: Animated 102 | 103 | - Landing soon in master (days) 104 | - GitHub: @vjeux, @sahrens 105 | - Questions? 106 | 107 |
108 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/LayoutSubviewsOrderingTest.m: -------------------------------------------------------------------------------- 1 | // Copyright 2004-present Facebook. All Rights Reserved. 2 | 3 | #import 4 | #import 5 | 6 | #import 7 | 8 | @interface LayoutSubviewsOrderingTest : XCTestCase 9 | 10 | @end 11 | 12 | @implementation LayoutSubviewsOrderingTest 13 | 14 | /** 15 | * This test exists to insure that didLayoutSubviews is always called immediately after layoutSubviews for a VC:View 16 | * pair. In Catalyst we have multiple levels of ViewController containment, and we rely on this ordering 17 | * to insure that layoutGuides are set on RKViewControllers before Views further down in the heirarchy have 18 | * their layoutSubviews called (and need to use the aforementioned layoutGuides) 19 | */ 20 | - (void)testLayoutSubviewsOrdering 21 | { 22 | // create some Views and ViewControllers 23 | UIViewController *parentVC = [[UIViewController alloc] init]; 24 | UIView *parentView = [[UIView alloc] init]; 25 | UIViewController *childVC = [[UIViewController alloc] init]; 26 | UIView *childView = [[UIView alloc] init]; 27 | 28 | // The ordering we expect is: 29 | // parentView::layoutSubviews 30 | // parentVC::didLayoutSubviews 31 | // childView::layoutSubviews 32 | // childVC::didLayoutSubviews 33 | 34 | id parentViewMock = [OCMockObject partialMockForObject:parentView]; 35 | id parentVCMock = [OCMockObject partialMockForObject:parentVC]; 36 | id childViewMock = [OCMockObject partialMockForObject:childView]; 37 | id childVCMock = [OCMockObject partialMockForObject:childVC]; 38 | 39 | __block int layoutOrderCount = 0; 40 | [[[parentViewMock stub] andDo:^(NSInvocation *inv) { 41 | if (layoutOrderCount < 4) { 42 | layoutOrderCount++; 43 | XCTAssertEqual(layoutOrderCount, 1, @"Expect parentView::layoutSubviews to be called first"); 44 | } 45 | }] layoutSubviews]; 46 | [[[parentVCMock stub] andDo:^(NSInvocation *inv) { 47 | if (layoutOrderCount < 4) { 48 | layoutOrderCount++; 49 | XCTAssertEqual(layoutOrderCount, 2, @"Expect parentVC::viewDidLayoutSubviews to be called 2nd"); 50 | } 51 | }] viewDidLayoutSubviews]; 52 | [[[childViewMock stub] andDo:^(NSInvocation *inv) { 53 | if (layoutOrderCount < 4) { 54 | layoutOrderCount++; 55 | XCTAssertEqual(layoutOrderCount, 3, @"Expect childView::layoutSubviews to be called 3rd"); 56 | } 57 | }] layoutSubviews]; 58 | [[[childVCMock stub] andDo:^(NSInvocation *inv) { 59 | if (layoutOrderCount < 4) { 60 | layoutOrderCount++; 61 | XCTAssertEqual(layoutOrderCount, 4, @"Expect childVC::viewDidLayoutSubviews to be called last"); 62 | [childVCMock stopMocking]; 63 | } 64 | }] viewDidLayoutSubviews]; 65 | 66 | // setup View heirarchy and force layout 67 | parentVC.view = parentView; 68 | childVC.view = childView; 69 | [parentVC addChildViewController:childVC]; 70 | [childVC didMoveToParentViewController:parentVC]; 71 | [parentView addSubview:childView]; 72 | 73 | [childViewMock setNeedsLayout]; 74 | [parentViewMock layoutIfNeeded]; 75 | 76 | XCTAssertEqual(layoutOrderCount, 4, @"Expect layoutSubviews/viewDidLayoutSubviews to be called"); 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /ScrollableTabViewExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author brentvatne 3 | * @github https://github.com/brentvatne/react-native-scrollable-tab-view 4 | * @name CustomTabBar 5 | * @added marsprince 6 | */ 7 | 'use strict'; 8 | 9 | var Platform = require('Platform'); 10 | var React = require('react-native'); 11 | var ScrollableTabView = require('react-native-scrollable-tab-view'); 12 | var CustomTabBar=require('./components/CustomTabBar'); 13 | var { 14 | StyleSheet, 15 | Text, 16 | View, 17 | ScrollView, 18 | } = React; 19 | var deviceWidth = require('Dimensions').get('window').width; 20 | 21 | var ScrollableTabViewExample = React.createClass({ 22 | render() { 23 | return ( 24 | 25 | }> 26 | 27 | 28 | News 29 | 30 | 31 | 32 | 33 | Friends 34 | 35 | 36 | 37 | 38 | Messenger 39 | 40 | 41 | 42 | 43 | Notifications 44 | 45 | 46 | 47 | 48 | Other nav 49 | 50 | 51 | 52 | 53 | ); 54 | } 55 | }); 56 | 57 | exports.title = ''; 58 | exports.description = 'ScrollableTabView ' + 59 | 'show different pages.'; 60 | 61 | exports.displayName = 'ScrollableTabView Example'; 62 | exports.examples = [ 63 | { 64 | title: 'Basic ScrollableTabView ', 65 | render: function() { 66 | return ( 67 | 68 | 69 | ); 70 | }, 71 | }, 72 | ]; 73 | var styles = StyleSheet.create({ 74 | container: { 75 | flex: 1, 76 | marginTop: 30, 77 | }, 78 | tabView: { 79 | width: deviceWidth, 80 | padding: 10, 81 | backgroundColor: 'rgba(0,0,0,0.01)', 82 | }, 83 | card: { 84 | borderWidth: 1, 85 | backgroundColor: '#fff', 86 | borderColor: 'rgba(0,0,0,0.1)', 87 | margin: 5, 88 | height: 150, 89 | padding: 15, 90 | shadowColor: '#ccc', 91 | shadowOffset: {width: 2, height: 2}, 92 | shadowOpacity: 0.5, 93 | shadowRadius: 3, 94 | }, 95 | }); 96 | -------------------------------------------------------------------------------- /AppStateIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule AppStateIOSExample 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | AppStateIOS, 22 | Text, 23 | View 24 | } = React; 25 | 26 | var AppStateSubscription = React.createClass({ 27 | getInitialState() { 28 | return { 29 | appState: AppStateIOS.currentState, 30 | previousAppStates: [], 31 | memoryWarnings: 0, 32 | }; 33 | }, 34 | componentDidMount: function() { 35 | AppStateIOS.addEventListener('change', this._handleAppStateChange); 36 | AppStateIOS.addEventListener('memoryWarning', this._handleMemoryWarning); 37 | }, 38 | componentWillUnmount: function() { 39 | AppStateIOS.removeEventListener('change', this._handleAppStateChange); 40 | AppStateIOS.removeEventListener('memoryWarning', this._handleMemoryWarning); 41 | }, 42 | _handleMemoryWarning: function() { 43 | this.setState({memoryWarnings: this.state.memoryWarnings + 1}) 44 | }, 45 | _handleAppStateChange: function(appState) { 46 | var previousAppStates = this.state.previousAppStates.slice(); 47 | previousAppStates.push(this.state.appState); 48 | this.setState({ 49 | appState, 50 | previousAppStates, 51 | }); 52 | }, 53 | render() { 54 | if (this.props.showMemoryWarnings) { 55 | return ( 56 | 57 | {this.state.memoryWarnings} 58 | 59 | ); 60 | } 61 | if (this.props.showCurrentOnly) { 62 | return ( 63 | 64 | {this.state.appState} 65 | 66 | ); 67 | } 68 | return ( 69 | 70 | {JSON.stringify(this.state.previousAppStates)} 71 | 72 | ); 73 | } 74 | }); 75 | 76 | exports.title = 'AppStateIOS'; 77 | exports.description = 'iOS app background status'; 78 | exports.examples = [ 79 | { 80 | title: 'AppStateIOS.currentState', 81 | description: 'Can be null on app initialization', 82 | render() { return {AppStateIOS.currentState}; } 83 | }, 84 | { 85 | title: 'Subscribed AppStateIOS:', 86 | description: 'This changes according to the current state, so you can only ever see it rendered as "active"', 87 | render(): ReactElement { return ; } 88 | }, 89 | { 90 | title: 'Previous states:', 91 | render(): ReactElement { return ; } 92 | }, 93 | { 94 | title: 'Memory Warnings', 95 | description: "In the simulator, hit Shift+Command+M to simulate a memory warning.", 96 | render(): ReactElement { return ; } 97 | }, 98 | ]; 99 | -------------------------------------------------------------------------------- /ActionSheetIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | ActionSheetIOS, 21 | StyleSheet, 22 | Text, 23 | View, 24 | } = React; 25 | 26 | var BUTTONS = [ 27 | 'Button Index: 0', 28 | 'Button Index: 1', 29 | 'Button Index: 2', 30 | 'Destruct', 31 | 'Cancel', 32 | ]; 33 | var DESTRUCTIVE_INDEX = 3; 34 | var CANCEL_INDEX = 4; 35 | 36 | var ActionSheetExample = React.createClass({ 37 | getInitialState() { 38 | return { 39 | clicked: 'none', 40 | }; 41 | }, 42 | 43 | render() { 44 | return ( 45 | 46 | 47 | Click to show the ActionSheet 48 | 49 | 50 | Clicked button at index: "{this.state.clicked}" 51 | 52 | 53 | ); 54 | }, 55 | 56 | showActionSheet() { 57 | ActionSheetIOS.showActionSheetWithOptions({ 58 | options: BUTTONS, 59 | cancelButtonIndex: CANCEL_INDEX, 60 | destructiveButtonIndex: DESTRUCTIVE_INDEX, 61 | }, 62 | (buttonIndex) => { 63 | this.setState({ clicked: BUTTONS[buttonIndex] }); 64 | }); 65 | } 66 | }); 67 | 68 | var ShareActionSheetExample = React.createClass({ 69 | getInitialState() { 70 | return { 71 | text: '' 72 | }; 73 | }, 74 | 75 | render() { 76 | return ( 77 | 78 | 79 | Click to show the Share ActionSheet 80 | 81 | 82 | {this.state.text} 83 | 84 | 85 | ); 86 | }, 87 | 88 | showShareActionSheet() { 89 | ActionSheetIOS.showShareActionSheetWithOptions({ 90 | url: 'https://code.facebook.com', 91 | }, 92 | (error) => { 93 | console.error(error); 94 | }, 95 | (success, method) => { 96 | var text; 97 | if (success) { 98 | text = `Shared via ${method}`; 99 | } else { 100 | text = 'You didn\'t share'; 101 | } 102 | this.setState({text}) 103 | }); 104 | } 105 | }); 106 | 107 | var style = StyleSheet.create({ 108 | button: { 109 | marginBottom: 10, 110 | fontWeight: '500', 111 | } 112 | }); 113 | 114 | exports.title = 'ActionSheetIOS'; 115 | exports.description = 'Interface to show iOS\' action sheets'; 116 | exports.examples = [ 117 | { 118 | title: 'Show Action Sheet', 119 | render(): ReactElement { return ; } 120 | }, 121 | { 122 | title: 'Show Share Action Sheet', 123 | render(): ReactElement { return ; } 124 | } 125 | ]; 126 | -------------------------------------------------------------------------------- /UIExplorer/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import "AppDelegate.h" 16 | 17 | #import "RCTBridge.h" 18 | #import "RCTJavaScriptLoader.h" 19 | #import "RCTRootView.h" 20 | 21 | @interface AppDelegate() 22 | 23 | @end 24 | 25 | @implementation AppDelegate 26 | 27 | - (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 28 | { 29 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self 30 | launchOptions:launchOptions]; 31 | 32 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 33 | moduleName:@"UIExplorerApp" 34 | initialProperties:nil]; 35 | 36 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 37 | UIViewController *rootViewController = [UIViewController new]; 38 | rootViewController.view = rootView; 39 | self.window.rootViewController = rootViewController; 40 | [self.window makeKeyAndVisible]; 41 | return YES; 42 | } 43 | 44 | - (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge 45 | { 46 | NSURL *sourceURL; 47 | 48 | /** 49 | * Loading JavaScript code - uncomment the one you want. 50 | * 51 | * OPTION 1 52 | * Load from development server. Start the server from the repository root: 53 | * 54 | * $ npm start 55 | * 56 | * To run on device, change `localhost` to the IP address of your computer 57 | * (you can get this by typing `ifconfig` into the terminal and selecting the 58 | * `inet` value under `en0:`) and make sure your computer and iOS device are 59 | * on the same Wi-Fi network. 60 | */ 61 | 62 | sourceURL = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerApp.ios.bundle?platform=ios&dev=true"]; 63 | 64 | /** 65 | * OPTION 2 66 | * Load from pre-bundled file on disk. To re-generate the static bundle, `cd` 67 | * to your Xcode project folder and run 68 | * 69 | * $ curl 'http://localhost:8081/Examples/UIExplorer/UIExplorerApp.ios.bundle' -o main.jsbundle 70 | * 71 | * then add the `main.jsbundle` file to your project and uncomment this line: 72 | */ 73 | 74 | // sourceURL = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 75 | 76 | #if RUNNING_ON_CI 77 | sourceURL = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 78 | #endif 79 | 80 | return sourceURL; 81 | } 82 | 83 | - (void)loadSourceForBridge:(RCTBridge *)bridge 84 | withBlock:(RCTSourceLoadBlock)loadCallback 85 | { 86 | [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] 87 | onComplete:loadCallback]; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /createExamplePage.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule createExamplePage 15 | * @flow 16 | */ 17 | 'use strict'; 18 | 19 | var React = require('react-native'); 20 | var { 21 | Platform, 22 | } = React; 23 | var ReactNative = require('ReactNative'); 24 | var UIExplorerBlock = require('./UIExplorerBlock'); 25 | var UIExplorerPage = require('./UIExplorerPage'); 26 | 27 | var invariant = require('invariant'); 28 | 29 | import type { Example, ExampleModule } from 'ExampleTypes'; 30 | 31 | var createExamplePage = function(title: ?string, exampleModule: ExampleModule) 32 | : ReactClass { 33 | invariant(!!exampleModule.examples, 'The module must have examples'); 34 | 35 | var ExamplePage = React.createClass({ 36 | statics: { 37 | title: exampleModule.title, 38 | description: exampleModule.description, 39 | }, 40 | 41 | getBlock: function(example: Example, i) { 42 | if (example.platform) { 43 | if (Platform.OS !== example.platform) { 44 | return; 45 | } 46 | example.title += ' (' + example.platform + ' only)'; 47 | } 48 | // Hack warning: This is a hack because the www UI explorer requires 49 | // renderComponent to be called. 50 | var originalRender = React.render; 51 | var originalRenderComponent = React.renderComponent; 52 | var originalIOSRender = ReactNative.render; 53 | var originalIOSRenderComponent = ReactNative.renderComponent; 54 | var renderedComponent; 55 | // TODO remove typecasts when Flow bug #6560135 is fixed 56 | // and workaround is removed from react-native.js 57 | (React: Object).render = 58 | (React: Object).renderComponent = 59 | (ReactNative: Object).render = 60 | (ReactNative: Object).renderComponent = 61 | function(element, container) { 62 | renderedComponent = element; 63 | }; 64 | var result = example.render(null); 65 | if (result) { 66 | renderedComponent = React.cloneElement(result, { 67 | navigator: this.props.navigator, 68 | }); 69 | } 70 | (React: Object).render = originalRender; 71 | (React: Object).renderComponent = originalRenderComponent; 72 | (ReactNative: Object).render = originalIOSRender; 73 | (ReactNative: Object).renderComponent = originalIOSRenderComponent; 74 | return ( 75 | 79 | {renderedComponent} 80 | 81 | ); 82 | }, 83 | 84 | render: function() { 85 | return ( 86 | 87 | {exampleModule.examples.map(this.getBlock)} 88 | 89 | ); 90 | } 91 | }); 92 | 93 | return ExamplePage; 94 | }; 95 | 96 | module.exports = createExamplePage; 97 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTConvert_NSURLTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import 16 | 17 | #import "RCTConvert.h" 18 | #import "RCTUtils.h" 19 | 20 | @interface RCTConvert_NSURLTests : XCTestCase 21 | 22 | @end 23 | 24 | @implementation RCTConvert_NSURLTests 25 | 26 | #define TEST_URL(name, _input, _expectedURL) \ 27 | - (void)test_##name { \ 28 | NSURL *result = [RCTConvert NSURL:_input]; \ 29 | XCTAssertEqualObjects(result.absoluteString, _expectedURL); \ 30 | } \ 31 | 32 | #define TEST_PATH(name, _input, _expectedPath) \ 33 | - (void)test_##name { \ 34 | NSURL *result = [RCTConvert NSURL:_input]; \ 35 | XCTAssertEqualObjects(result.path, _expectedPath); \ 36 | } \ 37 | 38 | #define TEST_BUNDLE_PATH(name, _input, _expectedPath) \ 39 | TEST_PATH(name, _input, [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:_expectedPath]) 40 | 41 | // Basic tests 42 | TEST_URL(basic, @"http://example.com", @"http://example.com") 43 | TEST_URL(null, (id)kCFNull, nil) 44 | 45 | // Resource files 46 | TEST_PATH(fileURL, @"file:///blah/hello.jsbundle", @"/blah/hello.jsbundle") 47 | TEST_BUNDLE_PATH(filePath, @"blah/hello.jsbundle", @"blah/hello.jsbundle") 48 | TEST_BUNDLE_PATH(filePathWithSpaces, @"blah blah/hello.jsbundle", @"blah blah/hello.jsbundle") 49 | TEST_BUNDLE_PATH(filePathWithEncodedSpaces, @"blah%20blah/hello.jsbundle", @"blah blah/hello.jsbundle") 50 | TEST_BUNDLE_PATH(imageAt2XPath, @"images/foo@2x.jpg", @"images/foo@2x.jpg") 51 | TEST_BUNDLE_PATH(imageFile, @"foo.jpg", @"foo.jpg") 52 | 53 | // User documents 54 | TEST_PATH(documentsFolder, @"~/Documents", 55 | [NSSearchPathForDirectoriesInDomains 56 | (NSDocumentDirectory, NSUserDomainMask, YES) firstObject]) 57 | 58 | // Remote files 59 | TEST_URL(fullURL, @"http://example.com/blah/hello.jsbundle", @"http://example.com/blah/hello.jsbundle") 60 | TEST_URL(urlWithSpaces, @"http://example.com/blah blah/foo", @"http://example.com/blah%20blah/foo") 61 | TEST_URL(urlWithEncodedSpaces, @"http://example.com/blah%20blah/foo", @"http://example.com/blah%20blah/foo") 62 | TEST_URL(imageURL, @"http://example.com/foo@2x.jpg", @"http://example.com/foo@2x.jpg") 63 | TEST_URL(imageURLWithSpaces, @"http://example.com/blah foo@2x.jpg", @"http://example.com/blah%20foo@2x.jpg") 64 | 65 | // Unicode 66 | TEST_URL(unicodeURL, 67 | @"https://ru.wikipedia.org/wiki/\u0417\u0430\u0433\u043B\u0430\u0432" 68 | "\u043D\u0430\u044F_\u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430", 69 | @"https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2" 70 | "%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0") 71 | 72 | // Data URLs 73 | - (void)testDataURL 74 | { 75 | NSURL *expectedURL = RCTDataURL(@"text/plain", [@"abcde" dataUsingEncoding:NSUTF8StringEncoding]); 76 | NSURL *testURL = [NSURL URLWithString:@"data:text/plain;base64,YWJjZGU="]; 77 | XCTAssertEqualObjects([testURL absoluteString], [expectedURL absoluteString]); 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /UIExplorerUnitTests/RCTImageLoaderHelpers.m: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | */ 14 | 15 | #import "RCTImageLoaderHelpers.h" 16 | 17 | @implementation RCTConcreteImageURLLoader 18 | { 19 | RCTImageURLLoaderCanLoadImageURLHandler _canLoadImageURLHandler; 20 | RCTImageURLLoaderLoadImageURLHandler _loadImageURLHandler; 21 | float _priority; 22 | } 23 | 24 | + (NSString *)moduleName 25 | { 26 | return nil; 27 | } 28 | 29 | - (instancetype)init 30 | { 31 | return nil; 32 | } 33 | 34 | - (instancetype)initWithPriority:(float)priority canLoadImageURLHandler:(RCTImageURLLoaderCanLoadImageURLHandler)canLoadImageURLHandler loadImageURLHandler:(RCTImageURLLoaderLoadImageURLHandler)loadImageURLHandler 35 | { 36 | if ((self = [super init])) { 37 | _canLoadImageURLHandler = [canLoadImageURLHandler copy]; 38 | _loadImageURLHandler = [loadImageURLHandler copy]; 39 | _priority = priority; 40 | } 41 | 42 | return self; 43 | } 44 | 45 | - (BOOL)canLoadImageURL:(NSURL *)requestURL 46 | { 47 | return _canLoadImageURLHandler(requestURL); 48 | } 49 | 50 | - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL size:(CGSize)size scale:(CGFloat)scale resizeMode:(UIViewContentMode)resizeMode progressHandler:(RCTImageLoaderProgressBlock)progressHandler completionHandler:(RCTImageLoaderCompletionBlock)completionHandler 51 | { 52 | return _loadImageURLHandler(imageURL, size, scale, resizeMode, progressHandler, completionHandler); 53 | } 54 | 55 | - (float)imageLoaderPriority 56 | { 57 | return _priority; 58 | } 59 | 60 | @end 61 | 62 | @implementation RCTConcreteImageDecoder 63 | { 64 | RCTImageDecoderCanDecodeImageDataHandler _canDecodeImageDataHandler; 65 | RCTImageDecoderDecodeImageDataHandler _decodeImageDataHandler; 66 | float _priority; 67 | } 68 | 69 | + (NSString *)moduleName 70 | { 71 | return nil; 72 | } 73 | 74 | - (instancetype)init 75 | { 76 | return nil; 77 | } 78 | 79 | - (instancetype)initWithPriority:(float)priority canDecodeImageDataHandler:(RCTImageDecoderCanDecodeImageDataHandler)canDecodeImageDataHandler decodeImageDataHandler:(RCTImageDecoderDecodeImageDataHandler)decodeImageDataHandler 80 | { 81 | if ((self = [super init])) { 82 | _canDecodeImageDataHandler = [canDecodeImageDataHandler copy]; 83 | _decodeImageDataHandler = [decodeImageDataHandler copy]; 84 | _priority = priority; 85 | } 86 | 87 | return self; 88 | } 89 | 90 | - (BOOL)canDecodeImageData:(NSData *)imageData 91 | { 92 | return _canDecodeImageDataHandler(imageData); 93 | } 94 | 95 | - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData size:(CGSize)size scale:(CGFloat)scale resizeMode:(UIViewContentMode)resizeMode completionHandler:(RCTImageLoaderCompletionBlock)completionHandler 96 | { 97 | return _decodeImageDataHandler(imageData, size, scale, resizeMode, completionHandler); 98 | } 99 | 100 | - (float)imageDecoderPriority 101 | { 102 | return _priority; 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /UIExplorer/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ios/UIExplorerApp/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /AsyncStorageExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | AsyncStorage, 21 | PickerIOS, 22 | Text, 23 | View 24 | } = React; 25 | var PickerItemIOS = PickerIOS.Item; 26 | 27 | var STORAGE_KEY = '@AsyncStorageExample:key'; 28 | var COLORS = ['red', 'orange', 'yellow', 'green', 'blue']; 29 | 30 | var BasicStorageExample = React.createClass({ 31 | componentDidMount() { 32 | this._loadInitialState().done(); 33 | }, 34 | 35 | async _loadInitialState() { 36 | try { 37 | var value = await AsyncStorage.getItem(STORAGE_KEY); 38 | if (value !== null){ 39 | this.setState({selectedValue: value}); 40 | this._appendMessage('Recovered selection from disk: ' + value); 41 | } else { 42 | this._appendMessage('Initialized with no selection on disk.'); 43 | } 44 | } catch (error) { 45 | this._appendMessage('AsyncStorage error: ' + error.message); 46 | } 47 | }, 48 | 49 | getInitialState() { 50 | return { 51 | selectedValue: COLORS[0], 52 | messages: [], 53 | }; 54 | }, 55 | 56 | render() { 57 | var color = this.state.selectedValue; 58 | return ( 59 | 60 | 63 | {COLORS.map((value) => ( 64 | 69 | ))} 70 | 71 | 72 | {'Selected: '} 73 | 74 | {this.state.selectedValue} 75 | 76 | 77 | {' '} 78 | 79 | Press here to remove from storage. 80 | 81 | {' '} 82 | Messages: 83 | {this.state.messages.map((m) => {m})} 84 | 85 | ); 86 | }, 87 | 88 | async _onValueChange(selectedValue) { 89 | this.setState({selectedValue}); 90 | try { 91 | await AsyncStorage.setItem(STORAGE_KEY, selectedValue); 92 | this._appendMessage('Saved selection to disk: ' + selectedValue); 93 | } catch (error) { 94 | this._appendMessage('AsyncStorage error: ' + error.message); 95 | } 96 | }, 97 | 98 | async _removeStorage() { 99 | try { 100 | await AsyncStorage.removeItem(STORAGE_KEY); 101 | this._appendMessage('Selection removed from disk.'); 102 | } catch (error) { 103 | this._appendMessage('AsyncStorage error: ' + error.message); 104 | } 105 | }, 106 | 107 | _appendMessage(message) { 108 | this.setState({messages: this.state.messages.concat(message)}); 109 | }, 110 | }); 111 | 112 | exports.title = 'AsyncStorage'; 113 | exports.description = 'Asynchronous local disk storage.'; 114 | exports.examples = [ 115 | { 116 | title: 'Basics - getItem, setItem, removeItem', 117 | render(): ReactElement { return ; } 118 | }, 119 | ]; 120 | -------------------------------------------------------------------------------- /StatusBarIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | StyleSheet, 21 | View, 22 | Text, 23 | TouchableHighlight, 24 | StatusBarIOS, 25 | } = React; 26 | 27 | exports.framework = 'React'; 28 | exports.title = 'StatusBarIOS'; 29 | exports.description = 'Module for controlling iOS status bar'; 30 | exports.examples = [{ 31 | title: 'Status Bar Style', 32 | render() { 33 | return ( 34 | 35 | {['default', 'light-content'].map((style) => 36 | StatusBarIOS.setStyle(style)}> 38 | 39 | setStyle('{style}') 40 | 41 | 42 | )} 43 | 44 | ); 45 | }, 46 | }, { 47 | title: 'Status Bar Style Animated', 48 | render() { 49 | return ( 50 | 51 | {['default', 'light-content'].map((style) => 52 | StatusBarIOS.setStyle(style, true)}> 54 | 55 | setStyle('{style}', true) 56 | 57 | 58 | )} 59 | 60 | ); 61 | }, 62 | }, { 63 | title: 'Status Bar Hidden', 64 | render() { 65 | return ( 66 | 67 | {['none', 'fade', 'slide'].map((animation) => 68 | 69 | StatusBarIOS.setHidden(true, animation)}> 71 | 72 | setHidden(true, '{animation}') 73 | 74 | 75 | StatusBarIOS.setHidden(false, animation)}> 77 | 78 | setHidden(false, '{animation}') 79 | 80 | 81 | 82 | )} 83 | 84 | ); 85 | }, 86 | }, { 87 | title: 'Status Bar Network Activity Indicator', 88 | render() { 89 | return ( 90 | 91 | StatusBarIOS.setNetworkActivityIndicatorVisible(true)}> 93 | 94 | setNetworkActivityIndicatorVisible(true) 95 | 96 | 97 | StatusBarIOS.setNetworkActivityIndicatorVisible(false)}> 99 | 100 | setNetworkActivityIndicatorVisible(false) 101 | 102 | 103 | 104 | ); 105 | }, 106 | }]; 107 | 108 | var styles = StyleSheet.create({ 109 | wrapper: { 110 | borderRadius: 5, 111 | marginBottom: 5, 112 | }, 113 | button: { 114 | backgroundColor: '#eeeeee', 115 | padding: 10, 116 | }, 117 | }); 118 | -------------------------------------------------------------------------------- /AnimatedGratuitousApp/AnExScroll.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @providesModule AnExScroll 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | Animated, 21 | Image, 22 | ScrollView, 23 | StyleSheet, 24 | Text, 25 | View, 26 | } = React; 27 | 28 | class AnExScroll extends React.Component { 29 | constructor(props) { 30 | super(props); 31 | this.state = { 32 | scrollX: new Animated.Value(0), 33 | }; 34 | } 35 | 36 | render() { 37 | var width = this.props.panelWidth; 38 | return ( 39 | 40 | 49 | 50 | 54 | 55 | {'I\'ll find something to put here.'} 56 | 57 | 58 | 59 | {'And here.'} 60 | 61 | 62 | {'But not here.'} 63 | 64 | 65 | 83 | 84 | ); 85 | } 86 | } 87 | 88 | var styles = StyleSheet.create({ 89 | container: { 90 | backgroundColor: 'transparent', 91 | flex: 1, 92 | }, 93 | text: { 94 | padding: 4, 95 | paddingBottom: 10, 96 | fontWeight: 'bold', 97 | fontSize: 18, 98 | backgroundColor: 'transparent', 99 | }, 100 | bunny: { 101 | backgroundColor: 'transparent', 102 | position: 'absolute', 103 | height: 160, 104 | width: 160, 105 | }, 106 | page: { 107 | alignItems: 'center', 108 | justifyContent: 'flex-end', 109 | }, 110 | }); 111 | 112 | var HAWK_PIC = {uri: 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xfa1/t39.1997-6/10734304_1562225620659674_837511701_n.png'}; 113 | var BUNNY_PIC = {uri: 'https://scontent-sea1-1.xx.fbcdn.net/hphotos-xaf1/t39.1997-6/851564_531111380292237_1898871086_n.png'}; 114 | 115 | module.exports = AnExScroll; 116 | -------------------------------------------------------------------------------- /PickerIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | PickerIOS, 21 | Text, 22 | View, 23 | } = React; 24 | 25 | var PickerItemIOS = PickerIOS.Item; 26 | 27 | var CAR_MAKES_AND_MODELS = { 28 | amc: { 29 | name: 'AMC', 30 | models: ['AMX', 'Concord', 'Eagle', 'Gremlin', 'Matador', 'Pacer'], 31 | }, 32 | alfa: { 33 | name: 'Alfa-Romeo', 34 | models: ['159', '4C', 'Alfasud', 'Brera', 'GTV6', 'Giulia', 'MiTo', 'Spider'], 35 | }, 36 | aston: { 37 | name: 'Aston Martin', 38 | models: ['DB5', 'DB9', 'DBS', 'Rapide', 'Vanquish', 'Vantage'], 39 | }, 40 | audi: { 41 | name: 'Audi', 42 | models: ['90', '4000', '5000', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'Q5', 'Q7'], 43 | }, 44 | austin: { 45 | name: 'Austin', 46 | models: ['America', 'Maestro', 'Maxi', 'Mini', 'Montego', 'Princess'], 47 | }, 48 | borgward: { 49 | name: 'Borgward', 50 | models: ['Hansa', 'Isabella', 'P100'], 51 | }, 52 | buick: { 53 | name: 'Buick', 54 | models: ['Electra', 'LaCrosse', 'LeSabre', 'Park Avenue', 'Regal', 55 | 'Roadmaster', 'Skylark'], 56 | }, 57 | cadillac: { 58 | name: 'Cadillac', 59 | models: ['Catera', 'Cimarron', 'Eldorado', 'Fleetwood', 'Sedan de Ville'], 60 | }, 61 | chevrolet: { 62 | name: 'Chevrolet', 63 | models: ['Astro', 'Aveo', 'Bel Air', 'Captiva', 'Cavalier', 'Chevelle', 64 | 'Corvair', 'Corvette', 'Cruze', 'Nova', 'SS', 'Vega', 'Volt'], 65 | }, 66 | }; 67 | 68 | var PickerExample = React.createClass({ 69 | getInitialState: function() { 70 | return { 71 | carMake: 'cadillac', 72 | modelIndex: 3, 73 | }; 74 | }, 75 | 76 | render: function() { 77 | var make = CAR_MAKES_AND_MODELS[this.state.carMake]; 78 | var selectionString = make.name + ' ' + make.models[this.state.modelIndex]; 79 | return ( 80 | 81 | Please choose a make for your car: 82 | this.setState({carMake, modelIndex: 0})}> 85 | {Object.keys(CAR_MAKES_AND_MODELS).map((carMake) => ( 86 | 91 | ) 92 | )} 93 | 94 | Please choose a model of {make.name}: 95 | this.setState({modelIndex})}> 99 | {CAR_MAKES_AND_MODELS[this.state.carMake].models.map( 100 | (modelName, modelIndex) => ( 101 | 106 | )) 107 | } 108 | 109 | You selected: {selectionString} 110 | 111 | ); 112 | }, 113 | }); 114 | 115 | exports.displayName = (undefined: ?string); 116 | exports.title = ''; 117 | exports.description = 'Render lists of selectable options with UIPickerView.'; 118 | exports.examples = [ 119 | { 120 | title: '', 121 | render: function(): ReactElement { 122 | return ; 123 | }, 124 | }]; 125 | -------------------------------------------------------------------------------- /NetInfoExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | NetInfo, 21 | Text, 22 | View 23 | } = React; 24 | 25 | var ReachabilitySubscription = React.createClass({ 26 | getInitialState() { 27 | return { 28 | reachabilityHistory: [], 29 | }; 30 | }, 31 | componentDidMount: function() { 32 | NetInfo.addEventListener( 33 | 'change', 34 | this._handleReachabilityChange 35 | ); 36 | }, 37 | componentWillUnmount: function() { 38 | NetInfo.removeEventListener( 39 | 'change', 40 | this._handleReachabilityChange 41 | ); 42 | }, 43 | _handleReachabilityChange: function(reachability) { 44 | var reachabilityHistory = this.state.reachabilityHistory.slice(); 45 | reachabilityHistory.push(reachability); 46 | this.setState({ 47 | reachabilityHistory, 48 | }); 49 | }, 50 | render() { 51 | return ( 52 | 53 | {JSON.stringify(this.state.reachabilityHistory)} 54 | 55 | ); 56 | } 57 | }); 58 | 59 | var ReachabilityCurrent = React.createClass({ 60 | getInitialState() { 61 | return { 62 | reachability: null, 63 | }; 64 | }, 65 | componentDidMount: function() { 66 | NetInfo.addEventListener( 67 | 'change', 68 | this._handleReachabilityChange 69 | ); 70 | NetInfo.fetch().done( 71 | (reachability) => { this.setState({reachability}); } 72 | ); 73 | }, 74 | componentWillUnmount: function() { 75 | NetInfo.removeEventListener( 76 | 'change', 77 | this._handleReachabilityChange 78 | ); 79 | }, 80 | _handleReachabilityChange: function(reachability) { 81 | this.setState({ 82 | reachability, 83 | }); 84 | }, 85 | render() { 86 | return ( 87 | 88 | {this.state.reachability} 89 | 90 | ); 91 | } 92 | }); 93 | 94 | var IsConnected = React.createClass({ 95 | getInitialState() { 96 | return { 97 | isConnected: null, 98 | }; 99 | }, 100 | componentDidMount: function() { 101 | NetInfo.isConnected.addEventListener( 102 | 'change', 103 | this._handleConnectivityChange 104 | ); 105 | NetInfo.isConnected.fetch().done( 106 | (isConnected) => { this.setState({isConnected}); } 107 | ); 108 | }, 109 | componentWillUnmount: function() { 110 | NetInfo.isConnected.removeEventListener( 111 | 'change', 112 | this._handleConnectivityChange 113 | ); 114 | }, 115 | _handleConnectivityChange: function(isConnected) { 116 | this.setState({ 117 | isConnected, 118 | }); 119 | }, 120 | render() { 121 | return ( 122 | 123 | {this.state.isConnected ? 'Online' : 'Offline'} 124 | 125 | ); 126 | } 127 | }); 128 | 129 | exports.title = 'NetInfo'; 130 | exports.description = 'Monitor network status'; 131 | exports.examples = [ 132 | { 133 | title: 'NetInfo.isConnected', 134 | description: 'Asynchronously load and observe connectivity', 135 | render(): ReactElement { return ; } 136 | }, 137 | { 138 | title: 'NetInfo.reachabilityIOS', 139 | description: 'Asynchronously load and observe iOS reachability', 140 | render(): ReactElement { return ; } 141 | }, 142 | { 143 | title: 'NetInfo.reachabilityIOS', 144 | description: 'Observed updates to iOS reachability', 145 | render(): ReactElement { return ; } 146 | }, 147 | ]; 148 | -------------------------------------------------------------------------------- /CameraRollExample.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | CameraRoll, 21 | Image, 22 | SliderIOS, 23 | StyleSheet, 24 | SwitchIOS, 25 | Text, 26 | View, 27 | TouchableOpacity 28 | } = React; 29 | 30 | var CameraRollView = require('./CameraRollView.ios'); 31 | var AssetScaledImageExampleView = require('./AssetScaledImageExample'); 32 | 33 | var CAMERA_ROLL_VIEW = 'camera_roll_view'; 34 | 35 | var CameraRollExample = React.createClass({ 36 | 37 | getInitialState() { 38 | return { 39 | groupTypes: 'SavedPhotos', 40 | sliderValue: 1, 41 | bigImages: true, 42 | }; 43 | }, 44 | 45 | render() { 46 | return ( 47 | 48 | 51 | {(this.state.bigImages ? 'Big' : 'Small') + ' Images'} 52 | 56 | {'Group Type: ' + this.state.groupTypes} 57 | 63 | 64 | ); 65 | }, 66 | 67 | loadAsset(asset){ 68 | this.props.navigator.push({ 69 | title: 'Camera Roll Image', 70 | component: AssetScaledImageExampleView, 71 | backButtonTitle: 'Back', 72 | passProps: { asset: asset }, 73 | }); 74 | }, 75 | 76 | _renderImage(asset) { 77 | var imageSize = this.state.bigImages ? 150 : 75; 78 | var imageStyle = [styles.image, {width: imageSize, height: imageSize}]; 79 | var location = asset.node.location.longitude ? 80 | JSON.stringify(asset.node.location) : 'Unknown location'; 81 | return ( 82 | 83 | 84 | 88 | 89 | {asset.node.image.uri} 90 | {location} 91 | {asset.node.group_name} 92 | {new Date(asset.node.timestamp).toString()} 93 | 94 | 95 | 96 | ); 97 | }, 98 | 99 | _onSliderChange(value) { 100 | var options = CameraRoll.GroupTypesOptions; 101 | var index = Math.floor(value * options.length * 0.99); 102 | var groupTypes = options[index]; 103 | if (groupTypes !== this.state.groupTypes) { 104 | this.setState({groupTypes: groupTypes}); 105 | } 106 | }, 107 | 108 | _onSwitchChange(value) { 109 | this.refs[CAMERA_ROLL_VIEW].rendererChanged(); 110 | this.setState({ bigImages: value }); 111 | } 112 | }); 113 | 114 | var styles = StyleSheet.create({ 115 | row: { 116 | flexDirection: 'row', 117 | flex: 1, 118 | }, 119 | url: { 120 | fontSize: 9, 121 | marginBottom: 14, 122 | }, 123 | image: { 124 | margin: 4, 125 | }, 126 | info: { 127 | flex: 1, 128 | }, 129 | }); 130 | 131 | exports.title = 'Camera Roll'; 132 | exports.description = 'Example component that uses CameraRoll to list user\'s photos'; 133 | exports.examples = [ 134 | { 135 | title: 'Photos', 136 | render(): ReactElement { return ; } 137 | } 138 | ]; 139 | -------------------------------------------------------------------------------- /ResponderExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | StyleSheet, 21 | PanResponder, 22 | View, 23 | } = React; 24 | 25 | var CIRCLE_SIZE = 80; 26 | var CIRCLE_COLOR = 'blue'; 27 | var CIRCLE_HIGHLIGHT_COLOR = 'green'; 28 | 29 | 30 | var NavigatorIOSExample = React.createClass({ 31 | 32 | statics: { 33 | title: 'PanResponder Sample', 34 | description: 'Basic gesture handling example', 35 | }, 36 | 37 | _panResponder: {}, 38 | _previousLeft: 0, 39 | _previousTop: 0, 40 | _circleStyles: {}, 41 | circle: (null : ?{ setNativeProps(props: Object): void }), 42 | 43 | componentWillMount: function() { 44 | this._panResponder = PanResponder.create({ 45 | onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, 46 | onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder, 47 | onPanResponderGrant: this._handlePanResponderGrant, 48 | onPanResponderMove: this._handlePanResponderMove, 49 | onPanResponderRelease: this._handlePanResponderEnd, 50 | onPanResponderTerminate: this._handlePanResponderEnd, 51 | }); 52 | this._previousLeft = 20; 53 | this._previousTop = 84; 54 | this._circleStyles = { 55 | left: this._previousLeft, 56 | top: this._previousTop, 57 | }; 58 | }, 59 | 60 | componentDidMount: function() { 61 | this._updatePosition(); 62 | }, 63 | 64 | render: function() { 65 | return ( 66 | 68 | { 70 | this.circle = circle; 71 | }} 72 | style={styles.circle} 73 | {...this._panResponder.panHandlers} 74 | /> 75 | 76 | ); 77 | }, 78 | 79 | _highlight: function() { 80 | this.circle && this.circle.setNativeProps({ 81 | backgroundColor: CIRCLE_HIGHLIGHT_COLOR 82 | }); 83 | }, 84 | 85 | _unHighlight: function() { 86 | this.circle && this.circle.setNativeProps({ 87 | backgroundColor: CIRCLE_COLOR 88 | }); 89 | }, 90 | 91 | _updatePosition: function() { 92 | this.circle && this.circle.setNativeProps(this._circleStyles); 93 | }, 94 | 95 | _handleStartShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { 96 | // Should we become active when the user presses down on the circle? 97 | return true; 98 | }, 99 | 100 | _handleMoveShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { 101 | // Should we become active when the user moves a touch over the circle? 102 | return true; 103 | }, 104 | 105 | _handlePanResponderGrant: function(e: Object, gestureState: Object) { 106 | this._highlight(); 107 | }, 108 | _handlePanResponderMove: function(e: Object, gestureState: Object) { 109 | this._circleStyles.left = this._previousLeft + gestureState.dx; 110 | this._circleStyles.top = this._previousTop + gestureState.dy; 111 | this._updatePosition(); 112 | }, 113 | _handlePanResponderEnd: function(e: Object, gestureState: Object) { 114 | this._unHighlight(); 115 | this._previousLeft += gestureState.dx; 116 | this._previousTop += gestureState.dy; 117 | }, 118 | }); 119 | 120 | var styles = StyleSheet.create({ 121 | circle: { 122 | width: CIRCLE_SIZE, 123 | height: CIRCLE_SIZE, 124 | borderRadius: CIRCLE_SIZE / 2, 125 | backgroundColor: CIRCLE_COLOR, 126 | position: 'absolute', 127 | left: 0, 128 | top: 0, 129 | }, 130 | container: { 131 | flex: 1, 132 | paddingTop: 64, 133 | }, 134 | }); 135 | 136 | module.exports = NavigatorIOSExample; 137 | -------------------------------------------------------------------------------- /PushNotificationIOSExample.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The examples provided by Facebook are for non-commercial testing and 3 | * evaluation purposes only. 4 | * 5 | * Facebook reserves all rights not expressly granted. 6 | * 7 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 8 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL 10 | * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 11 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 12 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13 | * 14 | * @flow 15 | */ 16 | 'use strict'; 17 | 18 | var React = require('react-native'); 19 | var { 20 | AlertIOS, 21 | PushNotificationIOS, 22 | StyleSheet, 23 | Text, 24 | TouchableHighlight, 25 | View, 26 | } = React; 27 | 28 | var Button = React.createClass({ 29 | render: function() { 30 | return ( 31 | 35 | 36 | {this.props.label} 37 | 38 | 39 | ); 40 | } 41 | }); 42 | 43 | class NotificationExample extends React.Component { 44 | componentWillMount() { 45 | PushNotificationIOS.addEventListener('notification', this._onNotification); 46 | } 47 | 48 | componentWillUnmount() { 49 | PushNotificationIOS.removeEventListener('notification', this._onNotification); 50 | } 51 | 52 | render() { 53 | return ( 54 | 55 |