artsy / eigen

The Art World in Your Pocket or Your Trendy Tech Company's Tote, Artsy's mobile app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[RFC] New dependency: react-native-swiper

dariakoko opened this issue · comments

Status

Adopted

New Dependency

Name: react-native-swiper
URL: https://github.com/leecade/react-native-swiper

Focus

A React Native module that allows you to quickly build customisable Swiper components.

Check out the implementation and test out PR here.

Check List

  • Have read over the source code, and we can maintain it
  • Has had a release in the last year or looks done and stable

Alternatives

react-native-swiper seems to be the easiest solution for the purpose of the task (swipe between slides that display data and, based on the index of the card, update the slide-specific data). The Swiper component makes it easier to operate with indexes of the slides and child components.
Before testing react-native-swiper, I've tried out using SrollView. The implementation seemed to be not as transparent and robust as react-native-swiper, plus the ScrollView renders all child components at once, which adds more complexity to future tasks. With react-native-swiper we can render only the current slide.

I don't see why you cannot use this library.

Before testing react-native-swiper, I've tried out using SrollView. The implementation seemed to be not as transparent and robust as react-native-swiper, plus the ScrollView renders all child components at once, which adds more complexity to future tasks. With react-native-swiper we can render only the current slide.

But usually ViewPagers are used for data that isn't large. So Scrollview in this case would not have really bad effect on performance, if that is your major concern. Infact this library now uses Scrollview to implement its Pager. The longer route would be to use FlatList with pagingEnabled and detect current index of Page in view using onViewableItemsChanged. But that logic is already implemented in this lib.

In summary I vote that you use this lib and avoid reimplementing.

I love react-native-swiper I suggest we go for it as well. Thanks for opening this RFC

My only concern regarding this lib is it had no maintenance over the past 2 years 😢

+1 to @araujobarret! That's a long time. And it's always worth looking at the number of issues and open pull requests. 667 issues and over a 100 pull requests; that's a liability, and we can be just about certain that any issue that we encounter will require us to either fork the code or switch to something new.

@dariakoko and @MounirDhahri, is there something that is better maintained that achieves the same functionality?

thats a good point.

what do we want to use this for?
we have used just flatlist for this in folio.
Its the scrollablescreensview https://github.com/artsy/energy/blob/main/src/app/sharedUI/screens/Artwork/Artwork.tsx

@MounirDhahri what do you think?
The lib works and works well for our scenario
Implementing the Scrollview again will take some time, I had some performance issues when trying it last time

I would merge the solution with the library to unblock the release. In the future, when might consider writing our own component

I would merge the solution with the library to unblock the release

@dariakoko - but is there another solution that is active? We shouldn't rush when it involves dependencies that are unmaintained.

(Don't mean to hold things up here but also asking that one takes a step back and does a bit more research. If there's literally nothing else we can do then that's another matter. Surely there are options in the vast React Native ecosystem that are healthier to our app?)

Actually react-native-swiper is more like stable than unmaintained, it's become kind of the defacto go-to solution for swipers in react-native. The Flatlist/Scrollview API hasn't changed much over the past few years and that explains why not much has been added to react native swiper.

Closing this RFS.
We agreed not to use this library because of all of the mentioned reasons and went with a ScrollView instead 👍