11import utils from './utils' ;
22import Navigation from './Navigation' ;
3- import Controllers , { Modal } from 'react-native-controllers' ;
3+ import Controllers , { Modal , Notification } from 'react-native-controllers' ;
44const React = Controllers . hijackReact ( ) ;
55const {
66 ControllerRegistry,
@@ -404,6 +404,41 @@ function dismissLightBox(params) {
404404 Modal . dismissLightBox ( ) ;
405405}
406406
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+
407442export default {
408443 startTabBasedApp,
409444 startSingleScreenApp,
@@ -416,6 +451,8 @@ export default {
416451 dismissAllModals,
417452 showLightBox,
418453 dismissLightBox,
454+ showInAppNotification,
455+ dismissInAppNotification,
419456 navigatorSetButtons,
420457 navigatorSetTitle,
421458 navigatorSetTitleImage,
0 commit comments