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.

Cannot Show Walkthrough for Header components via React Navigation

See original GitHub issue

I am using react navigation library to manage navigation within my app.I am using this library to enable first time users to get to know the different features of my app.When i try to Wrap a Text element with a CoPilot Step in thestatic navOptionssections(In react-Navigation,this allows the user to customise the header shown on the top of the screen) it gives me an error saying that undefined is not an object(evaluationg this.context._getCurrentStep.)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
DavidBHanbycommented, Nov 7, 2019

@ptgamr I solved this by using an empty view with position absolute. It doesn’t matter that it’s not wrapping around the actual component as the highlighted area within a tour is not functional/touchable anyway.

const WalkthroughableView = walkthroughable(View);

  <CopilotStep text="Here's where to tap to view this screen." order={3} name="actionsButton">
    <WalkthroughableView style={{ position: "absolute", top: -40, left: (dimensions.SCREEN_WIDTH * 0.5) - 25, minHeight: 70, width: 80 }}>
    </WalkthroughableView>
  </CopilotStep>
3reactions
ptgamrcommented, Aug 6, 2019

@mohebifar What’s your recommendation to focus to a button in react-navigation header ? Something like

class HomeScreen extends React.Component {
  static navigationOptions = {
    headerTitle: <LogoTitle />,
    headerRight: (
      <Button
        onPress={() => alert('This is a button!')}
        title="Info"
        color="#fff"
      />
    ),
  };
}

const AppNavigator = createStackNavigator({
  Home: {
    screen: HomeScreen
  }
});

Notice that headerRight is not render as children of HomeScreen… but it will render within react-navigation context

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring the header bar - React Navigation
Using params in the title​. In order to use params in the title, we need to make options prop for the screen a...
Read more >
Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >
Configuring the header bar - React Navigation
Setting the header title​. A screen component can have a static property called navigationOptions which is either an object or a function that...
Read more >
Header buttons | React Navigation
In some cases, components in the header need to interact with the screen component. For this use case, we need to use navigation.setOptions...
Read more >
Common mistakes - React Navigation
Most apps should only ever render one navigator inside of a React component, and this is usually somewhere near the root component of...
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