javascript - React Native Chrome 自定义选项卡不起作用
问题描述
我想react-native-custom-tabs
在我的项目中添加,但问题是它正在显示
无法读取
openURL
未定义的属性。
import CustomTabs from 'react-native-custom-tabs';
class HomeScreen extends Component {
constructor(props) {
super(props);
this.state = {
images: []
};
this.onPressListener = this.onPressListener.bind(this);
}
async onPressListener(event) {
try {
const url = 'https://www.google.com';
CustomTabs.openURL(url);
} catch (error) {
Alert.alert(error.message)
}
}
}
我使用 yarn add react-native-custom-tabs 安装它,然后我将它与 react-native 链接 react-native-custom-tabs 链接
解决方案
尝试导入 likeimport {CustomTabs} from 'react-native-custom-tabs';
而不是import CustomTabs from 'react-native-custom-tabs';
希望能帮助到你。随时怀疑
推荐阅读
- java - JackMidi.eventWrite - 时间参数
- python - aiofile 在后台写入和读取是否避免阻塞正在执行的线程?
- amazon-web-services - AWS CLI:何时需要向 SNS 主题添加权限?
- kotlin - 使用 Kotlin 删除 MutableList 中的项目
- postgresql - 致命:无法连接到主服务器:预期来自服务器的身份验证请求,但收到了 S
- c# - 我可以在不需要用户交互的情况下显示和更新表单吗?
- azure - “this.Client.SubscriptionId”不能为空
- regex - 如何使用powershell编写正则表达式以仅替换tnsnames.ora中的HOST名称
- c++ - 使用 thread_local 维护并发内存缓冲区时发生错误
- reactjs - 无法从父组件调用子组件的函数。错误:“...不是函数”