From ad90ffbf353837ecb5b5cecafa2364eadfd29100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Chrab=C4=85szczewski?= Date: Tue, 18 Jul 2023 13:24:05 +0200 Subject: [PATCH 1/3] test: scenario --- .../pages/viewable-items/index.js | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 packages/react-native-web-examples/pages/viewable-items/index.js diff --git a/packages/react-native-web-examples/pages/viewable-items/index.js b/packages/react-native-web-examples/pages/viewable-items/index.js new file mode 100644 index 000000000..799e09046 --- /dev/null +++ b/packages/react-native-web-examples/pages/viewable-items/index.js @@ -0,0 +1,86 @@ +import React from 'react'; +import { + FlatList, + StyleSheet, + Text, + Pressable, + View, + Button +} from 'react-native'; +import Example from '../../shared/example'; + +const ITEMS = [...Array(200)].map((_, i) => `Item ${i}`); + +function createItemRow({ item, index }) { + return ( + + {item} + + ); +} + +function Divider() { + return ; +} + +const viewabilityConfig = { + itemVisiblePercentThreshold: 95 +}; + +function onViewableItemsChanged({ viewableItems, changed }) { + console.log('Visible items are', viewableItems); + console.log('Changed in this iteration', changed); +} + +export default function ScrollViewPage() { + const scrollRef = React.useRef(null); + const [isInverted, setIsInverted] = React.useState(true); + + return ( + + +