hhunaid / react-native-image-crop-tools

Native-ish Image Crop Tools for react native
171 stars 58 forks source link

CropView not showing image to be cropped #43

Open shivam0831 opened 3 years ago

shivam0831 commented 3 years ago

CropView not showing the image to be cropped only a blank screen is showing.

import { CropView } from 'react-native-image-crop-tools';

const [uri, setUri] = useState('https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg');

{uri !== undefined && <CropView sourceUrl={uri} style={{flex:1}} ref={cropViewRef} onImageCrop={(res) => console.warn(res)} keepAspectRatio aspectRatio={{ width: 16, height: 9 }} />}

dandresfg commented 3 years ago

Try something like this:

        <View style={{ flex: 1 }}>
          <CropView
            sourceUrl={file.path}
            style={{ flex: 1 }}
            ref={ref}
            aspectRatio={style.radio}
            keepAspectRatio
            onImageCrop={(res) => console.warn(res)}
          />
        </View>