gorhom / react-native-sticky-item

An interactive sticky item inspired by Facebook Stories.
MIT License
891 stars 48 forks source link

Awesome #2

Closed hirbod closed 4 years ago

hirbod commented 4 years ago

Sorry for hijacking your Github, but I just wanted to thank you and add some feature requests. Since I have a pretty similar copy to the facebook stories in my react app, I was thinking to implement this sticky item since 2 or 3 weeks but I've been so lazy, and now, I just found this one here which looks very promising.

My story is based on react-native-snap-carousel though, so I will need to refactor I guess, but really good work!

While clicking on the story, I'll open an overlay which is swipable too and I sync the underlaying story position when the user swipes the "overlay modal", but as far as I can see, I can't get a ref on your FlatList component, and you added {...rest} at top, so you'll overwrite props I might need to adjust.

https://github.com/gorhom/react-native-sticky-item/blob/master/src/StickyItemFlatList.tsx#L154

Do you think there is a way to register a ref "outside" to manipulate the scroll position and move {...rest} to the bottom of FlatList so we can overwrite your hardcoded settings?

hirbod commented 4 years ago

To give you a better insight how my app looks currently, here is a link: https://streamable.com/nejzil

I think (not tested, only reviewing code) I will not be able to achieve this currently with your implementation. As you can see in my video, I am triggering an event (with an index) to sync the carousel-position.

gorhom commented 4 years ago

hi @Hirbod , i will try to get both internal and external ref to be assigned to the flatlist on next release 👍

hirbod commented 4 years ago

Actually we just need something like „scrollviewref“ as a prop and you just pass your ref to that prop. Should be enough, or am I missing something? (Or forwardRef?)

gorhom commented 4 years ago

hi @Hirbod , i have added forwardRef support with v1.1.2 release 👍https://github.com/gorhom/react-native-sticky-item/releases/tag/v1.1.2

hirbod commented 4 years ago

Thank you very much @gorhom - excited to test this. Hopefully the included reanimated version from expo is enough :)

gorhom commented 4 years ago

you are welcome , hopefully it works :)

hirbod commented 4 years ago

@gorhom it is just working INCREDIBLE smooth and awesome on Expo (iOS and Android). U saved me a TON of work with this beautiful and well written utility. Thank you very much!

gorhom commented 4 years ago

@Hirbod glad to hear that :)