且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试在 react-native 中使用 Button 时出错

更新时间:2021-12-08 03:37:55

我刚刚在 0.55 版本上测试了您的代码.这是完全正确的并且工作正常.您的 react-native 版本可能有误.

I've just tested your code on version 0.55. It was perfectly correct and worked fine. I'm likely to have error with your react-native version.

初始化低版本

react-native init --version="react-native@0.55.0" YOUR_APP_NAME

在那之前也试试这个

<Button
    onPress={() => alert('hi')}
    title="Press Me"
 >
   Press Me
</Button>