I am quite new to RN . I know this question is being repeated but I didn't quite get ans I was looking for there . So my current project uses expo for web and react-native cli for the android set up . I want to add an image-picker to the project. I see two options at my side .
- RN-image-picker
- expo-image-picker
I have some issues and some questions !!
- Is RN-native-image picker comaptible with web ??
- I think its not ,there are two resons I think that ,this lib uses Nativemodules, which won't be bundled for web and its giving undefined error for NativeModules when I run with web while it works fine on android .
- Should I use expo-image-picker when I am creating a android build with react-native cli ??
- The build doesn't give errors and it shouldn't ,but when I click on upload image ,app crashes after I select image.I read the docs and github for the issue.Many people pointed out its ram allocation issue,which can be sorted with disbaling "Dont keep activities" in developer's option,which I haven't tried yet .
- Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
I am using this code snippet for expo-image-picker,which ends up crashing app when I build app with rn cli,but doesn't seem to cause issues with expocli build.But I want to use expo for web and rn for android. Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
const pickImage = async () => {
try{
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
base64:false
})
if(!result.isCancelled)return result.uri ;
}catch(err){
console.log(err) ;
}
}
So what should I do in this case,use expo-image-picker as it seems to be compatible with all platforms/both ? Any kind of input would be helpful !!