【问题标题】:How to center SearchBar with one button on header NativeBase如何在标题 NativeBase 上使用一个按钮使 SearchBar 居中
【发布时间】:2018-10-28 15:36:30
【问题描述】:

尝试使用 nativebase 将搜索栏与标题右侧的菜单按钮居中。代码如下:

    <Header>
        <Body>
            <Button style={styles.searchButton} onPress={() => this.onSearchPress()} >
            	<Text>Search Service</Text>
          	</Button>
        </Body>
        <Right>
            <Icon name='menu' style={styles.drawerIcon} onPress={()=> navigation.openDrawer()} />
        </Right>
    </Header>

如何在全宽居中定位?

【问题讨论】:

    标签: css reactjs react-native native-base


    【解决方案1】:

        <Header>
          <Left/>
            <Body>
                <Button style={styles.searchButton} onPress={() => this.onSearchPress()} >
                	<Text>Search Service</Text>
              	</Button>
            </Body>
            <Right>
                <Icon name='menu' style={styles.drawerIcon} onPress={()=> navigation.openDrawer()} />
            </Right>
        </Header>

    【讨论】:

    • 如果可以在头文件中检查,左右两边都有保留空间
    猜你喜欢
    • 1970-01-01
    • 2021-07-21
    • 1970-01-01
    • 2019-09-07
    • 2021-08-22
    • 2019-09-09
    • 1970-01-01
    • 2017-03-18
    • 1970-01-01
    相关资源
    最近更新 更多