|
|
@@ -1,6 +1,6 @@
|
|
1
|
1
|
import utils from './utils';
|
|
2
|
2
|
import Navigation from './Navigation';
|
|
3
|
|
-import Controllers, { Modal } from 'react-native-controllers';
|
|
|
3
|
+import Controllers, { Modal, Notification } from 'react-native-controllers';
|
|
4
|
4
|
const React = Controllers.hijackReact();
|
|
5
|
5
|
const {
|
|
6
|
6
|
ControllerRegistry,
|
|
|
@@ -404,6 +404,41 @@ function dismissLightBox(params) {
|
|
404
|
404
|
Modal.dismissLightBox();
|
|
405
|
405
|
}
|
|
406
|
406
|
|
|
|
407
|
+function showInAppNotification(params) {
|
|
|
408
|
+ if (!params.screen) {
|
|
|
409
|
+ console.error('showInAppNotification(params): params.screen is required');
|
|
|
410
|
+ return;
|
|
|
411
|
+ }
|
|
|
412
|
+
|
|
|
413
|
+ const controllerID = utils.getRandomId();
|
|
|
414
|
+ const navigatorID = controllerID + '_nav';
|
|
|
415
|
+ const screenInstanceID = utils.getRandomId();
|
|
|
416
|
+ const {
|
|
|
417
|
+ navigatorStyle,
|
|
|
418
|
+ navigatorButtons,
|
|
|
419
|
+ navigatorEventID
|
|
|
420
|
+ } = _mergeScreenSpecificSettings(params.screen, screenInstanceID, params);
|
|
|
421
|
+ const passProps = Object.assign({}, params.passProps);
|
|
|
422
|
+ passProps.navigatorID = navigatorID;
|
|
|
423
|
+ passProps.screenInstanceID = screenInstanceID;
|
|
|
424
|
+ passProps.navigatorEventID = navigatorEventID;
|
|
|
425
|
+
|
|
|
426
|
+ Notification.show({
|
|
|
427
|
+ component: params.screen,
|
|
|
428
|
+ passProps: passProps,
|
|
|
429
|
+ style: params.style,
|
|
|
430
|
+ animation: params.animation || Notification.AnimationPresets.default,
|
|
|
431
|
+ position: params.position,
|
|
|
432
|
+ shadowRadius: params.shadowRadius,
|
|
|
433
|
+ dismissWithSwipe: params.dismissWithSwipe || true,
|
|
|
434
|
+ autoDismissTimerSec: params.autoDismissTimerSec || 5
|
|
|
435
|
+ });
|
|
|
436
|
+}
|
|
|
437
|
+
|
|
|
438
|
+function dismissInAppNotification(params) {
|
|
|
439
|
+ Notification.dismiss(params);
|
|
|
440
|
+}
|
|
|
441
|
+
|
|
407
|
442
|
export default {
|
|
408
|
443
|
startTabBasedApp,
|
|
409
|
444
|
startSingleScreenApp,
|
|
|
@@ -416,6 +451,8 @@ export default {
|
|
416
|
451
|
dismissAllModals,
|
|
417
|
452
|
showLightBox,
|
|
418
|
453
|
dismissLightBox,
|
|
|
454
|
+ showInAppNotification,
|
|
|
455
|
+ dismissInAppNotification,
|
|
419
|
456
|
navigatorSetButtons,
|
|
420
|
457
|
navigatorSetTitle,
|
|
421
|
458
|
navigatorSetTitleImage,
|