将小吃栏放在屏幕底部,而不是滚动视图

问题描述 投票:0回答:1

我想将小吃栏粘贴在屏幕底部,而不是滚动视图的底部,我该怎么做?

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')}
react-native tailwind-css scrollview snackbar
1个回答
0
投票

可以尝试

    <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>
© www.soinside.com 2019 - 2024. All rights reserved.