From 94e3279b3ab4bb955ef92d75c0061884eb34f709 Mon Sep 17 00:00:00 2001 From: jeanpan Date: Mon, 24 Oct 2016 16:37:27 +0800 Subject: [PATCH] update Example with v1.1.9 --- Example/.babelrc | 3 ++ Example/.flowconfig | 25 ++++++++++--- Example/__tests__/index.android.js | 12 +++++++ Example/__tests__/index.ios.js | 12 +++++++ Example/android/app/BUCK | 2 +- Example/index.android.js | 3 +- Example/index.ios.js | 6 ++-- Example/ios/Example.xcodeproj/project.pbxproj | 36 ++++++++++--------- Example/ios/Example/AppDelegate.m | 1 - Example/ios/Example/Info.plist | 3 +- Example/package.json | 19 +++++++--- package.json | 2 +- 12 files changed, 92 insertions(+), 32 deletions(-) create mode 100644 Example/.babelrc create mode 100644 Example/__tests__/index.android.js create mode 100644 Example/__tests__/index.ios.js diff --git a/Example/.babelrc b/Example/.babelrc new file mode 100644 index 0000000..8df53fe --- /dev/null +++ b/Example/.babelrc @@ -0,0 +1,3 @@ +{ +"presets": ["react-native"] +} \ No newline at end of file diff --git a/Example/.flowconfig b/Example/.flowconfig index e28e2f5..f565799 100644 --- a/Example/.flowconfig +++ b/Example/.flowconfig @@ -1,7 +1,7 @@ [ignore] # We fork some components by platform. -.*/*.android.js +.*/*[.]android.js # Ignore templates with `@flow` in header .*/local-cli/generator.* @@ -9,6 +9,21 @@ # Ignore malformed json .*/node_modules/y18n/test/.*\.json +# Ignore the website subdir +/website/.* + +# Ignore BUCK generated dirs +/\.buckd/ + +# Ignore unexpected extra @providesModule +.*/node_modules/commoner/test/source/widget/share.js + +# Ignore duplicate module providers +# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js +.*/node_modules/jest-runtime/build/__tests__/.* + [include] [libs] @@ -33,9 +48,11 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +unsafe.enable_getters_and_setters=true + [version] -^0.27.0 +^0.32.0 diff --git a/Example/__tests__/index.android.js b/Example/__tests__/index.android.js new file mode 100644 index 0000000..b49b908 --- /dev/null +++ b/Example/__tests__/index.android.js @@ -0,0 +1,12 @@ +import 'react-native'; +import React from 'react'; +import Index from '../index.android.js'; + +// Note: test renderer must be required after react-native. +import renderer from 'react-test-renderer'; + +it('renders correctly', () => { + const tree = renderer.create( + + ); +}); diff --git a/Example/__tests__/index.ios.js b/Example/__tests__/index.ios.js new file mode 100644 index 0000000..ba7c5b5 --- /dev/null +++ b/Example/__tests__/index.ios.js @@ -0,0 +1,12 @@ +import 'react-native'; +import React from 'react'; +import Index from '../index.ios.js'; + +// Note: test renderer must be required after react-native. +import renderer from 'react-test-renderer'; + +it('renders correctly', () => { + const tree = renderer.create( + + ); +}); diff --git a/Example/android/app/BUCK b/Example/android/app/BUCK index d73aebd..2ebdb98 100644 --- a/Example/android/app/BUCK +++ b/Example/android/app/BUCK @@ -5,7 +5,7 @@ import re # - install Buck # - `npm start` - to start the packager # - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck # - `buck install -r android/app` - compile, install and run application # diff --git a/Example/index.android.js b/Example/index.android.js index 7939a76..34a7b96 100644 --- a/Example/index.android.js +++ b/Example/index.android.js @@ -12,7 +12,7 @@ import { View } from 'react-native'; -class Example extends Component { +export default class Example extends Component { render() { return ( @@ -23,6 +23,7 @@ class Example extends Component { To get started, edit index.android.js + Double tap R on your keyboard to reload,{'\n'} Shake or press menu button for dev menu diff --git a/Example/index.ios.js b/Example/index.ios.js index e67ac7b..7f2979f 100644 --- a/Example/index.ios.js +++ b/Example/index.ios.js @@ -14,7 +14,7 @@ import { import CameraRollPicker from 'react-native-camera-roll-picker'; -class Example extends Component { +export default class Example extends Component { constructor(props) { super(props); @@ -48,10 +48,10 @@ class Example extends Component { scrollRenderAheadDistance={500} initialListSize={1} pageSize={3} - removeClippedSubviews={true} + removeClippedSubviews={false} groupTypes='SavedPhotos' batchSize={5} - maximum={5} + maximum={3} selected={this.state.selected} assetType='Photos' imagesPerRow={3} diff --git a/Example/ios/Example.xcodeproj/project.pbxproj b/Example/ios/Example.xcodeproj/project.pbxproj index 11443fb..79a0f61 100644 --- a/Example/ios/Example.xcodeproj/project.pbxproj +++ b/Example/ios/Example.xcodeproj/project.pbxproj @@ -23,7 +23,7 @@ 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - BC334C061D38D79200B3C48C /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BC334BFC1D38D78400B3C48C /* libRCTCameraRoll.a */; }; + BC6A3A6D1DBDFA0C007AFF2A /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BC6A3A631DBDFA04007AFF2A /* libRCTCameraRoll.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -104,9 +104,9 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; - BC334BFB1D38D78400B3C48C /* PBXContainerItemProxy */ = { + BC6A3A621DBDFA04007AFF2A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = BC334BF61D38D78400B3C48C /* RCTCameraRoll.xcodeproj */; + containerPortal = BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */; proxyType = 2; remoteGlobalIDString = 58B5115D1A9E6B3D00147676; remoteInfo = RCTCameraRoll; @@ -135,7 +135,7 @@ 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; - BC334BF61D38D78400B3C48C /* RCTCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTCameraRoll.xcodeproj; path = "../node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj"; sourceTree = ""; }; + BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTCameraRoll.xcodeproj; path = "../node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -151,7 +151,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - BC334C061D38D79200B3C48C /* libRCTCameraRoll.a in Frameworks */, + BC6A3A6D1DBDFA0C007AFF2A /* libRCTCameraRoll.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, @@ -274,7 +274,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( - BC334BF61D38D78400B3C48C /* RCTCameraRoll.xcodeproj */, + BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, @@ -318,10 +318,10 @@ name = Products; sourceTree = ""; }; - BC334BF71D38D78400B3C48C /* Products */ = { + BC6A3A5E1DBDFA04007AFF2A /* Products */ = { isa = PBXGroup; children = ( - BC334BFC1D38D78400B3C48C /* libRCTCameraRoll.a */, + BC6A3A631DBDFA04007AFF2A /* libRCTCameraRoll.a */, ); name = Products; sourceTree = ""; @@ -397,8 +397,8 @@ ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; }, { - ProductGroup = BC334BF71D38D78400B3C48C /* Products */; - ProjectRef = BC334BF61D38D78400B3C48C /* RCTCameraRoll.xcodeproj */; + ProductGroup = BC6A3A5E1DBDFA04007AFF2A /* Products */; + ProjectRef = BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */; }, { ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; @@ -516,11 +516,11 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - BC334BFC1D38D78400B3C48C /* libRCTCameraRoll.a */ = { + BC6A3A631DBDFA04007AFF2A /* libRCTCameraRoll.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libRCTCameraRoll.a; - remoteRef = BC334BFB1D38D78400B3C48C /* PBXContainerItemProxy */; + remoteRef = BC6A3A621DBDFA04007AFF2A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ @@ -611,7 +611,7 @@ "$(inherited)", ); INFOPLIST_FILE = ExampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; @@ -624,7 +624,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; INFOPLIST_FILE = ExampleTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; @@ -635,6 +635,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -649,6 +650,7 @@ "-lc++", ); PRODUCT_NAME = Example; + VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; @@ -656,6 +658,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, @@ -669,6 +672,7 @@ "-lc++", ); PRODUCT_NAME = Example; + VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; @@ -711,7 +715,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -751,7 +755,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/Example/ios/Example/AppDelegate.m b/Example/ios/Example/AppDelegate.m index a5de649..9e648fd 100644 --- a/Example/ios/Example/AppDelegate.m +++ b/Example/ios/Example/AppDelegate.m @@ -18,7 +18,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( { NSURL *jsCodeLocation; - [[RCTBundleURLProvider sharedSettings] setDefaults]; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation diff --git a/Example/ios/Example/Info.plist b/Example/ios/Example/Info.plist index e98ebb0..30bd564 100644 --- a/Example/ios/Example/Info.plist +++ b/Example/ios/Example/Info.plist @@ -39,7 +39,6 @@ NSLocationWhenInUseUsageDescription NSAppTransportSecurity - NSExceptionDomains @@ -50,5 +49,7 @@ + NSPhotoLibraryUsageDescription + This app attempts to access your camera data. diff --git a/Example/package.json b/Example/package.json index 3243643..c228142 100644 --- a/Example/package.json +++ b/Example/package.json @@ -3,11 +3,22 @@ "version": "0.0.1", "private": true, "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start" + "start": "node node_modules/react-native/local-cli/cli.js start", + "test": "jest" }, "dependencies": { - "react": "15.2.1", - "react-native": "^0.29.1", - "react-native-camera-roll-picker": "^1.1.6" + "react": "15.3.2", + "react-native": "^0.35.0", + "react-native-camera-roll-picker": "^1.1.9" + }, + "jest": { + "preset": "jest-react-native" + }, + "devDependencies": { + "babel-jest": "16.0.0", + "babel-preset-react-native": "1.9.0", + "jest": "16.0.2", + "jest-react-native": "16.0.0", + "react-test-renderer": "15.3.2" } } diff --git a/package.json b/package.json index 906d696..3eb93ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-camera-roll-picker", - "version": "1.1.8", + "version": "1.1.9", "description": "", "main": "index.js", "scripts": {