React-native-swiper: Long load time for many children.

Created on 3 Aug 2018  路  3Comments  路  Source: leecade/react-native-swiper

If I make a simple implementation like so:

const CustomComponent = (props) => (
  <View style={{ alignItems: 'center', justifyContent: 'center', flex: 1 }}>
    <Text>{props.item}</Text>
  </View>
)

const data = [...new Array(2000)].map((x, i) => `Item ${i}`)

export class Simple extends React.Component<PropsT> {
  render() {
    return (
      <Swiper>
        {data.map(x => (
          <CustomComponent item={x} />
        ))}
      </Swiper>
    )
  }
}

As soon as I try to render Simple the app chokes, presumably while trying to instantiate 2000 instances of CustomComponent.

Am I using the library incorrectly? This seems like a crucial performance issue.

Most helpful comment

I have same this issue. I have 7 page, each page have one list data. I must to pay more 7 seconds for render UI, which is so long.
Solution for optimize for this issue ?

All 3 comments

I got a bit of a performance improvement when using showsPagination: false with ~500 children. Still a bit slow though.
I was very generous when I generated my mock data - I don't think I will ever really have 500 cards to swipe :)

Maybe loadMinimal?

I have same this issue. I have 7 page, each page have one list data. I must to pay more 7 seconds for render UI, which is so long.
Solution for optimize for this issue ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chetanparakh picture chetanparakh  路  3Comments

gwhite-dayspring picture gwhite-dayspring  路  3Comments

Liqiankun picture Liqiankun  路  3Comments

losikov picture losikov  路  3Comments

hadrienbbt picture hadrienbbt  路  3Comments