question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Vertical Offset on Android

See original GitHub issue

Current Behavior

Tutorial tooltips work on iOS, but on Android they have a - Y offset, which is not the desired behavior.

Input Code

I created a blank RN project with: react-native init CopilotTest, and added these lines to App.js:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';

+import { copilot, walkthroughable, CopilotStep } from '@okgrow/react-native-copilot'

+const CopilotView = walkthroughable(View)
+const CopilotText = walkthroughable(Text)

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
class App extends Component<Props> {

+  componentDidMount() {
+    this.props.start()
+  }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>{instructions}</Text>
+        <CopilotStep text='Test Copilot Step' order={1} name='test'>
+          <CopilotText>Test</CopilotText>
+        </CopilotStep>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

-export default App
+export default copilot()(App)

Expected behavior/code Android should work the same way it does on iOS

Environment

  • Device iOS: iPhone 5 [iOS 10], Simulators: iPhone 6, 7 [iOS 12]

  • Device : Xiaomi Mi A2, Android Studio Emulators [Oreo, Marshmallow]

  • react-native-copilot: GitHub dependency, SHA-1: 13ecbca5c9dc1597bd3a7d83d778ecd1a568eb66

  • react-native: v0.56, v0.57

  • react-native-svg: 8.0.10

Possible Solution I will look into it…

Additional context/Screenshots

iOS (working properly): screen-ios

Android (NOT working properly): screen-android

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

36reactions
mohebifarcommented, Jan 14, 2019

You should do copilot({androidStatusBarVisible: true}).

8reactions
konjoinfinitycommented, Aug 9, 2019

This solution worked for me, tested on iOS and Android:

import { ...,
    Platform
} from 'react-native';

...YourComponent...

export default copilot((Platform.OS === 'ios') ? { androidStatusBarVisible: false } : { androidStatusBarVisible: true })(YourComponentNameHere);
Read more comments on GitHub >

github_iconTop Results From Across the Web

mohebifar/react-native-copilot - Vertical Offset on Android
Tutorial tooltips work on iOS, but on Android they have a - Y offset , which is not the desired behavior. Input Code....
Read more >
Android spinner vertical offset changed - Stack Overflow
Try the View.Invisible instead of View.Gone because its taking its space after. This will help you to fix the overlaying problem ;). –...
Read more >
Offset - Android Developers
For example, the top-left position of children in the RenderBox protocol is typically represented as an Offset from the top left of the...
Read more >
Firefox/Android and paired mouse - vertical offset bug - YouTube
Bug in Firefox/Android with a paired/external mouse - when moving mouse, hit testing (to fire mouseover/mouseenter/mouseleave/mouseout) has a vertical ...
Read more >
[Bugs] - CollectionView,When I use ScrollTo, VerticalOffset ...
Bug 1. When I use mycollectionview.ScrollTo (0) or mycollectionview.ScrollTo (0, animate: true), VerticalOffset increments its value · Bug 2
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found