Is this a bug report?
Yes
Yes
Environment
react-native -v: 0.47.2
node -v: v6.10.3
npm -v: 3.10.10
yarn --version: n/a
Then, specify:
- Development Operating System: macOS
Steps to Reproduce
(Write your steps here:)
- Create a component with a
FlatList w/t getItemLayout, 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.)
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/aThen, specify:
Steps to Reproduce
(Write your steps here:)
FlatListw/tgetItemLayout, i.e.I am using the standard
getItemLayout:initialNumToRenderitemsExpected Behavior
(Write what you thought would happen.)
All items are rendered.
Actual Behavior
Only
initialNumToRenderitems are rendered.(Write what happened. Add screenshots!)
Reproducible Demo
The bug is in VirtualizedList:
The fix is:
You need
onLayoutbecause somebody needs to call_onCellLayout(e, key, ii).(Paste the link to an example project and exact instructions to reproduce the issue.)