diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle index b5ee9b1..d4b40c8 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle @@ -127,6 +127,7 @@ android { dependencies { compile fileTree(dir: "libs", include: ["*.jar"]) + compile project(':@react-native-community_cameraroll') compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules } diff --git a/Example/android/app/src/main/java/com/example/MainApplication.java b/Example/android/app/src/main/java/com/example/MainApplication.java index 86706c4..29b1134 100644 --- a/Example/android/app/src/main/java/com/example/MainApplication.java +++ b/Example/android/app/src/main/java/com/example/MainApplication.java @@ -8,6 +8,7 @@ import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; +import com.reactnativecommunity.cameraroll.CameraRollPackage; import java.util.Arrays; import java.util.List; @@ -23,7 +24,8 @@ public boolean getUseDeveloperSupport() { @Override protected List getPackages() { return Arrays.asList( - new MainReactPackage() + new MainReactPackage(), + new CameraRollPackage() ); } }; diff --git a/Example/android/settings.gradle b/Example/android/settings.gradle index 54b22e1..a438824 100644 --- a/Example/android/settings.gradle +++ b/Example/android/settings.gradle @@ -1,3 +1,4 @@ rootProject.name = 'Example' - +include ':@react-native-community_cameraroll' +project(':@react-native-community_cameraroll').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cameraroll/android') include ':app' diff --git a/Example/ios/Example.xcodeproj/project.pbxproj b/Example/ios/Example.xcodeproj/project.pbxproj index 79a0f61..2913b7f 100644 --- a/Example/ios/Example.xcodeproj/project.pbxproj +++ b/Example/ios/Example.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 45116D7322CC1CFF005D8D4F /* libRNCCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 45116D7122CC1CEF005D8D4F /* libRNCCameraRoll.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; BC6A3A6D1DBDFA0C007AFF2A /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BC6A3A631DBDFA04007AFF2A /* libRCTCameraRoll.a */; }; /* End PBXBuildFile section */ @@ -90,6 +91,13 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; + 45116DD922CC204D005D8D4F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 45116D2E22CC1CEF005D8D4F /* RNCCameraRoll.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 58B5115D1A9E6B3D00147676; + remoteInfo = RNCCameraRoll; + }; 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; @@ -133,6 +141,7 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; + 45116D2E22CC1CEF005D8D4F /* RNCCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCCameraRoll.xcodeproj; path = "../node_modules/@react-native-community/cameraroll/ios/RNCCameraRoll.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 = ""; }; BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTCameraRoll.xcodeproj; path = "../node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj"; sourceTree = ""; }; @@ -151,6 +160,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 45116D7322CC1CFF005D8D4F /* libRNCCameraRoll.a in Frameworks */, BC6A3A6D1DBDFA0C007AFF2A /* libRCTCameraRoll.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, @@ -274,6 +284,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 45116D2E22CC1CEF005D8D4F /* RNCCameraRoll.xcodeproj */, BC6A3A5D1DBDFA04007AFF2A /* RCTCameraRoll.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, @@ -502,6 +513,13 @@ remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 45116DDA22CC204D005D8D4F /* libRNCCameraRoll.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNCCameraRoll.a; + remoteRef = 45116DD922CC204D005D8D4F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/ImageItem.js b/ImageItem.js index cfc3e73..63dd2d5 100644 --- a/ImageItem.js +++ b/ImageItem.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { PureComponent } from 'react'; import { Image, StyleSheet, @@ -18,7 +18,7 @@ const styles = StyleSheet.create({ }, }); -class ImageItem extends Component { +class ImageItem extends PureComponent { componentWillMount() { let { width } = Dimensions.get('window'); const { imageMargin, imagesPerRow, containerWidth } = this.props; diff --git a/README.md b/README.md index 274dc44..70daf2a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Requires `react-native >=0.43.0` ## Add to Project * Make sure node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj has been imported to project libraries by following the [libraries linking instructions](https://facebook.github.io/react-native/docs/linking-libraries-ios.html). Don't forget to link the `libRCTCamera.a` into `Link Binary with Binaries` on your target's Build Phases. +* Make sure to follow react-native-cameraroll [linking instructions](https://github.com/react-native-community/react-native-cameraroll). Mostly automatic installation would use: +`$ react-native link @react-native-community/cameraroll` * Install component through npm ``` $ npm install react-native-camera-roll-picker --save diff --git a/index.js b/index.js index bd3337c..71a8035 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; +import CameraRoll from "@react-native-community/cameraroll"; import { - CameraRoll, Platform, StyleSheet, View, diff --git a/package.json b/package.json index 1019e91..f5b6510 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "url": "https://github.com/jeanpan/react-native-camera-roll-picker/issues" }, "dependencies": { + "@react-native-community/cameraroll": "^1.1.1", "prop-types": "^15.6.0" }, "homepage": "https://github.com/jeanpan/react-native-camera-roll-picker#readme",