导航栏-React Native

jvr*_*esx 3 navigationbar react-native react-native-android

我正在使用React Native创建一个移动应用程序,我决定使用来自网站“ https://github.com/beefe/react-native-navigation-bar ” 的导航栏,但我不知道如何使用它在我的代码中。

我希望您向我发送网站“ https://github.com/beefe/react-native-navigation-bar ” 的导航栏示例。

Ngu*_*àng 6

我认为您在问之前应该尝试仔细阅读。

该站点清楚地显示了如何使用此组件。只需2个步骤:

  1. 安装软件包。

    npm install react-native-navigation-bar --save
    
    Run Code Online (Sandbox Code Playgroud)
  2. 导入和使用。按您喜欢的方式更改属性。

    import React, { Component } from 'react';
    import { Text, View } from 'react-native';
    
    import NavigationBar from 'react-native-navigation-bar';
    
    export default class Example extends Component {
      render() {
        return (
          <View>
            <NavigationBar 
              title='Main title'
              height={50}
              leftButtonTitle='back'
              rightButtonTitle='forward'
            />
            <Text>ABC</Text>
          </View>
        );
      }
    }
    
    Run Code Online (Sandbox Code Playgroud)

  • 我收到此错误:undefined不是对象(正在评估'_react.PropTypes.string') (2认同)