Giphy / giphy-react-native-sdk

GIPHY React Native SDK
https://developers.giphy.com
Apache License 2.0
67 stars 25 forks source link

Having GiphyGridView twice in the component tree is creating issues with the search results #171

Closed kiranNegiloni closed 6 months ago

kiranNegiloni commented 6 months ago

🐛 Bug Report

(A clear and concise description of what the bug is)

To Reproduce

(Write your steps here:)

Hi Team,

Thanks for the wonderful library, I am facing an issue with GiphyGridView component. Need your help.

I have 2 tabs ( 1 for sticker and the other for displaying gifs), I have used GiphyGridView component twice to render the gifs and sticker. I have a search input field. Upon searching only the latest GiphyGridView mounted is getting the updated search results. Note - I have tried without using the tabview just to rule out the problems with tabview.

Expected behavior

Since both the components are mounted, search results should have affected both components

(Write what you thought would happen.)

Actual Behavior

Only the latest GiphyGridview search results are refreshed.

(Write what happened. Add screenshots, if applicable.)

Your Environment

Reproducible Demo

https://github.com/Giphy/giphy-react-native-sdk/assets/31494592/8283b309-ed1c-4480-8cb0-cfaba064f554

kiranNegiloni commented 6 months ago

Used conditional rendering of the tab to resolve the issue to ensure there is only 1 instance of giphyGridview component.