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

Layout issue when using `react-native-navigation`

Open SpaghettiC0des opened this issue 6 years ago • 5 comments

Current Behavior Similar to #100, it is not displayed properly on android devices Input Code

  • NONE

Expected behavior/code It should properly enclose the wrap component when travelling from step A to step B, just like the gif example on the README.

Environment

  • Device: Asus Zenfone 5z
  • OS: Android Pie
  • react-native-copilot: 2.4.1
  • react-native: 0.58.4
  • react-native-svg: 9.2.4

Possible Solution

  • NONE

Additional context/Screenshots See #100

SpaghettiC0des avatar Feb 28 '19 11:02 SpaghettiC0des

@mohebifar Hi, any updates on this?

SpaghettiC0des avatar Aug 19 '19 10:08 SpaghettiC0des

I can recreate this issue as well. androidStatusBarVisible: true helps moves it down but only marginally. It seems it doesn't take the topbar into account.

Have you found any workaround?

tastyqbit avatar Apr 07 '20 13:04 tastyqbit

@tastyqbit Could I see an example of how you're implementing the function from your Pull Request? I know this fix will work for me, because if I manually insert 26 as verticalOffset (statusBarHeight value) it fixes the android issue for the device.

I've tried many things, but this is as close as I have gotten:

copilot({
  verticalOffset: async () => (await Navigation.constants()).statusBarHeight,
  animated: true,
  overlay: 'svg',
  tooltipComponent: Tooltip,
  tooltipStyle: tooltipStyle,
  stepNumberComponent: StepNumber,
})

and I keep getting errors similar to this: Screen Shot 2020-04-14 at 1 31 03 PM

Thanks in advance for any help!

Raymond-Cox avatar Apr 14 '20 17:04 Raymond-Cox

@Raymond-Cox Here is what I have:

const copilotConfig = {
  verticalOffset: async () => {
    if (Platform.OS === "android") {
      const { statusBarHeight, topBarHeight } = await Navigation.constants();
      return topBarHeight + statusBarHeight;
    }
    return 0;
  },
  stepNumberComponent: View,
  androidStatusBarVisible: Platform.OS === "android",
  labels: { finish: GeneralCopilotStrings.finish }
};

I think I remember getting that error at some point but I cant remember at what point. Make sure you are using my library and maybe try without svg?

tastyqbit avatar Apr 15 '20 11:04 tastyqbit

@tastyqbit I didn't realize your PR was to your fork, not the main repo. After switching to your fork can confirm this works. Thanks mate!

Raymond-Cox avatar Apr 15 '20 16:04 Raymond-Cox