-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View height regression caused by pagingEnabled wrapper div #1299
Comments
Workaround I'm currently using: return (
<FlatList
ref={flatListRef}
data-paging-enabled-fix
...
/>
) [data-paging-enabled-fix] > div > div > div {
height: 100%;
} |
It's deprecated on react-native-web necolas/react-native-web#1318 (comment) necolas/react-native-web#1146 (comment) necolas/react-native-web#1299
Note that in RNW >=0.13:
So to achieve the hotfix with the css provided above, you can use: return (
<FlatList
dataSet={{ 'paging-enabled-fix': true }}
...
/>
) Here's the specific implementation: react-native-web/packages/react-native-web/src/modules/createDOMProps/index.js Lines 90 to 100 in 9ed9231
|
Just confirming that I'm getting this with RNW For anyone using this with Next.js (+ Expo), this is my solution (with <View sx={{ flex: 1 }} onLayout={onLayout}>
<Animated.FlatList
data={images}
ref={flatlist}
keyExtractor={(item) => item.url}
renderItem={({ item }) => <ImageCarouselItem height={height} image={item} width={width} />}
extraData={{ width }}
onScroll={event(
[
{
nativeEvent: {
contentOffset: { x: scrollX }
}
}
],
{
useNativeDriver
}
)}
// @ts-ignore
dataSet={{ 'paging-enabled-fix': true }}
pagingEnabled
horizontal
getItemLayout={(_, index) => {
return {
length: width,
offset: width * index,
index
}
}}
// viewabilityConfig={viewabilityConfig}
/>
{Platform.OS === 'web' && (
<style jsx>{`
[data-paging-enabled-fix] > div > div > div {
height: 100%;
}
`}</style>
)}
</View> |
As first reported here, I investigated and got to the root cause.
The problem
Regression introduced when upgrading from
0.9.9
to0.10.0+
:How to reproduce
https://codesandbox.io/s/lyv4oywmv9?fontsize=14
It seems there is a new div wrap when using
pagingEnabled
and since it doesn't have a full height this happens.Steps to reproduce:
Environment (include versions). Did this work in previous versions?
The text was updated successfully, but these errors were encountered: