mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
7f51f9c8a9
Summary: Navigator overrides the `ref` prop of scene components so that it can call `onItemRef` and do internal bookkeeping. With callback refs, we can additionally call the original value of the `ref` prop as long as it's a function (that is, string refs are not supported). Note that the `ref` prop is moved to `reactElement.ref` out of `reactElement.props.ref`, which is why this diff accesses `child.ref`. This diff adds support for callback refs and warns helpfully if a string ref was provided. It should be completely backwards compatible since scenes couldn't have been relying on the `ref` prop before. cc @ericvicenti Closes https://github.com/facebook/react-native/pull/1361 Github Author: James Ide <ide@jameside.com> @public Test Plan: Write a renderScene implementation that puts a callback ref on the root component: ```js renderScene() { return <View ref={component => console.log('yes! this is called')} />; } ```