美文网首页
FlatList的悬浮setionHeader,ios和andr

FlatList的悬浮setionHeader,ios和andr

作者: sunny635533 | 来源:发表于2018-07-20 18:08 被阅读182次

    /**

         * An array of child indices determining which children get docked to the

        * top of the screen when scrolling. For example passing

        * `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the

        * top of the scroll view. This property is not supported in conjunction

        * with `horizontal={true}`.

        */

        stickyHeaderIndices?: number[];

    就是这个属性,当滑动列表的时候,能让某个Item悬浮在顶部。

    例子:

    <FlatList         

             data={list}

              ListHeaderComponent={this.flatListHeader}

              renderItem={({ item }) => this.renderItem(item)}

              keyExtractor={(item, index) => item.classifyId + index}

              stickyHeaderIndices={[1]}

            />

    相关文章

      网友评论

          本文标题:FlatList的悬浮setionHeader,ios和andr

          本文链接:https://www.haomeiwen.com/subject/sybqmftx.html