React Native Chrome自定义选项卡不起作用

SomSankar naskar

我想添加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

高拉夫·罗伊(Gaurav Roy)

尝试像导入import {CustomTabs} from 'react-native-custom-tabs';而不是import CustomTabs from 'react-native-custom-tabs';

希望能帮助到你。毫无疑问

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章