mohebifar / mohebifar/react-native-copilot

Tutorial does not show, this.props.start is undefined.

Open
#97 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needed: more information
Dominant language
TypeScript
Stars
2.4k
Forks
428
PR merge metrics
No merged PRs in 30d

Description

Current Behavior
Tutorial does not show when involve this.props.start()

Input Code

import React, { Component } from 'react';

...
...

import {Spinner, Label, View, StyleProvider, Container, List, ListItem, Left, Thumbnail, Right, Header, Content, Form, Footer, FooterTab, Button, Icon, Badge, Card, CardItem, Text, Body } from 'native-base';

...
...

// TODO: IMport Copilot module
import { copilot, walkthroughable, CopilotStep } from '@okgrow/react-native-copilot';

// TODO: Declare walkthrouh element
const CopilotText = walkthroughable(Text);

class Annoucement extends Component {
  static navigationOptions = {
    title: 'Annoucement',
    drawerIcon: (
      <Icon type='Ionicons' name='md-home' style={globalStyles.sideMenuIcon}/>
    )
  }

  constructor(props) {
    super(props);
    this.state = { 
      ...
      ...
    };
  }

  
....
....


handleStartButtonPress() {
  console.log(`hcmus 2: Props: ${JSON.stringify(this.props.start)}`);  // TODO: Alway undefined
}

componentDidMount() {
  console.log(`hcmus 1: Props: ${JSON.stringify(this.props.start)}`); // TODO: Alway undefined
  this.props.copilotEvents.on('stepChange', this.handleStepChange);

  // TODO: Start tutorial --> NO thing happen. Even if invole props.start fron a button's click even, still not show tutorial, nothing happen
  this.props.start();
}

handleStepChange = (step) => {
  console.log(`hcmus 3: Current step is: ${step.name}`);
}


render() {
    return (

      <StyleProvider style={getTheme(platform)}>
      <Root>
      {/* <CopilotStep text="This is a hello world example!" order={1} name="hello">
          <CopilotText onPress={() => this.handleStartButtonPress()}>Hello world!</CopilotText>
        </CopilotStep> */}
      <Container>
      <CustomHeader title='Dashboard'/>

      // TODO: Here is place define step
      <CopilotStep text="This is a hello_222 world example!" order={2} name="hello_222">
          <CopilotText onPress={() => this.handleStartButtonPress()}>Hello world 2222!</CopilotText>
      </CopilotStep>
     
     ...
     ... 

      </Container>
      {this.state.loading &&
        <View style={globalStyles.loading}>
          <Spinner color='white' />
        </View>
      }
      </Root>
      </StyleProvider>
    );
  }
}

// TODO: export copilot
export default copilot({
  animated: true, // Can be true or false
  overlay: 'svg', // Can be either view or svg
})(Annoucement);

Expected behavior/code
The tutorial should be shown when invoking the this.props.start()

Environment

  • Device: Nexus 5X - Android SDK Simulator
  • OS: Android 9
  • react-native-copilot: ^2.4.1
  • react-native: 0.55.4
  • react-native-svg: ^6.3.1
  • react-navigation: ^2.11.2

Possible Solution
It could be related to react-navigation, I think, but not sure,

Additional context/Screenshots
screenshot_1545207647

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the Annoucement component with the listed React Native, react-native-copilot, and react-navigation versions. Inspect componentDidMount, the this.props.start() call, and the copilot(...) export; done means the tutorial appears when start() is invoked and the stepChange event still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.