|
@@ -15,15 +15,18 @@ class PushedScreen extends Component {
|
15
|
15
|
this.onClickPush = this.onClickPush.bind(this);
|
16
|
16
|
this.onClickPop = this.onClickPop.bind(this);
|
17
|
17
|
this.onClickPopPrevious = this.onClickPopPrevious.bind(this);
|
|
18
|
+ this.onClickPopToFirstPosition = this.onClickPopToFirstPosition.bind(this);
|
18
|
19
|
}
|
19
|
20
|
render() {
|
|
21
|
+ const stackPosition = this.getStackPosition();
|
20
|
22
|
return (
|
21
|
23
|
<View style={styles.root}>
|
22
|
24
|
<Text style={styles.h1}>{`Pushed Screen`}</Text>
|
23
|
|
- <Text style={styles.h2}>{`Stack Position: ${this.getStackPosition()}`}</Text>
|
|
25
|
+ <Text style={styles.h2}>{`Stack Position: ${stackPosition}`}</Text>
|
24
|
26
|
<Button title="Push" onPress={this.onClickPush} />
|
25
|
27
|
<Button title="Pop" onPress={this.onClickPop} />
|
26
|
28
|
<Button title="Pop Previous" onPress={this.onClickPopPrevious} />
|
|
29
|
+ {stackPosition === 3 && <Button title="Pop To Stack Position 1" onPress={this.onClickPopToFirstPosition} />}
|
27
|
30
|
<Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
|
28
|
31
|
</View>
|
29
|
32
|
);
|
|
@@ -47,6 +50,10 @@ class PushedScreen extends Component {
|
47
|
50
|
Navigation.on(_.last(this.props.previousScreenIds)).pop();
|
48
|
51
|
}
|
49
|
52
|
|
|
53
|
+ onClickPopToFirstPosition() {
|
|
54
|
+ Navigation.on(this.props.id).popTo(this.props.previousScreenIds[0]);
|
|
55
|
+ }
|
|
56
|
+
|
50
|
57
|
getStackPosition() {
|
51
|
58
|
return this.props.stackPosition || 1;
|
52
|
59
|
}
|