-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: 0.47.2node -v
: v6.10.3npm -v
: 3.10.10yarn --version
: n/a
Then, specify:
- Target Platform: iOS
- Development Operating System: macOS
- Build tools: Xcode
Steps to Reproduce
(Write your steps here:)
- Create a component with a
FlatList
w/tgetItemLayout
, i.e.
<FlatList
ref={ref => { const anyRef: any = ref; this._flatList = anyRef }}
data={data}
renderItem={this._renderItem}
onViewableItemsChanged={this._onViewableItemsChanged}
getItemLayout={this._getItemLayout}
initialNumToRender={10}
/>
I am using the standard getItemLayout
:
getItemLayout={(data, index) => (
{length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index}
)}
- Provide a data source that has more than
initialNumToRender
items - Render and scroll to bottom
Expected Behavior
(Write what you thought would happen.)
All items are rendered.
Actual Behavior
Only initialNumToRender
items are rendered.
(Write what happened. Add screenshots!)
Reproducible Demo
The bug is in VirtualizedList:
const onLayout =
getItemLayout && !parentProps.debug && !fillRateHelper.enabled()
? undefined
: this.props.onLayout;
The fix is:
const onLayout = this.props.onLayout;
You need onLayout
because somebody needs to call _onCellLayout(e, key, ii)
.
(Paste the link to an example project and exact instructions to reproduce the issue.)
RichardLindhout, rbaron, felipeViana, itaibs, dotansimha and 16 more
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.