react-navigation-header-buttons
react-navigation-header-buttons copied to clipboard
how to React.forwardRef to HeaderButton
hi guys, in need to pass ref to HeaderButton to get Touchable references, it could be possible to export HeaderButton as forwardRef,
Thanks !!
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 https://github.com/software-mansion/react-native-gesture-handler/pull/1069 to be released
hi @vonovak, great news thanks for your feedback, keep in touch 👍
@outaTiME hi, out of curiosity, may I ask why you need the refs? Thanks!
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>
@outaTiME hi! I updated the touchables implementation but I don't have time for the ref change; feel free to open a RP, thanks!