Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swipable content in header #425

Open
CharlieMaslechko opened this issue Jun 23, 2024 · 3 comments
Open

Swipable content in header #425

CharlieMaslechko opened this issue Jun 23, 2024 · 3 comments
Labels
question Further information is requested

Comments

@CharlieMaslechko
Copy link

Let's say I have a horizontal Flatlist of data I want to render in the header, below this I have N tabs of vertical flatlist data. Diving into the library it looks like the header is absolutely positioned on top of the pager view which is why the pointer events are important to handle. Therefor if you have a swipable item in the header it will take the touch events. I was thinking of forking and implementing react native gesture handler to be able to have more granular control of touch events which would allow for more complex gestures in the header. Does anyone know if there is a way to have horizontal flatlist in the header? Love the library help appreciated!

+-------------------------------+
|          iPhone Screen        |
+-------------------------------+
|            Header             |   <-- Header Component
|-------------------------------|
|<-- Horizontal Scrollable -->  |   <-- Horizontal FlatList
|  [ Image ]  [ Image ]  [ ... ]| 
|-------------------------------|
| [Tab 1]      |     Tab 2      |   <-- Tabs (Tab 1 is focused)
|---------------|----------------|
|  Item 1       |  Item 1        |   <-- Vertical FlatLists (Tab 1 content is shown)
|  Item 2       |  Item 2        |
|  Item 3       |  Item 3        |
|  ...          |  ...           |
+-------------------------------+
@CharlieMaslechko CharlieMaslechko added the question Further information is requested label Jun 23, 2024
@matheusmatos
Copy link

It's possible using pointerEvents='box-none'on the Header component, and pointerEvents=auto on the horizontal FlatList. The problem is that you will not be able to scroll the vertical FlatList touching the horizontal FlatList (which makes sense, imho). Take a look at the Scroll On Header section in the readme.

@useIyy
Copy link

useIyy commented Jul 3, 2024

Has the problem been solved? I have the same need.

@iliapnmrv
Copy link

iliapnmrv commented Oct 9, 2024

@matheusmatos Hey! I've read readme section and I have exactly your suggestion but it does not work for me. Can you please help?

renderHeader={
  return(
    <View pointerEvents="box-none">
        <View>
           <Gallery imageFormat="square" images={images} />
        </View>
        ...
    </View>
  )
}
<View>
  <FlatList
    pointerEvents="auto"
    data={data}
    horizontal
    pagingEnabled
     renderItem={() => {
        return (
          <>
            <Image
              style
              source
            />
          </>
        );
    }}
 />
</View>

it only scrolls horizontally in flatlist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants