Search code examples
react-nativesentrycode-pushreact-native-code-pushreact-native-sentry

how to wrap App component while using sentry with codepush react native


while using sentry with appcenter's codepush how to wrap the main App component like this:

export default Sentry.wrap(codePush(App));

or like this:

export default codePush(Sentry.wrap(App));

or is there any other method to execute the above task I refereed to the sentry docs but was unclear about this part https://docs.sentry.io/platforms/react-native/manual-setup/codepush/

please can someone help me


Solution

  • UPDATED

    Sentry recommends having CodePush as the outermost layer. An edit to their docs reads:

    In case you are wrapping your Root Component with Sentry.wrap to gain Performance features, codePush should be the outer most function because it needs access to the very root component in order to swap out the bundle.

    export default codePush(Sentry.wrap(App));
    

    Thanks to @manoelneto for correcting my assumption there.

    OLD ANSWER (INCORRECT)

    I would recommend having Sentry as the outermost layer. That way, if CodePush causes a crash, Sentry will know about it.