In react-native how to create table view with vertical as well as horizontal scroll - Stack Overflow

In a react-native, I have to create a table View which should match the following conditions:The first

In a react-native, I have to create a table View which should match the following conditions:

  1. The first row should be the header where the First & last Items should be sticky and items in the centre can be horizontally scrollable, also, the header should be sticky for vertical scroll.
  2. From the second row onwards we will have actual data where again, the First & last Items should be sticky and items in the centre can be horizontally scrollable.
  3. Other than the header table, it should be vertically scrollable including the first & last item of each row, also when scrolling vertically it should look like the complete row is scrolling together.
  4. Also when the user scrolls horizontally all the items with the header should scroll together and the first & last item of each row should stick at their position.

I can achieve all but the table is either vertically scrollable or horizontally scrollable.

I don't want to use ref because with ref scrolling is not synchronised. Below I am sharing a video of how it's currently working. The only problem is horizontal scrolling which is not synchronised.

Scrolling Table In React-Native

In a react-native, I have to create a table View which should match the following conditions:

  1. The first row should be the header where the First & last Items should be sticky and items in the centre can be horizontally scrollable, also, the header should be sticky for vertical scroll.
  2. From the second row onwards we will have actual data where again, the First & last Items should be sticky and items in the centre can be horizontally scrollable.
  3. Other than the header table, it should be vertically scrollable including the first & last item of each row, also when scrolling vertically it should look like the complete row is scrolling together.
  4. Also when the user scrolls horizontally all the items with the header should scroll together and the first & last item of each row should stick at their position.

I can achieve all but the table is either vertically scrollable or horizontally scrollable.

I don't want to use ref because with ref scrolling is not synchronised. Below I am sharing a video of how it's currently working. The only problem is horizontal scrolling which is not synchronised.

Scrolling Table In React-Native

Share Improve this question asked Nov 20, 2024 at 11:38 Sandeep MishraSandeep Mishra 6842 gold badges9 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Here's how you can go about it

divide layout:

  • first row would be its own component with a scroll view, and fixed label
  • remaining data in a flatlist, that renders custom data with fixed dates

synchronise list scrolls to enable body scrolling

here's a link to a working example - https://snack.expo.dev/gJJCLlFS0dghuUv6XUlx7

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742361055a4429401.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信