Skip to content

"Trying to remove non-present child list" error occurred with specific use-case #35871

@YangJonghun

Description

@YangJonghun

Description

Trying to remove non-present child list error occurred with specific case
(please check below reproduce or example)

Version

0.71.0

Output of npx react-native info

It doesn't related with dev environment. it is JS issue
this problem occurred within react-native/Libraries/Lists/ChildListCollection.js

Steps to reproduce

  1. use FlatList(A) as ListEmptyComponent within other FlatList(B, with empty data)
  2. inject data within FlatList(B) after ListEmptyComponent mounted

Snack, code example, screenshot, or link to a repository

just render below component

const ErrorComponent = () => {
  const [data, setData] = useState<number[]>([])

  useEffect(() => {
    setTimeout(() => {
      setData([1, 2, 3, 4, 5])
    }, 2000)
  }, [])

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <FlatList
        data={data}
        renderItem={({ item }) => <Text>{item}</Text>}
        ListEmptyComponent={
          <FlatList data={['empty']} renderItem={({ item }) => <Text>{item}</Text>} />
        }
      />
    </View>
  )
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions