Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillUnmount() {
// Abort any uploading if user cancels
if (this.uploader) {
this.uploader.abort();
}
BackHandler.removeEventListener('hardwareBackPress', this.handleBackPress);
ImagePicker.clean();
Keyboard.dismiss();
}
id: currentUserId,
},
...postUploads,
...targetData,
...mediaData,
nsfw,
spoiler,
...spoiledData,
embedUrl,
}, {
include: 'media,spoiledUnit,user,uploads',
});
}
// Clean up any tmp image files
ImagePicker.clean();
if (onPostCreated) {
onPostCreated(newPost);
}
} catch (err) {
const string = (err && err[0].detail) || 'Failed to create post.';
this.setState({ error: string });
}
this.setState({ busy: false });
}
? PERMISSIONS.IOS.CAMERA
: PERMISSIONS.ANDROID.CAMERA,
)
if (status !== RESULTS.GRANTED) {
setSecurityAccessVisibility(true)
return
}
} catch (err) {
console.log(err)
}
}
} catch (err) {
console.log(err)
}
try {
await ImagePicker.clean()
} catch (err) {}
try {
const image = await ImagePicker.openCamera({
cropping: false,
})
prepareMediaAndSend([
{
filename: '',
uri: image.path || image.sourceURL || '',
mimeType: image.mime,
},
])
} catch (err) {
console.log(err)
}
const status = await request(
Platform.OS === 'ios' ? PERMISSIONS.IOS.CAMERA : PERMISSIONS.ANDROID.CAMERA,
)
if (status !== RESULTS.GRANTED) {
setSecurityAccessVisibility(true)
return
}
} catch (err) {
console.log(err)
}
}
} catch (err) {
console.log(err)
}
try {
await ImagePicker.clean()
} catch (err) {}
try {
const image = await ImagePicker.openCamera({
cropping: false,
})
prepareMediaAndSend([
{
filename: '',
uri: image.path || image.sourceURL || '',
mimeType: image.mime,
},
])
} catch (err) {
console.log(err)
}
onPress = async ()=>{
try{
await ImagePicker.clean()
}catch(e){}
let images = []
try{
images = await ImagePicker.openPicker({
mediaType: 'photo',
multiple: true,
maxFiles: 9999,
cropping: true,
smartAlbums: ['PhotoStream', 'Generic', 'UserLibrary', 'Screenshots'],
compressImageQuality: .9,
compressImageMaxWidth: 3000,
compressImageMaxHeight: 10000,
loadingLabelText: t.s('loading'),
forceJpg: true, //only ios
cropperToolbarTitle: t.s('edit') + ' ' + t.s('imaged'),