android - 如何在水平平面列表中显示箭头以指示存在不可见的 ScrollView 内容

标签 android react-native react-native-flatlist

在我的 ReactNative 应用程序中,我有一个 FlatList 显示服务的可用性作为时间线。 在实现这一点时,只有一部分 ScrollView 在屏幕上可见。如何设置箭头指示器以让用户知道此 View 是 ScrollView 并且有更多内容可以滚动。

FlatList is as shown in this picture. Here content after 4am is invisible and User is unaware that there is more content to scroll

最佳答案

我通过添加更多 View 和 FlatList 来实现这一点。我在平面列表之前添加了线性渐变 View ,从白色开始到部分透明的白色。在 flatlist 的末尾也是相同的翻转 View 。 对于线性渐变,我使用了 react-native-linear-gradient。

最终渲染看起来像

<View style={{ flexDirection: 'row' }}>

    <LinearGradient
        start={{ x: 0, y: 0 }}
        end={{ x: 1, y: 0 }}
        colors={["#FFFFFF00", "#FFFFFFFF"]}
        style={{
            height: "100%",
            width: 32,
        }}
    />

    <FlatList
        data={this.state.timeSlotes}
        renderItem={({ item, index }) => {
            return <TimeSloteItem data={item} />;
        }} />

    <LinearGradient
        start={{ x: 0, y: 0 }}
        end={{ x: 1, y: 0 }}
        colors={["#FFFFFF", "#FFFFFF00"]}
        style={{
            height: "100%",
            width: 32,
        }}
    />
</View>

关于android - 如何在水平平面列表中显示箭头以指示存在不可见的 ScrollView 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55205746/

相关文章:

java - 安卓单元测试 : How to mock a listener that is sent as argument to an asynchronous method?

react-native - react 原生平面列表导航

javascript - FlatList 未正确呈现

android - 如何将自定义条目添加到生成的 Android MANIFEST.MF

android - 协议(protocol)设计

Android_Install 版本降级失败

react-native - 弯曲 :1 makes my view disapear in react-native

javascript - 从 React native 应用程序打开外部应用程序(单击按钮)

android - 如何在 TimePickerAndroid 中为 react native 设置最短日期

android - 当水平模式(RTL)下数据太大时,FlatList 会自动滚动到第一个