Using native method measure on topbar custom component returns 0 for x, y, pageX and pageY.
Issue Description
I'm trying to implement a popover menu when I click a button and I need to get its position on screen to open an overlay.
Any button from a screen works fine and results with correct positions, but it does not seem to work when the buttons are in the topbar.
It always results with 0 for all props except width and height.
Steps to Reproduce / Code Snippets / Screenshots
export class IconButton extends React.PureComponent<IconButtonProps> {
private _ref:React.RefObject<View> = React.createRef();
public render() {
return (
<View ref={this._ref} onLayout={(event:LayoutChangeEvent) => {
if (this._ref.current) {
this._ref.current.measure((x:number, y:number, width:number, height:number, pageX:number, pageY:number) => {
console.log(x, y, width, height, pageX, pageY);
})
}
}}>
</View>
);
};
};
Then using it like this in topbar right buttons:
{
id: ENavElement.SIDE_MENU_BTN,
component: {
id: ENavElement.SIDE_MENU_BTN,
name: ENavElement.ICON_BTN,
passProps: {
icon: EIcon.BURGER
}
}
}
The console.log resuIt is: 0, 0, 25.14285659790039, 20.571428298950195, 0, 0
Environment
- React Native Navigation version: 2.12.0
- React Native version: 0.57.8
- Platform(s) (iOS, Android, or both?): Android
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator, Debug
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.