Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

acro5piano
Copy link

@acro5piano acro5piano commented Jul 21, 2020

Problem

Couldn't use innerRef object at least RN 60. For example, ref.current.scrollTo({ y: 1000 }) does not work.

const App = () => {
  const ref = React.useRef()
  const scroll = React.useCallback(() => {
    ref.current && ref.current.getNode().scrollTo({ y: 10000 })
  }, [ref.current])

  return (
    <>
      <Button onPress={scroll} title="let's scroll" />
      <ParallaxScroll ref={ref}><View style={{ height: 1500 }} /></ParallaxScroll>
    </>
  )
}

causes an error ref.current.getNode is not a function

Changes

I didn't understand ref._component, but it should accept ref itself. so I've added forwarding ref if ref._component is not set.

Related Issues

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant