|
@@ -17,6 +17,7 @@ class ModalScreen extends Component {
|
17
|
17
|
this.onClickDismissPreviousModal = this.onClickDismissPreviousModal.bind(this);
|
18
|
18
|
this.onClickDismissUnknownModal = this.onClickDismissUnknownModal.bind(this);
|
19
|
19
|
this.onClickDismissAllPreviousModals = this.onClickDismissAllPreviousModals.bind(this);
|
|
20
|
+ this.onClickDismissFirstInStack = this.onClickDismissFirstInStack.bind(this);
|
20
|
21
|
}
|
21
|
22
|
render() {
|
22
|
23
|
return (
|
|
@@ -28,6 +29,7 @@ class ModalScreen extends Component {
|
28
|
29
|
<Button title="Dismiss Unknown Modal" onPress={this.onClickDismissUnknownModal} />
|
29
|
30
|
{this.getPreviousModalId() ? (<Button title="Dismiss Previous Modal" onPress={this.onClickDismissPreviousModal} />) : undefined}
|
30
|
31
|
{this.props.previousModalIds ? (<Button title="Dismiss ALL Previous Modals" onPress={this.onClickDismissAllPreviousModals} />) : undefined}
|
|
32
|
+ {this.props.previousModalIds ? (<Button title="Dismiss First In Stack" onPress={this.onClickDismissFirstInStack} />) : undefined}
|
31
|
33
|
<Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
|
32
|
34
|
|
33
|
35
|
</View>
|
|
@@ -39,7 +41,7 @@ class ModalScreen extends Component {
|
39
|
41
|
name: 'navigation.playground.ModalScreen',
|
40
|
42
|
passProps: {
|
41
|
43
|
modalPosition: this.getModalPosition() + 1,
|
42
|
|
- previousModalIds: _.concat([], this.props.previousModalIds, this.props.id)
|
|
44
|
+ previousModalIds: _.concat([], this.props.previousModalIds || [], this.props.id)
|
43
|
45
|
}
|
44
|
46
|
});
|
45
|
47
|
}
|
|
@@ -59,7 +61,14 @@ class ModalScreen extends Component {
|
59
|
61
|
onClickDismissAllPreviousModals() {
|
60
|
62
|
_.forEach(this.props.previousModalIds, (id) => Navigation.dismissModal(id));
|
61
|
63
|
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+ onClickDismissFirstInStack() {
|
|
67
|
+ console.log('RANG', 'getFirstInStackModalId', _.head(this.props.previousModalIds));;
|
|
68
|
+ Navigation.dismissModal(_.head(this.props.previousModalIds));
|
|
69
|
+ }
|
62
|
70
|
|
|
71
|
+
|
63
|
72
|
getModalPosition() {
|
64
|
73
|
return (this.props.modalPosition || 1);
|
65
|
74
|
}
|