Skip to content

Commit bbfdef2

Browse files
committed
example: Added the active flag to the example
1 parent d2b0e15 commit bbfdef2

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

example/App.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import { StyleSheet, Text, Image, View, TouchableOpacity } from 'react-native';
3+
import { StyleSheet, Text, Image, View, TouchableOpacity, Switch } from 'react-native';
44
import { Ionicons } from '@expo/vector-icons';
55

66
import { copilot, walkthroughable, CopilotStep } from '@okgrow/react-native-copilot';
@@ -46,6 +46,13 @@ const styles = StyleSheet.create({
4646
flex: 1,
4747
textAlign: 'center',
4848
},
49+
activeSwitchContainer: {
50+
flexDirection: 'row',
51+
justifyContent: 'space-between',
52+
marginBottom: 20,
53+
alignItems: 'center',
54+
paddingHorizontal: 40,
55+
},
4956
});
5057

5158
class App extends Component {
@@ -56,6 +63,10 @@ class App extends Component {
5663
}).isRequired,
5764
};
5865

66+
state = {
67+
secondStepActive: true,
68+
};
69+
5970
componentDidMount() {
6071
this.props.copilotEvents.on('stepChange', this.handleStepChange);
6172
this.props.start();
@@ -74,12 +85,21 @@ class App extends Component {
7485
</WalkthroughableText>
7586
</CopilotStep>
7687
<View style={styles.middleView}>
77-
<CopilotStep text="Here goes your profile picture!" order={2} name="secondText">
88+
<CopilotStep active={this.state.secondStepActive} text="Here goes your profile picture!" order={2} name="secondText">
7889
<WalkthroughableImage
7990
source={{ uri: 'https://pbs.twimg.com/profile_images/527584017189982208/l3wwN-l-_400x400.jpeg' }}
8091
style={styles.profilePhoto}
8192
/>
8293
</CopilotStep>
94+
<View style={styles.activeSwitchContainer}>
95+
<Text>Profile photo step activated?</Text>
96+
<View style={{ flexGrow: 1 }} />
97+
<Switch
98+
onValueChange={secondStepActive => this.setState({ secondStepActive })}
99+
value={this.state.secondStepActive}
100+
/>
101+
</View>
102+
83103
<TouchableOpacity style={styles.button} onPress={() => this.props.start()}>
84104
<Text style={styles.buttonText}>START THE TUTORIAL!</Text>
85105
</TouchableOpacity>

0 commit comments

Comments
 (0)