react-native-navigation 7.25.4-snapshot.584 → 7.25.4-snapshot.585

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,17 +77,22 @@ export class NativeCommandsSender {
77
77
  }
78
78
 
79
79
  dismissModal(_commandId: string, componentId: string, _options?: object) {
80
- return new Promise((resolve) => {
81
- const modal = LayoutStore.getModalById(componentId).getTopParent();
82
- modal.componentDidDisappear();
83
- LayoutStore.dismissModal(componentId);
84
- events.invokeModalDismissed({
85
- componentName: modal.data.name,
86
- componentId: modal.nodeId,
87
- modalsDismissed: 1,
88
- });
89
- resolve(modal.nodeId);
90
- LayoutStore.getVisibleLayout().componentDidAppear();
80
+ return new Promise((resolve, reject) => {
81
+ const modal = LayoutStore.getModalById(componentId);
82
+ if (modal) {
83
+ const modalTopParent = modal.getTopParent();
84
+ modalTopParent.componentDidDisappear();
85
+ LayoutStore.dismissModal(componentId);
86
+ events.invokeModalDismissed({
87
+ componentName: modalTopParent.data.name,
88
+ componentId: modalTopParent.nodeId,
89
+ modalsDismissed: 1,
90
+ });
91
+ resolve(modalTopParent.nodeId);
92
+ LayoutStore.getVisibleLayout().componentDidAppear();
93
+ } else {
94
+ reject(`component with id: ${componentId} is not a modal`);
95
+ }
91
96
  });
92
97
  }
93
98
 
@@ -65,17 +65,23 @@ class NativeCommandsSender {
65
65
  });
66
66
  }
67
67
  dismissModal(_commandId, componentId, _options) {
68
- return new Promise((resolve) => {
69
- const modal = LayoutStore_1.LayoutStore.getModalById(componentId).getTopParent();
70
- modal.componentDidDisappear();
71
- LayoutStore_1.LayoutStore.dismissModal(componentId);
72
- EventsStore_1.events.invokeModalDismissed({
73
- componentName: modal.data.name,
74
- componentId: modal.nodeId,
75
- modalsDismissed: 1,
76
- });
77
- resolve(modal.nodeId);
78
- LayoutStore_1.LayoutStore.getVisibleLayout().componentDidAppear();
68
+ return new Promise((resolve, reject) => {
69
+ const modal = LayoutStore_1.LayoutStore.getModalById(componentId);
70
+ if (modal) {
71
+ const modalTopParent = modal.getTopParent();
72
+ modalTopParent.componentDidDisappear();
73
+ LayoutStore_1.LayoutStore.dismissModal(componentId);
74
+ EventsStore_1.events.invokeModalDismissed({
75
+ componentName: modalTopParent.data.name,
76
+ componentId: modalTopParent.nodeId,
77
+ modalsDismissed: 1,
78
+ });
79
+ resolve(modalTopParent.nodeId);
80
+ LayoutStore_1.LayoutStore.getVisibleLayout().componentDidAppear();
81
+ }
82
+ else {
83
+ reject(`component with id: ${componentId} is not a modal`);
84
+ }
79
85
  });
80
86
  }
81
87
  dismissAllModals(_commandId, _options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "7.25.4-snapshot.584",
3
+ "version": "7.25.4-snapshot.585",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,