New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selecting media from library #1620

Closed
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@dvcrn
Contributor

dvcrn commented Jun 14, 2015

This PR adds support for UIImagePickerController to allow selecting a photo / video from the users camera roll.

ios simulator screen shot jun 14 2015 4 50 03 pm

Example:

Selecting something from camera roll

ImagePickerIOS.openSelectDialog(<config>, <successCallback>, <cancelCallback>);

ImagePickerIOS.openSelectDialog({
   showImages: true, // defaults to true
   showVideos: false // defaults to false
}, function (data) {
  console.info("Got a callback!");
  console.info(data); // file URL as in assets-library://asset/asset.JPG?id=E2741A73-D185-44B6-A2E6-2D55F69CD088&ext=JPG
}, function() {
  console.info("Cancelled");
});

Using camera

ImagePickerIOS.openCameraDialog(<config>, <successCallback>, <cancelCallback>);

ImagePickerIOS.openSelectDialog({
   videoMode: false, // defaults to true, whether to record videos instead
}, function (data) {
  console.info("Got a callback!");
  console.info(data); // file URL as in assets-library://asset/asset.JPG?id=E2741A73-D185-44B6-A2E6-2D55F69CD088&ext=JPG
}, function() {
  console.info("Cancelled");
});

I also implemented canRecordVideos and canUseCamera for devices that are either not capable of shooting a picture or video.

ImagePickerIOS.canRecordVideos(callback);
ImagePickerIOS.canUseCamera(callback);

@dvcrn dvcrn changed the title from Added support for UIImagePickerController to Add support for UIImagePickerController Jun 14, 2015

@dvcrn dvcrn changed the title from Add support for UIImagePickerController to Add support for selecting media from library Jun 14, 2015

@@ -0,0 +1,54 @@
/**

This comment has been minimized.

@JoeStanton

JoeStanton Jun 15, 2015

Contributor

I think ImagePickerIOS.js should be ImagePickerIOS.ios.js (as referenced in extractDocs).

@JoeStanton

JoeStanton Jun 15, 2015

Contributor

I think ImagePickerIOS.js should be ImagePickerIOS.ios.js (as referenced in extractDocs).

This comment has been minimized.

@dvcrn

dvcrn Jun 15, 2015

Contributor

@JoeStanton ah, I wasn't sure about that. I had it on .ios.js before but felt that IOS.ios.js is a bit too much since the name implicates the OS already.

AlertIOS.js for example is missing the ios.js which makes it even more confusing.

@dvcrn

dvcrn Jun 15, 2015

Contributor

@JoeStanton ah, I wasn't sure about that. I had it on .ios.js before but felt that IOS.ios.js is a bit too much since the name implicates the OS already.

AlertIOS.js for example is missing the ios.js which makes it even more confusing.

@nicklockwood

This comment has been minimized.

Show comment
Hide comment
@nicklockwood
Contributor

nicklockwood commented Jun 16, 2015

@wootwoot1234

This comment has been minimized.

Show comment
Hide comment
@wootwoot1234

wootwoot1234 Jan 15, 2016

@dvcrn I'm not sure if I should start a new thread for this or not but it would be great if this supported landscape, maybe with a popover or something? Right now if you try to use it with a landscape only app it crashes (at least on the simulator).

wootwoot1234 commented Jan 15, 2016

@dvcrn I'm not sure if I should start a new thread for this or not but it would be great if this supported landscape, maybe with a popover or something? Right now if you try to use it with a landscape only app it crashes (at least on the simulator).

@dvcrn

This comment has been minimized.

Show comment
Hide comment
@dvcrn

dvcrn Jan 16, 2016

Contributor

@wootwoot1234 I'm very limited on time these days. I'll try to take a look at it but no promises.
In the meantime, feel free to try it yourself 😄 RN is actually quite simple

Contributor

dvcrn commented Jan 16, 2016

@wootwoot1234 I'm very limited on time these days. I'll try to take a look at it but no promises.
In the meantime, feel free to try it yourself 😄 RN is actually quite simple

@wootwoot1234

This comment has been minimized.

Show comment
Hide comment
@wootwoot1234

wootwoot1234 Jan 16, 2016

@dvcrn thanks. I wouldn't ask if I hadn't already tried myself. I'm not familiar with Objective C and just get lost in errors after coping different snippets of code from StackOverflow. :(

wootwoot1234 commented Jan 16, 2016

@dvcrn thanks. I wouldn't ask if I hadn't already tried myself. I'm not familiar with Objective C and just get lost in errors after coping different snippets of code from StackOverflow. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment