Loading another Flashlist causes a horizontal scroll bar to appear - IOS
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 393
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Description
Expected behavior
Hey,
On iPhone 16 Pro (iOS 18.6), for unknown reasons, horizontal scrolling appears, even though all elements fit within the view.
For example:
- I load data from the API into FlashList associated with
view=devices- no horizontal scrolling, everything fits**(!)**. - I change
viewtonotifications- a horizontal scroll bar appears (even whenrenderItem={() => {return <></>}) - I go back to
view=devicesand suddenly there is horizontal scrolling there too.
I tested this issue on Android and it does not occur. I also used an iPhone 8 with iOS 15 and the issue does not occur there either.
To Reproduce
const [view, setView] = useState<'devices' | 'notifications'>('devices');
return(
<View style={{ flex: 1 }}>
{/* Content */}
{view === 'devices' ? (
<FlashList
ListEmptyComponent={loadingOrEmptyFlatListComponent({ isLoading: loading })}
key={view}
data={filteredDevices}
renderItem={renderDeviceItem}
keyExtractor={(item) => item.id.toString()}
numColumns={2}
onLayout={(event) => {
const { width } = event.nativeEvent.layout;
console.log('towers-list FlashList width:', width);
}}
contentContainerStyle={{
paddingBottom: insets.bottom,
paddingHorizontal: 20,
paddingTop: headerHeight + insets.top,
}}
showsVerticalScrollIndicator={false}
/>
) : (
<FlashList
key={view}
data={groupedPreferences}
renderItem={renderItem}
getItemType={(item) => (typeof item === 'string' ? `sectionHeader` : `item`)}
keyExtractor={(item) =>
typeof item === 'string' ? `sectionHeader-${item}` : `item-${item.notificationType}`
}
contentContainerStyle={{
paddingBottom: insets.bottom,
paddingHorizontal: 20,
paddingTop: headerHeight + insets.top,
}}
showsVerticalScrollIndicator={false}
}
/>
)}
</View>)
Platform:
- iOS
- Android
Environment
Flashlist Version: 2.0.1
Expo Go client version: 1017702
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction snippet in the issue and reproduce the switch between the keyed devices and notifications FlashLists on iOS, comparing the affected iPhone 16 Pro with Android or iPhone 8. Investigate the horizontal layout after changing views; done means switching between both lists no longer causes a horizontal scrollbar when the content fits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100