Skip to content

Access to hooks like onLayout, onContentSizeChange, onScroll? #101

Open
@isaachinman

Description

@isaachinman

Hi there! I haven't used this module yet, but I would very much like to. I have a pre-existing FlatList solution that I would like to add animation to. Here's what it looks like:

<FlatList
  scrollEventThrottle={16}
  onLayout={(e) => {
    const { height } = e.nativeEvent.layout
    ...checking dimensions and doing some hide/show logic
  }}
  onContentSizeChange={(width, height) => {
    ...checking dimensions and doing some hide/show logic
  }}
  onScroll={(e) => {
    const { layoutMeasurement, contentOffset, contentSize } = e.nativeEvent
    ...checking dimensions and doing some hide/show logic
    }
  }}
  renderItem={({ item }) => {
    if (item.key === 'helper-ui') {
      return (
        <HelperUI
          visible={queueHelperUIVisible}
        />
      )
    }
    return (
      <QueueItem
        {...item}
      />
    )
  }}
/>

Basically, I have some text at the bottom of my list which I am hiding/showing when the user reaches the end of the list for a nice effect. This depends on onLayout, onContentSizeChange, and onScroll. All I need is to be able to respond to these hooks and have the dimensions indicated provided.

You're obviously already using the onScroll event of the ScrollView actually returned by this module. I'm wondering if there's any way for users to access these events as well. If not, I would be happy to put together a PR for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions