Files
react-native/packages/react-native/Libraries/ReactNative
Rubén Norte e284bdc869 Check if devtools hook on/off methods are defined before using them in AppContainer (#39808)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39808

I've been doing some tests where I disable React DevTools locally and this code has been crashing because React Fast Refresh defines the React DevTools hook if DevTools didn't ([pointer](https://github.com/facebook/react/blob/85c2b519b54269811002d26f4f711809ef68f123/packages/react-refresh/src/ReactFreshRuntime.js#L453-L475)), and it doesn't actually define the `on` and `off` methods, which makes this throw.

This changes `AppContainer` to check if the methods are defined before using them.

Changelog: [internal]

Reviewed By: hoxyq

Differential Revision: D49909258

fbshipit-source-id: 3b0c1f37601a1cbe38f80ca3a20ffe2348a21aaf
2023-10-04 09:50:43 -07:00
..
2023-05-04 17:13:16 -07:00