【发布时间】:2021-07-11 19:12:08
【问题描述】:
我尝试了所有以前的解决方案,但没有人解决我的问题,我正在尝试解决 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>
);
}
我安装的包
"react-native-reanimated": "^2.1.0",
我已经完成了他们所有的安装过程 React Native Reanimated instalation guide
【问题讨论】:
-
你解决了这个问题吗?
标签: react-native-reanimated-v2