[英]React Native Chrome Custom Tabs is not working
I want to add react-native-custom-tabs
in my project, but problem is that It's showing我想在我的项目中添加react-native-custom-tabs
,但问题是它正在显示
cannot read property
openURL
of undefined.无法读取未定义的属性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)
}
}
}
I installed it using yarn add react-native-custom-tabs then I linked it with react-native link react-native-custom-tabs我使用 yarn add react-native-custom-tabs 安装了它,然后我将它与 react-native link react-native-custom-tabs 链接起来
Try importing like import {CustomTabs} from 'react-native-custom-tabs';
尝试像import {CustomTabs} from 'react-native-custom-tabs';
一样import {CustomTabs} from 'react-native-custom-tabs';
instead of import CustomTabs from 'react-native-custom-tabs';
而不是import CustomTabs from 'react-native-custom-tabs';
hope it helps.希望能帮助到你。 feel free for doubts随意怀疑
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.