我想在React Native中添加浮动按钮。我使用了
React Native Paper 提供了浮动按钮: https://callstack.github.io/react-native-paper/fab.html#usage 如果我使用
在截图中,您可以看到按钮没有浮动在内容上方,而是显示在屏幕底部。
截图:
position: absolute
,但是它显示在屏幕底部即内容结束的地方。我想将浮动按钮显示在右下角,并且在用户上下滚动屏幕时可见。React Native Paper 提供了浮动按钮: https://callstack.github.io/react-native-paper/fab.html#usage 如果我使用
position: 'fixed'
,会出现错误:https://imgur.com/a/JZJ7Pbl
代码:<ScrollView>
// Some other View components
<FAB
style={styles.fab}
small
color="#00d048"
icon="add"
/>
</ScrollView>
CSS:
fab: {
position: 'absolute',
right: 0,
bottom: 0,
}
在截图中,您可以看到按钮没有浮动在内容上方,而是显示在屏幕底部。
截图:
![enter image description here](https://istack.dev59.com/XrAb9.webp)
position: fixed
。如果更新的方法适用于您,请告诉我。 - SiavasjustifyContent: space-between
而不是flex-end
,并从fab
中删除margin-right
。 - Siavas