Tutorial does not show, this.props.start is undefined.
See original GitHub issueCurrent 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.1react-native
: 0.55.4react-native-svg
: ^6.3.1react-navigation
: ^2.11.2
Possible Solution
It could be related to react-navigation
, I think, but not sure,
Additional context/Screenshots
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Tutorial does not show, this.props.start is undefined. · Issue #97
Current Behavior Tutorial does not show when involve this.props.start() ; Input Code ; Expected behavior/code. The tutorial should be shown when ...
Read more >How to fix "TypeError: this.props is undefined" in React
Look at the error: "TypeError: this.props.main is undefined" . It means that you don't have a 'main' property inside props object.
Read more >React Top-Level API
Unlike the shouldComponentUpdate() method on class components, the areEqual function returns true if the props are equal and false if the props are...
Read more >How to use Props in React - Robin Wieruch
There is no way to pass props up to a parent component from a child component. We will revisit this caveat later in...
Read more >Docs • Svelte
It will be used if the component's consumer doesn't specify the prop on the component ... Svelte will see the value of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hoanghcmus Try wrapping a
react-native
View component and withwalkthroughable
and then use thatwalkthroughable
View to wrap your desired elements.Instead of
const CopilotText = walkthroughable(Text);
doconst CopilotText = walkthroughable(View);