React Native Swipeout performance issues - reactjs

I have been using the swipeout library in my app for couple of months now. I was aware it will be much slower on simulators but kept it. Now that I have released the signed APK version I can see an extreme difference between performance of this library on say iPhone X versus Samsung S6. What could I do to make this work less laggy? The structure is like this:
I have a flatlist, which has a nested flatlist. The nested flatlist has swipeout rows. It has 2 buttons both on left and right. I am blocking the scroll of the parent flatlist whenever buttons are in view (after onOpen).

To anyone experiencing this problem, here is the cause and the solution:
Cause: Extra renders that were caused by updating flat list scroll prop (I was locking the vertical scroll in the onOpen from swipeout).
Fix: Get rid of extra renders eliminating them in the shouldComponentUpdate. To prevent full list re-render when setting the scroll prop you can use the setNativeProps function.
Good luck to all!

Related

List header scroll behavior in React Native

Wondering how I can achieve this scrolling behavior like Instagram has on their profile pages with React-Native? More specifically, how I do limit the scroll indicator to just the bottom section rendering the posts?
Instagram scroll behavior vs what I have
So far these are what I've tried with no success:
Using a FlatList with a header component (both sticky and not).
Using a SectionList, with a FlatList in one section, but if set showsVerticalScrollIndicator={false} on the SectionList, the FlatList also does not display the scroll indicator, no matter its value.
Also tried using Animated (react-spring) values and translating components based on scroll offset. This is the closest I've been, but it had more of a parallax effect which isn't really what I'm aiming for. Also, the animation was very choppy.
Been trying my hand at this for a couple of days now so any help is appreciated. Thanks!

Is it possible to scrollToIndex after the cells that will be visible are rendered?

Basically title. I want to wait for the cells that are going to visible to be rendered before scrolling to the position because right now i am getting a lot of blank area when scrolling fast.
Can you try to optimize your cell list rendering first? FlashList has this performance issue when the app renders heavier content (videos, high-resolution images,...).
Replacing FlatList with Shopify's FlashList should fix the problem - https://shopify.github.io/flash-list/

How do I implement a 'scrollspy' nav in React without useRef

I'm currently working on a project with Nextjs and Prismic
From Prismic, I'm fetching an array of slices, which includes the navigation slice and the section slices.
I'd like to implement a full-width horizontal nav bar that starts halfway down the page, sticks to the top and automatically updates to show which section is the currently 'active' section.
Here is an example of what I mean: https://getbootstrap.com/docs/4.0/components/scrollspy/
I've built the nav bar and made it stick to the top, but am now struggling to update it with the active section.
Because each of the sections are slices, it's not possible for me use the useRef hook and get the 'ref' out of the slice and up to the page level.
An alternative I've considered is using querySelectors at the page level and using the onscroll event handler to update the class of the 'active' section. It feels a little bit hacky and I'm a little unsure of exactly how to implement it, but it's the only solution I can think of.
Could anyone please help with this?

Render large list of images React Native

I want to render around 1200 items with images carousel in react native like shown on the screen below
FlatList works works so slow. Surprisingly, in case with images, ScrollView works better, but when it goes up 1200 elements, it works slow as hell.
Does somebody know how is that possible to render such amount of elements. Thanks.
Try these few props that help control the amount of items rendered like windowSize, maxToRenderPerBatch , and initialNumToRender .
It might helps with the performance

React Native - How to make permanent the vertical scrollbar of the ScrollView component?

I'm building a React Native app which has a screen containing a list of several items the user can see. I wrapped up the elements by using a ScrollView component and it works fine as shown below:
However, I'd like to have the vertical scrollbar always visible just to let the user know he can see more items than the ones shown in the first place. I've read the ScrollView documentation but it seems that there is not an option to make it happen.
Does anyone know if there is a way to achieve that or perhaps a workaround to make it intuitive to the user that there is a scroll on the list?
Try this ,Its working for me
persistentScrollbar={true}
https://facebook.github.io/react-native/docs/scrollview#flashscrollindicators
The closest thing to showing the scroll indicator constantly that is available in React Native is flashing the indicator. You can obtain a reference to the scrollview and call the flashScrollIndicators() method. There is no known way to disable hiding the indicator without writing native code. If you want to go down that path, you could try something like this for iOS.

Resources