diff --git a/packages/react-native-web-examples/pages/scroll-view/index.js b/packages/react-native-web-examples/pages/scroll-view/index.js index aff800792..8a55ed427 100644 --- a/packages/react-native-web-examples/pages/scroll-view/index.js +++ b/packages/react-native-web-examples/pages/scroll-view/index.js @@ -3,29 +3,39 @@ import { ScrollView, StyleSheet, Text, Pressable, View } from 'react-native'; import Button from '../../shared/button'; import Example from '../../shared/example'; -const ITEMS = [...Array(12)].map((_, i) => `Item ${i}`); +const ITEMS = [...Array(12)].map((_, i) => ({ id: i, text: `Item ${i}` })); -function createItemRow(msg, index) { +function createItemRow(msg) { return ( - - {msg} + + {msg.text} ); } -function Divider() { - return ; -} - export default function ScrollViewPage() { const [scrollEnabled, setEnabled] = React.useState(true); + const [horizontal, setHorizontal] = React.useState(false); const [throttle, setThrottle] = React.useState(16); + const [maintainVisibleContentPosition, setMaintainVisibleContentPosition] = + React.useState(false); + const [autoscrollToTop, setAutoScrollToTop] = React.useState(false); + const [items, setItems] = React.useState(ITEMS); const scrollRef = React.useRef(null); return ( { console.log('onScroll'); }} @@ -34,45 +44,87 @@ export default function ScrollViewPage() { scrollEventThrottle={throttle} style={[styles.scrollView, !scrollEnabled && styles.disabled]} > - {ITEMS.map(createItemRow)} + {items.map(createItemRow)} +