我正在开发一个使用expo的应用程序,并试图设计我的按钮。然而,在另一个堆栈溢出问题中,建议切换到TouchableOpacity,在react-native TouchableOpacity page上,他们建议切换到称为Pressable的未来经验证的解决方案。现在我尝试在我的组件中实现可按压组件,就像在react-native Pressable page上一样,我的代码如下所示:
import { View, Text, Button, Pressable } from 'react-native';
export default function OrderDetail( {someProps} ){
.
.
.
<Pressable
onPress={() => {
setCategoryName('information')
}}
style={({ pressed }) => [
{
backgroundColor: pressed
? 'rgb(210, 230, 255)'
: 'white'
},
styles.wrapperCustom
]}>
{({ pressed }) => (
<Text style={styles.text}>
{pressed ? 'Pressed!' : 'Press Me'}
</Text>
)}
</Pressable>
.
.
.
}
但是我得到了这个错误:
发布于 2020-07-22 21:56:06
Pressable在Expo中还不可用,因为expo不支持React Native v0.63 (还没有)。
https://stackoverflow.com/questions/63043385
复制相似问题