react-native-sortable-list icon indicating copy to clipboard operation
react-native-sortable-list copied to clipboard

Access to hooks like onLayout, onContentSizeChange, onScroll?

Open isaachinman opened this issue 7 years ago • 3 comments

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.

isaachinman avatar Apr 05 '18 12:04 isaachinman

Need this too!

cellis avatar Jun 12 '18 23:06 cellis

Need.

dNadiia avatar Nov 02 '18 09:11 dNadiia

added in #157

Peretz30 avatar Feb 25 '20 09:02 Peretz30