How to detect Catalyst mode in react-native?

Viewed 409

I'm using react-native 0.62.x

If react-native runs in Catalyst (system is macOS), Platform.OS would still be iOS. Is there any official way to detect isCatalyst ?

1 Answers

I maintain react-native-device-info, and this was a problem until about 5 minutes ago ;-)

I just merged a PR that adds "desktop" to the possible return values from getDeviceType(). Catalyst really is an iOS build, so Platform.OS as iOS is not incorrect, but now the combination of iOS platform and desktop as return value of getDeviceType() should unambiguously tell you it's running on a desktop machine via a catalyst build target.

It will be available in react-native-device-info 7.4.0 and higher

Cheers

Related