We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
onImageCrop
I am trying after copying the example code and it is working fine in iOS but not working in Android. I am using this to pick image.
`import React, { useState, useRef } from 'react'; import { Button, StatusBar, StyleSheet, View, Image } from 'react-native'; import { CropView } from 'react-native-image-crop-tools'; import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
const App = () => { const [uri, setUri] = useState(); const cropViewRef = useRef(); return ( <> <View style={{ backgroundColor: "red" }}> <Button title={'Pick Image'} onPress={() => { const options = { mediaType: "photo" } launchImageLibrary(options, (response) => { setUri(response.uri); }) }} /> {uri !== undefined && <CropView sourceUrl={uri} style={styles.cropView} ref={cropViewRef} onImageCrop={(res) => alert(JSON.stringify(res))} keepAspectRatio aspectRatio={{ width: 16, height: 9 }} />} <View style={{ backgroundColor: "red4" }}>
<Button title={'Get Cropped View'} onPress={() => { cropViewRef.current.saveImage(90); }} /> </View> </View> </> );
};
const styles = StyleSheet.create({ container: { flex: 1, marginTop: 40 }, cropView: { flex: 1, backgroundColor: 'red' }, });
export default App;`
The text was updated successfully, but these errors were encountered:
got the same problem...
Sorry, something went wrong.
Hey! When you usesaveImage make sure to pass both arguments saveImage(true, 90);
saveImage
saveImage(true, 90);
No branches or pull requests
I am trying after copying the example code and it is working fine in iOS but not working in Android. I am using this to pick image.
`import React, { useState, useRef } from 'react';
import { Button, StatusBar, StyleSheet, View, Image } from 'react-native';
import { CropView } from 'react-native-image-crop-tools';
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
const App = () => {
const [uri, setUri] = useState();
const cropViewRef = useRef();
return (
<>
<View style={{ backgroundColor: "red" }}>
<Button
title={'Pick Image'}
onPress={() => {
const options = {
mediaType: "photo"
}
launchImageLibrary(options, (response) => {
setUri(response.uri);
})
}}
/>
{uri !== undefined && <CropView
sourceUrl={uri}
style={styles.cropView}
ref={cropViewRef}
onImageCrop={(res) => alert(JSON.stringify(res))}
keepAspectRatio
aspectRatio={{ width: 16, height: 9 }}
/>}
<View style={{ backgroundColor: "red4" }}>
};
const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: 40
},
cropView: {
flex: 1,
backgroundColor: 'red'
},
});
export default App;`
The text was updated successfully, but these errors were encountered: