question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.

See original GitHub issue
image

import React, { useEffect, useState } from ‘react’; import { useAppSelector, useAppDispatch } from ‘store/hook’; import { SafeAreaView } from ‘react-native-safe-area-context’; import { ScrollView, ImageBackground, Image, Modal, TouchableOpacity, Animated, PanResponder, GestureResponderEvent, PanResponderGestureState } from ‘react-native’; import { DragSortableView } from ‘react-native-drag-sort’; // import { Modal } from ‘@ant-design/react-native’; import MyStyleSheet from ‘components/MyStyleSheet’; import { UIText, UITextInput } from ‘components/Text/Texts’; import { Dimensions } from ‘react-native’; import { NestableScrollContainer, NestableDraggableFlatList, ScaleDecorator, RenderItemParams } from “react-native-draggable-flatlist”

export const WINDOW_WIDTH = Dimensions.get(‘window’).width;

export const WINDOW_HEIGHT = Dimensions.get(‘window’).height;

const NUM_ITEMS = 10; function getColor(i: number) { const multiplier = 255 / (NUM_ITEMS - 1); const colorVal = i * multiplier; return rgb(${colorVal}, ${Math.abs(128 - colorVal)}, ${255 - colorVal}); }

type Item = { key: string; label: string; height: number; width: number; backgroundColor: string; };

const initialData: Item[] = […Array(NUM_ITEMS)].map((d, index) => { const backgroundColor = getColor(index); return { key: item-${index}, label: String(index) + “”, height: 100, width: 60 + Math.random() * 40, backgroundColor, }; });

const Index: React.FC<{ navigation: any }> = ({ navigation }) => { const [data, setData] = useState(initialData);

const renderItem = ({ item, drag, isActive }: RenderItemParams<Item>) => { console.log(666, item, drag, isActive); return ( <ScaleDecorator> <TouchableOpacity onLongPress={drag} disabled={isActive} style={[ styles.rowItem, { backgroundColor: isActive ? “red” : item.backgroundColor }, ]} > <UIText style={styles.text}>{item.label}</UIText> </TouchableOpacity> </ScaleDecorator> ); }; console.log(‘data’, data); console.log(‘renderItem’, renderItem); return ( <NestableScrollContainer> <NestableDraggableFlatList data={data} renderItem={renderItem} keyExtractor={(item) => item.key} onDragEnd={({ data }) => setData(data)} /> </NestableScrollContainer> ); };

const styles = MyStyleSheet.create({ rowItem: { height: 100, width: 100, alignItems: “center”, justifyContent: “center”, }, text: { color: “white”, fontSize: 24, fontWeight: “bold”, textAlign: “center”, }, });

export default Index;

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

6reactions
efstathiosntonascommented, Nov 14, 2022

Same here, no matter what I tried with the components reordering etc. the warning won’t go away.

4reactions
karolsw3commented, Nov 11, 2022
Screenshot 2022-11-11 at 23 15 31 @TomCorvus Wrapping `NestableDraggableFlatList` with the `NestableScrollContainer` doesn't solve this problem for me
Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR - VirtualizedLists should never be nested inside plain ...
The complete error is: VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing ...
Read more >
"VirtualizedLists should never be nested inside plain ... - GitHub
We get the "VirtualizedLists should never be nested inside plain ScrollViews with the same orientation" console error repeatedly in the case of 2....
Read more >
virtualizedlists should never be nested inside plain scrollviews ...
virtualizedlists should never be nested inside plain scrollviews with the same orientation because it can break windowing and other functionality - use another...
Read more >
How to Fix VirtualizedLists should never be nested inside ...
VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container ...
Read more >
React-native-virtualized-view - npm.io
When Flatlist inside Scrollview, will have a warning: virtualizedlists should never be nested inside plain scrollviews with the same orientation because it ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found