Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xcode 15] Silence warning with mismatched NSView.clipsToBounds property #1864

Merged
merged 2 commits into from
Jul 5, 2023

Conversation

anandrajeswaran
Copy link

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

When including react-native-macos public headers with Xcode 15, we get an error that the clipsToBounds property declared on RCTUIView doesn't match the one now declared in AppKit as of the macOS 14.0 SDK. AppKit has finally publicized this property, but it is marked as atomic rather than nonatomic.

When we're building exclusively with Xcode 15, we can remove this override. But for now, let's just make the property declarations match.

Note, this isn't actually blocking building react-native-macos because these warnings aren't turned on as errors (they probably should be). But if a consumer has warnings treated as errors, this will fail their builds.

Changelog

[MACOS] [FIXED] - Silenced warnings with Xcode 15.

Test Plan

Just counting on CI since this really should be a non-functional change

@anandrajeswaran anandrajeswaran requested a review from a team as a code owner July 1, 2023 23:05
React/Base/RCTUIKit.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@Saadnajmi Saadnajmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear: This change will silence a warning, but not actually change any behavior?And since the default behavior changed with Xcode 15, it's likely we need extra work to ensure our views render correctly?

I did a brief look and it seems that clipsToBounds is actually set by this JS property: https://reactnative.dev/docs/next/layout-props#overflow . So it sounds like something we should properly support :D

@anandrajeswaran
Copy link
Author

To be clear: This change will silence a warning, but not actually change any behavior?And since the default behavior changed with Xcode 15, it's likely we need extra work to ensure our views render correctly?

I did a brief look and it seems that clipsToBounds is actually set by this JS property: https://reactnative.dev/docs/next/layout-props#overflow . So it sounds like something we should properly support :D

I think it will just work. for the most part. We've been using the API as though it existed and now it does so setting it should now get the intended behavior, but it's not documented as being undefined anymore.

Where we could run into issues (when compiling with Xcode 15):

  • The default behavior is different on macOS 14 vs. 13 and below. Not sure if we're relying on the default value or always setting it
  • When this is false, AppKit may ask us to draw outside our bounds. If we have drawRect: overrides, these will need to not blindly trust dirtyRect and likely instead draw in the intersection of dirtyRect and bounds

@Saadnajmi
Copy link
Collaborator

To be clear: This change will silence a warning, but not actually change any behavior?And since the default behavior changed with Xcode 15, it's likely we need extra work to ensure our views render correctly?

I did a brief look and it seems that clipsToBounds is actually set by this JS property: https://reactnative.dev/docs/next/layout-props#overflow . So it sounds like something we should properly support :D

I think it will just work. for the most part. We've been using the API as though it existed and now it does so setting it should now get the intended behavior, but it's not documented as being undefined anymore.

Where we could run into issues (when compiling with Xcode 15):

  • The default behavior is different on macOS 14 vs. 13 and below. Not sure if we're relying on the default value or always setting it
  • When this is false, AppKit may ask us to draw outside our bounds. If we have drawRect: overrides, these will need to not blindly trust dirtyRect and likely instead draw in the intersection of dirtyRect and bounds

I think we got rid of our last drawRect override with 0.71, and (potentially) with Fabric going forward we may not support drawRect at all. Good to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants