/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
import * as React from 'react';
import {useRef, useState} from 'react';
import {Animated, Button, Text, View} from 'react-native';
const componentList: number[] = Array.from({length: 100}, (_, i) => i + 1);
function PressableWithNativeDriver() {
const currScroll = useRef(new Animated.Value(0)).current;
const [count, setCount] = useState(0);
return (
(
{index}
)}
keyExtractor={item => item.toString()}
onScroll={Animated.event(
[
{
nativeEvent: {
contentOffset: {
y: currScroll,
},
},
},
],
{useNativeDriver: true},
)}
/>
);
}
export default ({
title: 'Pressability With Native Driver',
name: 'pressabilityWithNativeDrivers',
description: 'Pressabile animated with Native Drivers',
render: () => ,
}: RNTesterModuleExample);