Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-image-picker

Package Overview
Dependencies
Maintainers
2
Versions
212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-image-picker - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

Android/build.gradle

2

package.json

@@ -7,3 +7,3 @@ {

},
"version": "0.9.0",
"version": "0.10.0",
"description": "A React Native module that allows you to use the native UIImagePickerController UI to select a photo from the device library or directly from the camera.",

@@ -10,0 +10,0 @@ "author": "Marc Shilling (marcshilling)",

# react-native-image-picker
A React Native module that allows you to use the native UIImagePickerController UI to either select a photo from the device library or directly from the camera, like so:
![Screenshot of the UIActionSheet](https://github.com/marcshilling/react-native-image-picker/blob/master/AlertSheetImage.jpg)
**Requires iOS 8 or higher**
### iOS
** Requires iOS 8 or higher
<img title="IOS" src="https://github.com/marcshilling/react-native-image-picker/blob/master/AlertSheetImage.jpg" width="50%">
### Android
** Requires Api 11 or higher for Android
<img title="Android" src="http://i.imgur.com/jMOLd6w.png" width="49%">
## Install
### iOS
1. `npm install react-native-image-picker@latest --save`

@@ -12,4 +21,71 @@ 2. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ `Add Files to <...>`

4. Make sure `UIImagePickerManager.m` is listed under 'Compile Sources' in your project's 'Build Phases' tab
5. Compile and have fun!
5. Compile and have fun
### Android
1. `npm install react-native-image-picker@latest --save`
```gradle
// file: android/settings.gradle
...
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(settingsDir, '../node_modules/react-native-image-picker/android')
```
```gradle
// file: android/app/build.gradle
...
dependencies {
...
compile project(':react-native-image-picker')
}
```
```java
// file: android/app/src/main/java/com/myappli/MainActivity.java
...
import android.content.Intent; // import
import com.imagepicker.ImagePickerPackage; // import
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
private ReactInstanceManager mReactInstanceManager;
private ReactRootView mReactRootView;
// declare package
private ImagePickerPackage mImagePicker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = new ReactRootView(this);
// instantiate package
mImagePicker = new ImagePickerPackage(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
// register package here
.addPackage(mImagePicker)
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "AwesomeProject", null);
setContentView(mReactRootView);
}
@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// handle onActivityResult
mImagePicker.handleActivityResult(requestCode, resultCode, data);
}
...
```
## Usage

@@ -25,4 +101,2 @@ 1. In your React Native javascript code, bring in the native module:

```javascript
// Specify any or all of these keys
var options = {

@@ -47,9 +121,12 @@ title: 'Select Avatar', // specify null or empty string to remove the title

// The first arg will be the options object for customization, the second is
// your callback which sends bool: didCancel, object: response.
//
// response.data is the base64 encoded image data
// response.uri is the uri to the local file asset on the device
// response.isVertical will be true if the image is vertically oriented
// response.width & response.height give you the image dimensions
/**
* The first arg will be the options object for customization, the second is
* your callback which sends bool: didCancel, object: response.
*
* response.data is the base64 encoded image data
* response.uri is the uri to the local file asset on the device
* response.isVertical will be true if the image is vertically oriented
* response.width & response.height give you the image dimensions
*/
UIImagePickerManager.showImagePicker(options, (didCancel, response) => {

@@ -97,1 +174,17 @@ console.log('Response = ', response);

```
### Options
option | iOS | Android
------ | ---- | -------
title | OK | OK
cancelButtonTitle | OK | OK
takePhotoButtonTitle | OK | OK
chooseFromLibraryButtonTitle | OK | OK
customButtons | OK | -
maxWidth | OK | OK
maxHeight | OK | OK
quality | OK | OK
allowsEditing | OK | -
noData | OK | OK
storageOptions | OK | -
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc