Skip to content
New issue

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

Using http url in source uri crashes the app #2

Closed
himanshi7046 opened this issue Aug 3, 2021 · 8 comments
Closed

Using http url in source uri crashes the app #2

himanshi7046 opened this issue Aug 3, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@himanshi7046
Copy link

No description provided.

@himanshi7046 himanshi7046 changed the title Crash on android Crash on android with custom uri Aug 3, 2021
@vemarav
Copy link
Owner

vemarav commented Aug 3, 2021

can you provide a reproducible code or share uri format

@himanshi7046
Copy link
Author

<Crop
source={{ uri: 'http://picsum.photos/200/100' }}
width={SCREEN_WIDTH}
height={SCREEN_WIDTH}
cropArea={{ width: SCREEN_WIDTH / 1.3, height: SCREEN_WIDTH / 1.3 }}
onCrop={(cropCallback) => (crop = cropCallback)}
/>

@vemarav vemarav added the enhancement New feature or request label Aug 3, 2021
@vemarav
Copy link
Owner

vemarav commented Aug 3, 2021

hey @himanshi7046,

the issue you are facing is because of http, the following snippet works. make sure you set allow insecure url config in your android manifest.

<Crop
        source={{
          uri: 'https://images.unsplash.com/photo-1627942152443-2c0defc72bb5?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzfHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60',
        }}
        width={SCREEN_WIDTH}
        height={SCREEN_WIDTH}
        cropArea={{width: SCREEN_WIDTH / 1.3, height: SCREEN_WIDTH / 1.3}}
        onCrop={cropCallback => (crop = cropCallback)}
      />

@vemarav vemarav closed this as completed Aug 3, 2021
@vemarav vemarav changed the title Crash on android with custom uri using http url in source uri crashes the app Aug 3, 2021
@himanshi7046
Copy link
Author

himanshi7046 commented Aug 3, 2021

Null is not an object( evaluting 'RNImageSize.getSize') error

and added
android:usesCleartextTraffic="true"
in android manifest

@himanshi7046 himanshi7046 changed the title using http url in source uri crashes the app Using http url in source uri crashes the app Aug 3, 2021
@vemarav
Copy link
Owner

vemarav commented Aug 3, 2021

@himanshi7046 you are using redirected url, it won't work. you need to use the final url.

I got following image url by visiting the url you mentioned and it works.
https://i.picsum.photos/id/652/200/100.jpg?hmac=FHOGj_uJexMz6mmMNShTa6x_T5-flvAs--cj5Ip0sTU

Repository owner deleted a comment from himanshi7046 Aug 3, 2021
@himanshi7046
Copy link
Author

@himanshi7046 you are using redirected url, it won't work. you need to use the final url.

I got following image url by visiting the url you mentioned and it works.
https://i.picsum.photos/id/652/200/100.jpg?hmac=FHOGj_uJexMz6mmMNShTa6x_T5-flvAs--cj5Ip0sTU

Still having the same issue can you please check it before reply

@vemarav
Copy link
Owner

vemarav commented Aug 4, 2021

make a reproducible repo, I will check it out

@vemarav
Copy link
Owner

vemarav commented Aug 4, 2021

@himanshi7046 need more info to know why its crashing. without reproducible repo or crash logs I won't be able to help.

are you using npm@7 then check issue #3.

Happy to help resolve your issue. It is fully compatible with remote images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants