react-native-image-crop-tools icon indicating copy to clipboard operation
react-native-image-crop-tools copied to clipboard

`onImageCrop` is not returning anything in Android.

Open shahanshah87 opened this issue 3 years ago • 2 comments

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 ( <> <StatusBar barStyle="dark-content" /> <View style={styles.container}> <View style={{ backgroundColor: "red" }}> <Button title={'Pick Image'} onPress={() => { const options = { mediaType: "photo" } launchImageLibrary(options, (response) => { setUri(response.uri); }) }} /> </View> {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;`

shahanshah87 avatar Feb 08 '22 12:02 shahanshah87

got the same problem...

geakk avatar Mar 27 '22 21:03 geakk

Hey! When you usesaveImage make sure to pass both arguments saveImage(true, 90);

jonmajorc avatar Jun 09 '22 20:06 jonmajorc