Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to React.forwardRef to HeaderButton #78

Open
outaTiME opened this issue Jun 30, 2020 · 5 comments
Open

how to React.forwardRef to HeaderButton #78

outaTiME opened this issue Jun 30, 2020 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@outaTiME
Copy link

hi guys,
in need to pass ref to HeaderButton to get Touchable references, it could be possible to export HeaderButton as forwardRef,

Thanks !!

@vonovak
Copy link
Owner

vonovak commented Jun 30, 2020

hello and thanks for the comment!

need to pass ref to HeaderButton to get Touchable references

I'm planning to make a change to the underlying touchables soon, and I'll do it then. I'm waiting for software-mansion/react-native-gesture-handler#1069 to be released

@outaTiME
Copy link
Author

hi @vonovak, great news thanks for your feedback, keep in touch 👍

@vonovak
Copy link
Owner

vonovak commented Aug 14, 2020

@outaTiME hi, out of curiosity, may I ask why you need the refs? Thanks!

@outaTiME
Copy link
Author

outaTiME commented Aug 14, 2020

hi @vonovak, good one question 😄 I was needing this to pass the reference to the anchor of the ActionSheetIOS when iPad, but I solved it as follows:

<MaterialHeaderButtons>
  <Item
    title="more"
    iconName="more-horiz"
    onPress={(evt) => {
      const anchor = findNodeHandle(evt.nativeEvent.target);
      const options = ['Delete', 'Save', 'Cancel'];
      const destructiveButtonIndex = 0;
      const cancelButtonIndex = 2;
      showActionSheetWithOptions(
        {
          options,
          cancelButtonIndex,
          destructiveButtonIndex,
          // iPad only
          anchor,
        },
        (button_index) => {
          // action
        }
      );
    } 
  />
</MaterialHeaderButtons>

@vonovak
Copy link
Owner

vonovak commented Oct 18, 2020

@outaTiME hi! I updated the touchables implementation but I don't have time for the ref change; feel free to open a RP, thanks!

@vonovak vonovak added the help wanted Extra attention is needed label Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants