Skip to content

Horizontal LegendList unable to render nested vertical ScrollViews #327

@abdullahibneat

Description

@abdullahibneat

I was trying to use <LegendList horizontal /> to render multiple vertical <ScrollView /> components, but it looks like the ScrollViews become unresponsive to gestures and cannot be scrolled up-and-down.

Tried on Expo 54 + LegendList v2.

Here's a video showing the issue (I've run a production build, NOT Expo Go):

legend-list-demo.mov

Sample code:

import { Dimensions, ScrollView, Text, View } from 'react-native'

import { LegendList } from '@legendapp/list'

const width = Dimensions.get('window').width

const VerticalList = ({ even }: { even: boolean }) => (
  <ScrollView
    contentContainerStyle={{
      width,
      backgroundColor: even ? 'white' : 'lightgray',
    }}
  >
    {new Array(100).fill(0).map((_, index) => (
      <Text key={String(index)}>{index}</Text>
    ))}
  </ScrollView>
)

export default function App() {
  return (
    <View style={{ flex: 1 }}>
      <LegendList
        horizontal
        nestedScrollEnabled
        data={[0, 1, 2, 3]}
        renderItem={({ item }) => <VerticalList even={item % 2 === 0} />}
        getFixedItemSize={() => width}
      />
    </View>
  )
}

Sample Expo Snack: https://snack.expo.dev/@arabiyya/legendlist

Potentially related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions