小编are*_*rec的帖子

React Native 手势处理程序不适用于 Android 模拟器或 Android 设备

我正在尝试练习使用react-native-gesture-handler. 一切都渲染了,但我无法在屏幕上移动方块。我已经安装了react-native-reanimated适当的插件,清除了缓存并react-native-gesture-handler使用 expo 安装,但它在我的 Android 手机或 Android 模拟器上不起作用。有趣的是,它确实可以在网络浏览器上运行。以下是代码:

import {
    PanGestureHandler,
    PanGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import Animated, {
    useAnimatedGestureHandler,
    useAnimatedStyle,
    useSharedValue,
    withSpring,
} from "react-native-reanimated";

const SIZE = 100.0;
const CIRCLE_RADIUS = SIZE * 2;

type ContextType = {
    translateX: number;
    translateY: number;
};

export default function App() {
    const translateX = useSharedValue(0);
    const translateY = …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-gesture-handler

7
推荐指数
1
解决办法
6702
查看次数