react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

fix: switch ref forwarding

Open arasfeld opened this issue 4 years ago • 3 comments
trafficstars

Summary

The Switch component was converted from a React class component to a functional component between v3 and v4, but was not converted to use React.forwardRef(). Because of this, Switch components do not accept refs in v4.

Here is a bug for the same issue that got closed in December due to inactivity: https://github.com/callstack/react-native-paper/issues/2408

Test plan

  1. Create a Switch component and provide a ref as a prop
  2. Call a native function on the ref like .focus()
  3. Verify the native function is successful and no React warnings/errors are thrown

arasfeld avatar Jun 03 '21 19:06 arasfeld

Hey @arasfeld, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

callstack-bot avatar Jun 03 '21 19:06 callstack-bot

@arasfeld thanks for opening this PR. I tried to pass a ref to a switch in the example example/src/Examples/SwitchExample.tsx but I got focus is not a function Does it work in this RN version?

brunohkbx avatar Jun 15 '21 14:06 brunohkbx

Hello 👋, this pull request has been open for more than 2 months with no activity on it. If you think this is still necessary with the latest version, please comment and ping a maintainer to get this reviewed, otherwise it will be closed automatically in 7 days.

github-actions[bot] avatar Aug 15 '21 00:08 github-actions[bot]