Gustash / react-native-image-keyboard

React Native TextInput expansion to enable media input.
MIT License
147 stars 14 forks source link

Bug on android 10 and 11 #13

Closed sanabousaid2021 closed 3 years ago

sanabousaid2021 commented 3 years ago

Hello, I had a bug on android 10, when I add a gif from the keyboard, the gif is as if it has not been loaded, and I cannot add it to the formdata

https://user-images.githubusercontent.com/84022857/117819156-ca8c7180-b258-11eb-8a2b-3ad8e8764667.mp4

Gustash commented 3 years ago

From the video I can't tell what the problem is. Can you console.log the response from onImageChange and paste it here?

sanabousaid2021 commented 3 years ago

the gif not showing up even if the link is correct cf attchements

Capture d’écran 2021-05-11 à 13 15 06 Capture d’écran 2021-05-11 à 13 15 48
Gustash commented 3 years ago

Interesting. Can you share the project with me so I can debug this? I've never seen this behaviour before, might be something specific to your project/device, or an update that Google released that breaks the behaviour of this package.

sanabousaid2021 commented 3 years ago

can you send me your bitbucket account

Gustash commented 3 years ago

Of course, my username on BB is gustash

sanabousaid2021 commented 3 years ago

I need your email send it to me in this adresse @.***

Le mar. 11 mai 2021 à 17:59, Gustash @.***> a écrit :

Of course, my username on BB is gustash

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Gustash/react-native-image-keyboard/issues/13#issuecomment-838917582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBBMSMXJD3YQMYL3DIIZODTNFWBLANCNFSM44VNPBGQ .

sanabousaid2021 commented 3 years ago

i cant add you with your username would you please send me your email, i need your help thank you

Gustash commented 3 years ago

You should be able to give me access to the repo without my email.

https://stackoverflow.com/a/18824258

sanabousaid2021 commented 3 years ago

i added you in bitbucket with email i found in this page https://github.com/Gustash

Gustash commented 3 years ago

@sanabousaid2021 so it seems like something has changed either on Android, or on Gboard. The uri used to be a file path, but now it's a content uri. This means you can't render it directly anymore.

You have a couple options here, which I'll order by the ones I recommend you try first:

  1. Just use the linkUri instead of the uri. You'll need to check if this exists first though, as it's optional and some keyboards/GIFs might not provide this. The linkUri is the http/https link to the image on the internet.

  2. Use the data value instead of the uri. This is a base64 representation of the image, but it's not my first recommendation since base64 is extremely bulky and slow for images, especially for animated ones.

  3. Try something like this. The reason I'm recommending this last is because you'd need to install 2 extra libraries, and not all content uris lead to a file in the Android system, so this might still fail for other third-party keyboards.

Let me know if any of these solutions work for you.

Gustash commented 3 years ago

If you have your own server, you might be able to upload the content Uri as form data to your API. That would probably be a good fallback in case there is no linkUri

sanabousaid2021 commented 3 years ago

ok i will try this solution and i will tell you

sanabousaid2021 commented 3 years ago

thank you so much you saved me, i used linkUri just for android and let uri on ios ??

Gustash commented 3 years ago

thank you so much you saved me, i used linkUri just for android and let uri on ios ??

You can just check for the linkUri because that will always be undefined on iOS, so you can reuse the uri upload logic from iOS on Android, in case you don't get a linkUri there either