mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary:
This PR refactors the RCTDevLoadingView to use constraints instead of explicitly defining frames.
Now the code looks like this:
```
#if TARGET_OS_MACCATALYST
self->_window.frame = CGRectMake(0, window.safeAreaInsets.top, windowWidth, 20);
self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, windowWidth, 20)];
#else
self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10);
self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)];
#endif
```
When working with visionOS I quickly found my self in the need of adding additional else there...
This PR uses constraints to layout the views correctly for every device.
| Device | Screenshot |
| -------------- | ---------- |
| iOS | <img src="https://github.com/user-attachments/assets/decc146e-41a2-4ce8-bafd-77c77a39398b" width="200"/> |
| macOS Catalyst | <img src="https://github.com/user-attachments/assets/78ef4946-a6dc-49a2-864e-a483577798f1" width="200"/> |
| iPadOS | <img src="https://github.com/user-attachments/assets/a15bd1a8-84ae-47d0-becb-e14c3a9352d4" width="200"/> |
| visionOS | <img src="https://github.com/user-attachments/assets/d74f0607-837e-4f7b-b924-fc6fce80d763" width="200"/> |
## Changelog:
[IOS] [CHANGED] - refactor RCTDevLoadingView to use constraints
Pull Request resolved: https://github.com/facebook/react-native/pull/46621
Test Plan: Test if DevLoading view is properly showing up
Reviewed By: blakef
Differential Revision: D63383002
Pulled By: cipolleschi
fbshipit-source-id: b17499e12d4a882facce4c45b1cc22eb43ea3bb1