Can't read property showImagePicker of undefined in react native iOS
I have tired with this issue
- npm install react-native-image-picker@latest --save
- react-native link react-native-image-picker
import ImagePicker from 'react-native-image-picker';
const options = {
quality: 1.0,
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: true
}
};
ImagePicker.showImagePicker(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
const source = { uri: response.uri };
// You can also display the image using data:
// const source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source,
});
}
});[enter image description here][1]
ios react-native
add a comment |
I have tired with this issue
- npm install react-native-image-picker@latest --save
- react-native link react-native-image-picker
import ImagePicker from 'react-native-image-picker';
const options = {
quality: 1.0,
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: true
}
};
ImagePicker.showImagePicker(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
const source = { uri: response.uri };
// You can also display the image using data:
// const source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source,
});
}
});[enter image description here][1]
ios react-native
add a comment |
I have tired with this issue
- npm install react-native-image-picker@latest --save
- react-native link react-native-image-picker
import ImagePicker from 'react-native-image-picker';
const options = {
quality: 1.0,
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: true
}
};
ImagePicker.showImagePicker(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
const source = { uri: response.uri };
// You can also display the image using data:
// const source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source,
});
}
});[enter image description here][1]
ios react-native
I have tired with this issue
- npm install react-native-image-picker@latest --save
- react-native link react-native-image-picker
import ImagePicker from 'react-native-image-picker';
const options = {
quality: 1.0,
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: true
}
};
ImagePicker.showImagePicker(options, (response) => {
console.log('Response = ', response);
if (response.didCancel) {
console.log('User cancelled image picker');
} else if (response.error) {
console.log('ImagePicker Error: ', response.error);
} else if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
const source = { uri: response.uri };
// You can also display the image using data:
// const source = { uri: 'data:image/jpeg;base64,' + response.data };
this.setState({
avatarSource: source,
});
}
});[enter image description here][1]
ios react-native
ios react-native
edited Jan 3 at 13:07
![](https://i.stack.imgur.com/zuREC.jpg?s=32&g=1)
![](https://i.stack.imgur.com/zuREC.jpg?s=32&g=1)
A.H.Nuri
817511
817511
asked Jan 3 at 12:18
user30720user30720
64
64
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You should restart the packager , every time you run link command in order to take effect. Just cancel the running packager and run react-native run-ios
again
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
add a comment |
When you use react-native-link
it affects 3 files in your android folder, the build.gradle
file (located android/app), the settings.gradle
(located android/) and the MainApplication.java
file (located android/app/src/java).
Normally while linking, the dependencies don't get applied in build.gradle
at times. Therefore check whether the package (react-native-image-picker
) is added, if not go ahead and add it as compile project(':react-native-image-picker')
.
Likewise, check all the other files specified above whether the package is defined.
This is for android (I misunderstood the question as i experienced the same issue and fixed it for android)
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
add a comment |
I also was dealing with this weird issue for a couple of days, in some threats in Github and some other questions here I could not find a solution that really solved the problem from my side till I found this bizarre but effective one!
Here are the steps I followed:
1.- Open Xcode and from your project directory, go to the folder libraries. After that, go and find RNImagePicker
and open Products folder.
2.- Go to the Build Phases Tab.
3.- Then drag and drop libRnImagePicker.a
to Link Binary With Libraries.
This step is the magic one, by doing this a missed link relation in your project is going to be generated by this time your project should look like this:
4.- Close your project
5.- Run sudo rm -rf node_modules/.cache
6.- After this, compile your project either with Xcode or with react-native run-ios
While the compilation happens and the link dependency gets register it will return an error of cycle dependencies (But this is actually good news, we are almost there!)
7.- Open again the route described in step 1 and remove libRNImagePicker.a
by clicking in the minus buttom.
8.- Run your project again, and voila! The react-native-image-picker
is working! :)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022160%2fcant-read-property-showimagepicker-of-undefined-in-react-native-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should restart the packager , every time you run link command in order to take effect. Just cancel the running packager and run react-native run-ios
again
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
add a comment |
You should restart the packager , every time you run link command in order to take effect. Just cancel the running packager and run react-native run-ios
again
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
add a comment |
You should restart the packager , every time you run link command in order to take effect. Just cancel the running packager and run react-native run-ios
again
You should restart the packager , every time you run link command in order to take effect. Just cancel the running packager and run react-native run-ios
again
answered Jan 3 at 12:49
![](https://i.stack.imgur.com/K6odA.jpg?s=32&g=1)
![](https://i.stack.imgur.com/K6odA.jpg?s=32&g=1)
Daniel RaoufDaniel Raouf
802617
802617
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
add a comment |
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
uninstall & unlink image-picker. and reinstall and relink this. then after 'react-native run-ios'. so still getting this issue, and also one more time Execute link command and 'react-native run-ios'. but issue is not resolve. and in Android it's working fine.
– user30720
Jan 4 at 6:10
add a comment |
When you use react-native-link
it affects 3 files in your android folder, the build.gradle
file (located android/app), the settings.gradle
(located android/) and the MainApplication.java
file (located android/app/src/java).
Normally while linking, the dependencies don't get applied in build.gradle
at times. Therefore check whether the package (react-native-image-picker
) is added, if not go ahead and add it as compile project(':react-native-image-picker')
.
Likewise, check all the other files specified above whether the package is defined.
This is for android (I misunderstood the question as i experienced the same issue and fixed it for android)
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
add a comment |
When you use react-native-link
it affects 3 files in your android folder, the build.gradle
file (located android/app), the settings.gradle
(located android/) and the MainApplication.java
file (located android/app/src/java).
Normally while linking, the dependencies don't get applied in build.gradle
at times. Therefore check whether the package (react-native-image-picker
) is added, if not go ahead and add it as compile project(':react-native-image-picker')
.
Likewise, check all the other files specified above whether the package is defined.
This is for android (I misunderstood the question as i experienced the same issue and fixed it for android)
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
add a comment |
When you use react-native-link
it affects 3 files in your android folder, the build.gradle
file (located android/app), the settings.gradle
(located android/) and the MainApplication.java
file (located android/app/src/java).
Normally while linking, the dependencies don't get applied in build.gradle
at times. Therefore check whether the package (react-native-image-picker
) is added, if not go ahead and add it as compile project(':react-native-image-picker')
.
Likewise, check all the other files specified above whether the package is defined.
This is for android (I misunderstood the question as i experienced the same issue and fixed it for android)
When you use react-native-link
it affects 3 files in your android folder, the build.gradle
file (located android/app), the settings.gradle
(located android/) and the MainApplication.java
file (located android/app/src/java).
Normally while linking, the dependencies don't get applied in build.gradle
at times. Therefore check whether the package (react-native-image-picker
) is added, if not go ahead and add it as compile project(':react-native-image-picker')
.
Likewise, check all the other files specified above whether the package is defined.
This is for android (I misunderstood the question as i experienced the same issue and fixed it for android)
edited Jan 3 at 13:20
answered Jan 3 at 12:31
![](https://i.stack.imgur.com/O5oTo.jpg?s=32&g=1)
![](https://i.stack.imgur.com/O5oTo.jpg?s=32&g=1)
RonRon
4891521
4891521
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
add a comment |
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
in android it's working fine, only getting issue in iOS. thanks.
– user30720
Jan 4 at 6:13
add a comment |
I also was dealing with this weird issue for a couple of days, in some threats in Github and some other questions here I could not find a solution that really solved the problem from my side till I found this bizarre but effective one!
Here are the steps I followed:
1.- Open Xcode and from your project directory, go to the folder libraries. After that, go and find RNImagePicker
and open Products folder.
2.- Go to the Build Phases Tab.
3.- Then drag and drop libRnImagePicker.a
to Link Binary With Libraries.
This step is the magic one, by doing this a missed link relation in your project is going to be generated by this time your project should look like this:
4.- Close your project
5.- Run sudo rm -rf node_modules/.cache
6.- After this, compile your project either with Xcode or with react-native run-ios
While the compilation happens and the link dependency gets register it will return an error of cycle dependencies (But this is actually good news, we are almost there!)
7.- Open again the route described in step 1 and remove libRNImagePicker.a
by clicking in the minus buttom.
8.- Run your project again, and voila! The react-native-image-picker
is working! :)
add a comment |
I also was dealing with this weird issue for a couple of days, in some threats in Github and some other questions here I could not find a solution that really solved the problem from my side till I found this bizarre but effective one!
Here are the steps I followed:
1.- Open Xcode and from your project directory, go to the folder libraries. After that, go and find RNImagePicker
and open Products folder.
2.- Go to the Build Phases Tab.
3.- Then drag and drop libRnImagePicker.a
to Link Binary With Libraries.
This step is the magic one, by doing this a missed link relation in your project is going to be generated by this time your project should look like this:
4.- Close your project
5.- Run sudo rm -rf node_modules/.cache
6.- After this, compile your project either with Xcode or with react-native run-ios
While the compilation happens and the link dependency gets register it will return an error of cycle dependencies (But this is actually good news, we are almost there!)
7.- Open again the route described in step 1 and remove libRNImagePicker.a
by clicking in the minus buttom.
8.- Run your project again, and voila! The react-native-image-picker
is working! :)
add a comment |
I also was dealing with this weird issue for a couple of days, in some threats in Github and some other questions here I could not find a solution that really solved the problem from my side till I found this bizarre but effective one!
Here are the steps I followed:
1.- Open Xcode and from your project directory, go to the folder libraries. After that, go and find RNImagePicker
and open Products folder.
2.- Go to the Build Phases Tab.
3.- Then drag and drop libRnImagePicker.a
to Link Binary With Libraries.
This step is the magic one, by doing this a missed link relation in your project is going to be generated by this time your project should look like this:
4.- Close your project
5.- Run sudo rm -rf node_modules/.cache
6.- After this, compile your project either with Xcode or with react-native run-ios
While the compilation happens and the link dependency gets register it will return an error of cycle dependencies (But this is actually good news, we are almost there!)
7.- Open again the route described in step 1 and remove libRNImagePicker.a
by clicking in the minus buttom.
8.- Run your project again, and voila! The react-native-image-picker
is working! :)
I also was dealing with this weird issue for a couple of days, in some threats in Github and some other questions here I could not find a solution that really solved the problem from my side till I found this bizarre but effective one!
Here are the steps I followed:
1.- Open Xcode and from your project directory, go to the folder libraries. After that, go and find RNImagePicker
and open Products folder.
2.- Go to the Build Phases Tab.
3.- Then drag and drop libRnImagePicker.a
to Link Binary With Libraries.
This step is the magic one, by doing this a missed link relation in your project is going to be generated by this time your project should look like this:
4.- Close your project
5.- Run sudo rm -rf node_modules/.cache
6.- After this, compile your project either with Xcode or with react-native run-ios
While the compilation happens and the link dependency gets register it will return an error of cycle dependencies (But this is actually good news, we are almost there!)
7.- Open again the route described in step 1 and remove libRNImagePicker.a
by clicking in the minus buttom.
8.- Run your project again, and voila! The react-native-image-picker
is working! :)
answered Feb 4 at 6:10
Mauricio SartoriMauricio Sartori
1,19731624
1,19731624
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54022160%2fcant-read-property-showimagepicker-of-undefined-in-react-native-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown