Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add conditionals for iOS only code in
RCTDeviceInfo.mm
(faceb…
…ook#45176) Summary: Having React Native support every Apple platform is tough to achieve as it introduces many platform-specific ifdefs. On the other side, maintaining an OOT platform fork is already a demanding job, so to make it easier I propose adding ifdefs for iOS-specific code. Thanks to this change, OOT platforms can focus on their OS-specific features while the core is also adding iOS-specific features behind ifdefs. Fortunately, **most of the code on Apple platforms can be shared** and this PR aims to introduce better support for this and to minimize OOT fork's surface. In this example `RCTDeviceInfo.mm` has support for handling orientation changes and the availability of this feature across Apple OS looks as follows: | Platform | Support | | ------------- | ------------- | | macOS | ❌ | | tvOS | ❌ | | visionOS | ❌ | | iOS/iPadOS | ✅ | Here is a table from `TargetConditionals.h` header file which shows the coverage of `TARGET_OS_IOS` macro. (It supports both iOS and iPadOS) ![CleanShot 2024-06-26 at 11 51 47@2x](https://github.com/facebook/react-native/assets/52801365/5f7dc99a-72b8-46ce-87d4-896bdb017269) ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL] [ADDED] - Conditionals for iOS only code in RCTDeviceInfo.mm Pull Request resolved: facebook#45176 Test Plan: CI Green Reviewed By: christophpurrer Differential Revision: D59106103 Pulled By: cipolleschi fbshipit-source-id: 594a9d2451024baddfbc9cd3bc1ccfb8829fc31c
- Loading branch information