我想将小吃栏粘贴在屏幕底部,而不是滚动视图的底部,我该怎么做?
Snackbar 是从react-native-snackbar-component 导入的。 我已经尝试使用小吃栏定位绝对组件并设置顶部和底部 - 但没有成功。
<ScrollView
contentContainerStyle={{ paddingBottom: 20 }}
className="flex-1 bg-neutral-900">
<SafeAreaView
className={
"absolute z-20 w-full flex-row justify-between items-center px-4 " +
topMargin
}>(..) />
<SnackBar
visible={snackbarVisible}
position="bottom"
textMessage={snackbarText}
actionHandler={() => setSnackbarVisile(false)}
actionText="Dismiss"
autoHidingTime={2000}/>
function Snackbar() {
setSnackbarVisile(!snackbarVisible);
setSnackbarText('Added to favourites')}
可以尝试
<View style ={{flex:1}}>
<ScrollView
contentContainerStyle={{ paddingBottom: 20 }}
className="flex-1 bg-neutral-900">
<SafeAreaView
className={
"absolute z-20 w-full flex-row justify-between items-center px-4 " +
topMargin
}>(..) />
</ScrollView>
<SnackBar
visible={snackbarVisible}
position="bottom"
textMessage={snackbarText}
actionHandler={() => setSnackbarVisile(false)}
actionText="Dismiss"
autoHidingTime={2000}/>
</View>