forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add new macOS View prop allowsVibrancy
#1889
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Saadnajmi
commented
Jul 24, 2023
allowsVibrancy
allowsVibrancy
lyzhan7
approved these changes
Aug 8, 2023
amgleitman
approved these changes
Aug 8, 2023
Saadnajmi
added a commit
to Saadnajmi/react-native-macos
that referenced
this pull request
Aug 9, 2023
* Add new macOS View prop `allowsVibrancy` * fix lint * small fixes * fix lint * no super
Saadnajmi
added a commit
that referenced
this pull request
Aug 9, 2023
* Add new macOS View prop `allowsVibrancy` * fix lint * small fixes * fix lint * no super
@AdrianFahrbach Yep! See this PR where I make a native module for I wanted to upstream it to https://github.com/Kureev/react-native-blur eventually, there's just more extra code needed than I'd like. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
Summary
Appkit has a prop
allowsVibrancy
that will allow Appkit to subtly change the colors of an NSView inside an NSVisualEffectView to get that "vibrant" effect. There's a property we can override on NSView for custom NSViews so we can get the effect too. Let's expose it on macOS so that we can set it through Javascript. One caveat is the Appkit property is readonly, so I had to add a new RCTView propertyallowsVibrancyInternal
that the RCTView getter then reads.https://developer.apple.com/documentation/appkit/nsview/1483793-allowsvibrancy
Changelog
[MACOS] [ADDED] - Add new macOS View prop
allowsVibrancy
Test Plan
Prototyping this inside FluentUI React Native (by just.. making every RCTView set
allowsVibrancy = true
), you can clearly see a difference between the two Callouts. Both have a solid background color set to them, but one will "blend" the colors of the window behind it, AKA, the vibrant effect.Without (notice the solid pink):
![Screenshot 2023-08-07 at 11 12 17 PM](https://private-user-images.githubusercontent.com/6722175/259034533-586afc4d-dd23-4d91-9d37-921e42afafd8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYyMDIsIm5iZiI6MTczOTA1NTkwMiwicGF0aCI6Ii82NzIyMTc1LzI1OTAzNDUzMy01ODZhZmM0ZC1kZDIzLTRkOTEtOWQzNy05MjFlNDJhZmFmZDgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwNTAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWNhNzZhNWEzYzA5ODljOGM4NzRiMmY3YzQzMzBjOGFmNzI0NTYyMjVjMjUyMmViOTRiZjExNDU0OWU1MTNkYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Ydm5oScROR3RyAvY639UK-zaoFxOQW3OilJ6oLZEp5c)
With (notice the pink is blended on the top left):
![Screenshot 2023-08-07 at 11 11 49 PM](https://private-user-images.githubusercontent.com/6722175/259034547-56cb8c41-b474-4eed-8aeb-531c613b08bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTYyMDIsIm5iZiI6MTczOTA1NTkwMiwicGF0aCI6Ii82NzIyMTc1LzI1OTAzNDU0Ny01NmNiOGM0MS1iNDc0LTRlZWQtOGFlYi01MzFjNjEzYjA4YmYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjMwNTAyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWEzYjVmNzFjMTMwYzNiNzIyYWFlN2NlNzIwYmVmZjY3NDQ4MzJjMmFmZTQ3NjZjNGNhYjg4MTczNDA1NzU0NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.LnjWiJFOK99enNAU49FUwOK-6j_RWsdLW2x20Se-OUk)