Sticky Component inside scrollview

后端 未结 5 402
逝去的感伤
逝去的感伤 2021-01-30 11:03

I\'m trying to build a a sticky component like this app

http://www.screencapture.ru/file/E88F08Fc

Deals, Products, Events tabs/segmentControl are actually start

5条回答
  •  悲&欢浪女
    2021-01-30 11:45

    It is very simple with ScrollView component. There is already something called "stickyHeaderIndices" which takes the index of child to make sticky.In following code, content inside renderComponent2 stays sticky when you scroll.

    
      {this.renderComponent1()}
      {this.renderComponent2()}
      {this.renderComponent3()}
     
    

    Refer: https://facebook.github.io/react-native/docs/scrollview.html#stickyheaderindices

提交回复
热议问题