[RN][iOS] Makes fix Switch layout with iOS26#53067
Conversation
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D79653120. |
99f0e9d to
eaecb44
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D79653120. |
eaecb44 to
677329f
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D79653120. |
a63e651 to
505db10
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D79653120. |
matinzd
left a comment
There was a problem hiding this comment.
Asked a question just for me knowledge
| Size SwitchShadowNode::measureContent( | ||
| const LayoutContext& /*layoutContext*/, | ||
| const LayoutConstraints& layoutConstraints) const { | ||
| if (iosSwitchSize.width != 0){ |
There was a problem hiding this comment.
Why just checking the width? 🤔
There was a problem hiding this comment.
Just because it is to verify whether the struct has been initialized or not. Checking for both is redundant.
Width and height are 0 only if we never cached the values, so when the struct has just been created. Once the values are cached, it will never be 0 again.
15f0aeb to
02c3e9d
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D79653120. |
Summary: Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the <Switch> component, the layout of the app will be broken because of wrong layout measurements. This has been reported also by [https://github.com/facebook/react-native/issues/52823](https://github.com/facebook/react-native/issues/52823). The `<Switch>` component was using hardcoded values for its size. This change fixes the problem by: - Using codegen for interface only - Implementing a custom Sadow Node to ask the platform for the Switch measurements - Updating the JS layout to wrap the size around the native component. ## Changelog: [iOS][Fixed] - Fix Switch layout to work with iOS26 Pull Request resolved: #53067 Test Plan: Tested locally with RNTester. | iOS Version | Before | After | | --- | --- | --- | | < iOS 26 |  |  | | >=--sanitized-- Rollback Plan: Differential Revision: D79653120 Pulled By: cipolleschi
|
This pull request was exported from Phabricator. Differential Revision: D79653120 |
02c3e9d to
690fab6
Compare
|
This pull request was successfully merged by @cipolleschi in 690fab6 When will my fix make it into a release? | How to file a pick request? |
Summary: Pull Request resolved: #53247 Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the <Switch> component, the layout of the app will be broken because of wrong layout measurements. This has been reported also by [https://github.com/facebook/react-native/issues/52823](https://github.com/facebook/react-native/issues/52823). The `<Switch>` component was using hardcoded values for its size. This change fixes the problem by: - Using codegen for interface only - Implementing a custom Sadow Node to ask the platform for the Switch measurements - Updating the JS layout to wrap the size around the native component. ## Changelog: [iOS][Fixed] - Fix Switch layout to work with iOS26 Pull Request resolved: #53067 Test Plan: Tested locally with RNTester. | iOS Version | Before | After | | --- | --- | --- | | < iOS 26 |  |  | | >=--sanitized-- Rollback Plan: Differential Revision: D79653120 Pulled By: cipolleschi
Summary: Pull Request resolved: #53247 Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the <Switch> component, the layout of the app will be broken because of wrong layout measurements. This has been reported also by [https://github.com/facebook/react-native/issues/52823](https://github.com/facebook/react-native/issues/52823). The `<Switch>` component was using hardcoded values for its size. This change fixes the problem by: - Using codegen for interface only - Implementing a custom Sadow Node to ask the platform for the Switch measurements - Updating the JS layout to wrap the size around the native component. [iOS][Fixed] - Fix Switch layout to work with iOS26 Pull Request resolved: #53067 Test Plan: Tested locally with RNTester. | iOS Version | Before | After | | --- | --- | --- | | < iOS 26 | https://github.com/user-attachments/assets/91d73ea3-30ba-4a5c-948e-ea5c63aa7c6d | https://github.com/user-attachments/assets/76061bc8-0f14-412a-a8fb-d1c3951772e6 | | >= iOS 26 | https://github.com/user-attachments/assets/1abc477f-bc0a-4762-938e-98814fb2a054 | https://github.com/user-attachments/assets/77e562e1-b803-46ac-9cf6-102f062a1cd4 | Rollback Plan: Reviewed By: sammy-SC Differential Revision: D79653120 Pulled By: cipolleschi fbshipit-source-id: d99b353b7b7b5496b148779de4abe3e57dd38156
* Fix Switch layout with iOS26 (#53247) Summary: Pull Request resolved: #53247 Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the <Switch> component, the layout of the app will be broken because of wrong layout measurements. This has been reported also by [https://github.com/facebook/react-native/issues/52823](https://github.com/facebook/react-native/issues/52823). The `<Switch>` component was using hardcoded values for its size. This change fixes the problem by: - Using codegen for interface only - Implementing a custom Sadow Node to ask the platform for the Switch measurements - Updating the JS layout to wrap the size around the native component. [iOS][Fixed] - Fix Switch layout to work with iOS26 Pull Request resolved: #53067 Test Plan: Tested locally with RNTester. | iOS Version | Before | After | | --- | --- | --- | | < iOS 26 | https://github.com/user-attachments/assets/91d73ea3-30ba-4a5c-948e-ea5c63aa7c6d | https://github.com/user-attachments/assets/76061bc8-0f14-412a-a8fb-d1c3951772e6 | | >= iOS 26 | https://github.com/user-attachments/assets/1abc477f-bc0a-4762-938e-98814fb2a054 | https://github.com/user-attachments/assets/77e562e1-b803-46ac-9cf6-102f062a1cd4 | Rollback Plan: Reviewed By: sammy-SC Differential Revision: D79653120 Pulled By: cipolleschi fbshipit-source-id: d99b353b7b7b5496b148779de4abe3e57dd38156 * feat: update js layout * fix crash for feature flag
Summary:
Apple changed the sizes of the UISwitchComponent and now, if you build an iOs app using the component, the layout of the app will be broken because of wrong layout measurements.
This has been reported also by #52823.
The
<Switch>component was using hardcoded values for its size.This change fixes the problem by:
Changelog:
[iOS][Fixed] - Fix Switch layout to work with iOS26
Test Plan:
Tested locally with RNTester.