相关疑难解决方法(0)

Reanimated 2 创建worklet失败,可能是你忘记添加Reanimated的babel插件了?

我尝试了所有以前的解决方案,但没有人解决我的问题,我试图解决它 2 天

这是我的 babel 文件

在此处输入图片说明

我的代码

import React, { useRef, useState } from 'react'
import { View, useWindowDimensions, Button } from 'react-native'
import Animated, { runOnUI } from 'react-native-reanimated';

export default function Login() {
    const { width, height } = useWindowDimensions();
    // const value = useSharedValue(0);
    function someWorklet(greeting: any) {
        'worklet';
        console.log("Hey I'm running on the UI thread");
    }

    return (
        <View style={{ flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
            <Button title="click me" onPress={() => runOnUI(someWorklet)('Howdy')} />
        </View>
    ); …
Run Code Online (Sandbox Code Playgroud)

react-native-reanimated-v2

2
推荐指数
8
解决办法
3019
查看次数

标签 统计

react-native-reanimated-v2 ×1