0

これを達成する方法は何でしょうか。

Animated.event を使用したコールバックは正常に動作します

ブロック付きのコールバックはフィードバックを返しません:(

import React, { useState, useEffect } from "react";
import { View, Text, FlatList, Dimensions, Image } from "react-native";
import Animated from "react-native-reanimated";
import { PanGestureHandler, TapGestureHandler, State } from "react-native-gesture-handler";
const { Value, event, call, set, add, block } = Animated;

const bottom = new Value(100);

//want to achieve something like this 
const onHandlerStateChange = block([set(bottom, add(bottom, 10))]);

// the line below Does work 
// const onHandlerStateChange = event([{ nativeEvent: { y: bottom } }]); 

const Comp = () => {
    return (
        <TapGestureHandler onHandlerStateChange={onHandlerStateChange}>
            <Animated.View style={{ flex: 1}}>
                <Animated.View style={{ flex: 1, position: "absolute", bottom: bottom }}>
                    <Text> some text</Text>
                </Animated.View>
            </Animated.View>
        </TapGestureHandler>
    );
};

export default Comp;

*const onHandlerStateChange = block([set(bottom, add(bottom, 10))]); ※ここでは使えません

4

1 に答える 1