LoginSignup
1
0

More than 1 year has passed since last update.

ReactNativeのFlatlistでデフォルトでレンダリングされる数を変更する

Posted at

Flatlistのデフォルトでレンダリングされる数は10ですが、
ScrollToIndexとかを使うときにこんなエラーが出て困ったりします.

Invariant Violation: scrollToIndex should be used in conjunction withgetItemLayout or onScrollToIndexFailed,
otherwise there is no way to know the location of offscreen indices or handle failures.

解決

initialNumToRender={レンダリングする数}でデフォルトででレンダリングされる数を変更できます.

<Flatlist
   ...
    initialNumToRender={9999}
   ...
 />
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0