我目前正在尝试从原生框架中实现浮动操作按钮 (FAB)。我只是简单地复制了代码,并onPress
在其中一个子按钮(在本例中为 Facebook-Logo)添加了一个方法。但是,这onPress
是在我单击 FAB 按钮时触发的,而不是在单击 FAB 按钮后应出现的 facebook 按钮。
简而言之:所需的行为:1.点击FAB按钮2.由于数字1,让facebook按钮出现3.点击facebook按钮触发 onPress
我得到的行为: 1. 单击 FAB 按钮 2.onPress
触发 facebook 按钮中的定义
我并没有真正更改代码中的任何内容,如下所示:
<Fab
active={this.state.fabActive}
direction="up"
containerStyle={{ marginLeft: 10 }}
style={{ backgroundColor: '#5067FF' }}
position="bottomRight"
onPress={() => this.setState({ feedbackComponentVisible: !this.state.fabActive })}>
<Icon name="share" />
<Button style={{ backgroundColor: '#34A34F' }}>
<Icon name="logo-whatsapp" />
</Button>
<Button style={{ backgroundColor: '#3B5998' }} onPress={() => this.setState({feedbackComponentVisible: true})}>
<Icon name="logo-facebook" />
</Button>
<Button disabled style={{ backgroundColor: '#DD5144' }}>
<Icon name="mail" />
</Button>
</Fab>