@@ -56,18 +56,18 @@ const InstabugModule = {
5656 * @param {invocationEvent } invocationEvent The event that invokes
5757 * the SDK's UI.
5858 */
59- start : function ( token , invocationEvent ) {
59+ start : function ( token , invocationEvent ) {
6060 if ( Platform . OS === 'ios' ) {
6161 Instabug . startWithToken ( token , invocationEvent ) ;
6262 }
6363 _isFirstScreen = true ;
6464 _currentScreen = firstScreen ;
65- setTimeout ( function ( ) {
65+ setTimeout ( function ( ) {
6666 if ( _currentScreen == firstScreen ) {
6767 Instabug . reportScreenChange ( firstScreen ) ;
6868 _currentScreen = null ;
6969 }
70- } , 1000 ) ;
70+ } , 1000 ) ;
7171 } ,
7272
7373 /**
@@ -190,7 +190,7 @@ const InstabugModule = {
190190 * notifications are enabled or disabled.
191191 */
192192 setPushNotificationsEnabled ( isPushNotificationEnabled ) {
193- Replies . setPushNotificationsEnabled ( isPushNotificationEnabled ) ;
193+ Replies . setPushNotificationsEnabled ( isPushNotificationEnabled ) ;
194194 } ,
195195
196196 /* istanbul ignore next */
@@ -221,7 +221,7 @@ const InstabugModule = {
221221 * floating button.
222222 */
223223 setFloatingButtonEdge ( floatingButtonEdge , offsetFromTop ) {
224- BugReporting . setFloatingButtonEdge ( floatingButtonEdge , offsetFromTop ) ;
224+ BugReporting . setFloatingButtonEdge ( floatingButtonEdge , offsetFromTop ) ;
225225 } ,
226226
227227 /**
@@ -757,28 +757,28 @@ const InstabugModule = {
757757 // handled js crash
758758 if ( Platform . OS === 'android' ) {
759759 IBGEventEmitter . addListener ( Instabug , InstabugConstants . SEND_HANDLED_CRASH , async jsonObject => {
760- try {
761- let report = await Instabug . getReport ( ) ;
762- const { tags, consoleLogs, instabugLogs, userAttributes, fileAttachments } = report ;
763- const reportObj = new Report ( tags , consoleLogs , instabugLogs , userAttributes , fileAttachments ) ;
764- preSendingHandler ( reportObj ) ;
765- Instabug . sendHandledJSCrash ( JSON . stringify ( jsonObject ) ) ;
766- } catch ( e ) {
767- console . error ( e ) ;
768- }
760+ try {
761+ let report = await Instabug . getReport ( ) ;
762+ const { tags, consoleLogs, instabugLogs, userAttributes, fileAttachments } = report ;
763+ const reportObj = new Report ( tags , consoleLogs , instabugLogs , userAttributes , fileAttachments ) ;
764+ preSendingHandler ( reportObj ) ;
765+ Instabug . sendHandledJSCrash ( JSON . stringify ( jsonObject ) ) ;
766+ } catch ( e ) {
767+ console . error ( e ) ;
768+ }
769769 } ) ;
770770 }
771771
772772 if ( Platform . OS === 'android' ) {
773773 IBGEventEmitter . addListener ( Instabug , InstabugConstants . SEND_UNHANDLED_CRASH , async ( jsonObject ) => {
774-
775- let report = await Instabug . getReport ( ) ;
776- const { tags, consoleLogs, instabugLogs, userAttributes, fileAttachments } = report ;
777- const reportObj = new Report ( tags , consoleLogs , instabugLogs , userAttributes , fileAttachments ) ;
778- preSendingHandler ( reportObj ) ;
779- Instabug . sendJSCrash ( JSON . stringify ( jsonObject ) ) ;
774+
775+ let report = await Instabug . getReport ( ) ;
776+ const { tags, consoleLogs, instabugLogs, userAttributes, fileAttachments } = report ;
777+ const reportObj = new Report ( tags , consoleLogs , instabugLogs , userAttributes , fileAttachments ) ;
778+ preSendingHandler ( reportObj ) ;
779+ Instabug . sendJSCrash ( JSON . stringify ( jsonObject ) ) ;
780780 } ) ;
781- }
781+ }
782782
783783 Instabug . setPreSendingHandler ( preSendingHandler ) ;
784784 } ,
@@ -788,25 +788,44 @@ const InstabugModule = {
788788 } ,
789789
790790 onNavigationStateChange ( prevState , currentState , action ) {
791- const currentScreen = InstabugUtils . getActiveRouteName ( currentState ) ;
792- const prevScreen = InstabugUtils . getActiveRouteName ( prevState ) ;
791+ const currentScreen = InstabugUtils . getActiveRouteName ( currentState ) ;
792+ const prevScreen = InstabugUtils . getActiveRouteName ( prevState ) ;
793793
794- if ( prevScreen !== currentScreen ) {
795- if ( _currentScreen != null && _currentScreen != firstScreen ) {
796- Instabug . reportScreenChange ( _currentScreen ) ;
794+ if ( prevScreen !== currentScreen ) {
795+ if ( _currentScreen != null && _currentScreen != firstScreen ) {
796+ Instabug . reportScreenChange ( _currentScreen ) ;
797+ _currentScreen = null ;
798+ }
799+ _currentScreen = currentScreen ;
800+ setTimeout ( function ( ) {
801+ if ( _currentScreen == currentScreen ) {
802+ Instabug . reportScreenChange ( currentScreen ) ;
797803 _currentScreen = null ;
798804 }
799- _currentScreen = currentScreen ;
800- setTimeout ( function ( ) {
801- if ( _currentScreen == currentScreen ) {
802- Instabug . reportScreenChange ( currentScreen ) ;
803- _currentScreen = null ;
804- }
805- } , 1000 ) ;
805+ } , 1000 ) ;
806+ }
807+ } ,
808+
809+ onStateChange ( state ) {
810+ const currentScreen = InstabugUtils . getFullRoute ( state ) ;
811+ if ( _currentScreen != null && _currentScreen != firstScreen ) {
812+ Instabug . reportScreenChange ( _currentScreen ) ;
813+ _currentScreen = null ;
814+ }
815+ _currentScreen = currentScreen ;
816+ setTimeout ( function ( ) {
817+ if ( _currentScreen == currentScreen ) {
818+ Instabug . reportScreenChange ( currentScreen ) ;
819+ _currentScreen = null ;
806820 }
821+ } , 1000 ) ;
822+ } ,
823+
824+ reportScreenChange ( screenName ) {
825+ Instabug . reportScreenChange ( screenName ) ;
807826 } ,
808827
809- componentDidAppearListener ( { componentId, componentName, passProps} ) {
828+ componentDidAppearListener ( { componentId, componentName, passProps } ) {
810829 if ( _isFirstScreen ) {
811830 _lastScreen = componentName ;
812831 _isFirstScreen = false ;
@@ -816,9 +835,9 @@ const InstabugModule = {
816835 Instabug . reportScreenChange ( componentName ) ;
817836 _lastScreen = componentName ;
818837 }
819- } ,
838+ } ,
839+
820840
821-
822841 /**
823842 * The event used to invoke the feedback form
824843 * @readonly
0 commit comments