React Native base fab作为单个按钮

时间:2017-11-04 21:44:47

标签: react-native native-base

您好我使用本机反应并反应原生基础,我尝试使用FAB作为滚动到顶部按钮 - 其中没有其他操作按钮 - 。可以理解我可以使用按钮,但FAB设置起来相当简单。

我有以下代码:

  <Fab
    active="true"
    containerStyle={{ }}
    style={{ backgroundColor: 'rgba(0, 0, 0)' }}
    position="bottomRight"
    onPress={this.scrollToTop.bind(this)}>
    <Icon name="ios-arrow-up" />
  </Fab>

当我按下FAB时,不仅没有任何事情发生,任何可点击的东西&#34;它背后会被触发。有什么想法吗?

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题并通过将FAB放在Container而不是Content中来解决了这个问题,如此链接中所述:http://discuss.nativebase.io/t/how-to-use-a-fab-in-page-with-a-list/237/3

    <Container>
     <Content>
       <List />
       <AnyComponent />
     </Content>
     <Fab/>
   </Container>

答案 1 :(得分:0)

为什么不使用简单的视图?

<View style={{
   position: 'absolute',
   bottom: 30,
   right: 30,
   width: 100, 
   height: 100,
   borderRadius: 50
}}>
<Icon/>
</View>