import { H3 } from '@expo/html-elements'; import * as React from 'react'; import { Platform, ScrollView, StyleSheet, Image, Text, TouchableOpacity, useWindowDimensions, View, RefreshControl, } from 'react-native'; import Button from '../components/Button'; import TitleSwitch from '../components/TitledSwitch'; export default function ScrollViewScreen() { const [isHorizontal, setHorizontal] = React.useState(true); const [isEnabled, setEnabled] = React.useState(true); const [isRefreshing, setRefreshing] = React.useState(false); const [removeClippedSubviews, setRemoveClippedSubviews] = React.useState(false); const scrollView = React.useRef(null); const axis = isHorizontal ? 'x' : 'y'; const { width } = useWindowDimensions(); const isMobile = width <= 640; const imageStyle = { width, height: width / 2, }; React.useEffect(() => { let timeout: any; if (isRefreshing) { timeout = setTimeout(() => setRefreshing(false), 2000); } return () => { clearTimeout(timeout); }; }, [isRefreshing]); const onRefresh = () => { setRefreshing(true); }; const items = React.useMemo(() => [...Array(20)].map((_, i) => `Item ${i}`), []); return ( }> { console.log('onScroll!'); }} scrollEventThrottle={200} scrollEnabled={isEnabled} nestedScrollEnabled horizontal={isHorizontal} ref={scrollView} style={styles.scrollView}> {items.map((title: string, index: number) => ( {title} ))}

Scroll to