多页面应用程序 - 与原生基础做出本机反应

问题描述 投票:1回答:2

我首次尝试使用本机的任何类型的应用程序。我使用原生基础的组件/样式。我已经设法得到一个非常基本的页面,但我想弄清楚我是如何从这个转到一个页面,当从页脚说出来时,它移动到不同的页面。

import React, { Component } from 'react';
import { Navigator, Container, Content, Header, Title, Button, Left, Right, Body, Icon, Footer, FooterTab } from 'native-base';
import { Col, Row, Grid } from 'react-native-easy-grid';

import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

export default class AwesomeNativeBase extends Component {
  render() {
    return (
      <Container>
          <Header>          
              <Body>
                  <Title>Kays Hairdressing</Title>
              </Body>
          </Header>
          <Content>
            <Grid>
                <Col style={{ backgroundColor: '#635DB7', height: 550 }}></Col>
                <Col style={{ backgroundColor: '#00CE9F', height: 550  }}></Col>
            </Grid>
          </Content>
          <Footer>
            <FooterTab>
                <Button>
                    <Text>Bookings</Text>
                    <Icon name="ios-book-outline" />
                </Button>
                <Button>
                    <Text>Blockout</Text>
                    <Icon name="ios-calendar-outline" />
                </Button>
            </FooterTab>
          </Footer>
      </Container>
    );
  }
}

AppRegistry.registerComponent('AwesomeNativeBase', () => AwesomeNativeBase);

我已经解决了我需要使用'navigator'选项,但我无法让它工作,因为我不确定类在这个设置中是如何工作的。

react-native native-base
2个回答
2
投票

您应该使用Tabs组件进行屏幕导航(使用tabBarPosition来定义标签放置),请参阅docs

我不知道为什么FooterTab仍然不支持屏幕导航。


1
投票

使用导航库,如React NavigationReact native navigation

React Navigation是一个基于JavaScript的选项,而React本机导航是一个更原生的实现

试一试

© www.soinside.com 2019 - 2024. All rights reserved.