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

Abstract underlying Color implementation #38668

Closed
wants to merge 4 commits into from

Conversation

rozele
Copy link
Contributor

@rozele rozele commented Jul 28, 2023

Summary:
On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

Changelog:

[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: D47873465

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jul 28, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

@analysis-bot
Copy link

analysis-bot commented Jul 28, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,889,976 +4,525
android hermes armeabi-v7a 7,938,006 +2,206
android hermes x86 9,287,569 +5,600
android hermes x86_64 9,189,052 +3,593
android jsc arm64-v8a 9,477,980 +4,527
android jsc armeabi-v7a 8,419,016 +2,207
android jsc x86 9,461,804 +5,608
android jsc x86_64 9,776,008 +3,599

Base commit: 8bcfc49
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: mdvacca

Differential Revision: D47873465

fbshipit-source-id: 8ad1170cd92f678826681ba9b0b068f6d41a978d
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: D47873465

fbshipit-source-id: 283ef5d44f512fbd228e68aff88f11957388a68d
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: D47873465

fbshipit-source-id: b117186689af80d469d3b63563831c4e25bc7f06
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 90c20bfafaa0e3ef40cafadcfc7a440d9c7c1250
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: cd19cfd8ddfccbc71c7dbce7ad6bb88d6fa168b0
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 901fcee352fa891f4a33764980c780ad7408bd6d
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: e30ccf4e1692f2625b6d0f225f59a471cf44ee06
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 28, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: ba13f4f3d3e50996a6a3e291102313261c2f2eb8
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 29, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 6eb3051b2772802ddc9dabd05a39f6a304be4c9b
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 29, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 4302c35f1c82b64b694b1bc1c5cf4e802ccb0ee2
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 8a8a5db432d8d85303d96b566efeae5dfbd3a526
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: aa3cfac27c7bc577b6a5e1b41eaf3faf8be4371e
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 02052787d822a737468029256e273de2724a09cf
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 425dfd1b4031953e099f96ca96be6c58fc4dac36
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: c51d3fdd793ae5883790de046c3c82ab4688a8c3
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: ff07660cba0545fd44a21aee7598322a91c1f550
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 9e7974612555a284116a578664af622802e87afb
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: dce26de7a1fbbf01f67f9794a63896588b61aaa9
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 607572631891725b637cf73976e56486ff62e38a
rozele and others added 4 commits July 31, 2023 11:31
Summary:
Pull Request resolved: facebook#38549

Out of tree platforms may need different implementations of ViewProps. In fact, Android does already with props like `needsOffscreenAlphaCompositing` and `focusable`. This diff is not opinionated on whether these props should actually be shared on all platforms. Props like `focusable` may be a good candidate for generalizing to all platforms. However, there will always be a need for one platform to experiment with a new prop while it's not available yet on another, especially when considering out of tree platforms.

This diff moves the existing ViewProps class to BaseViewProps, aliases ViewProps as BaseViewProps for iOS for now, and moves Android-specific view props to it's own header and implementation.

## Changelog:
[General] [Added] - Support additional View props in out of tree platform Fabric implementations

Differential Revision: https://internalfb.com/D47492635

fbshipit-source-id: 47b3f616a342195b5fc408a0075b07db2221aa03
…ebook#38580)

Summary:
Pull Request resolved: facebook#38580

We already have a differential between Android and iOS View props that force view flattening (or unflattening) behaviors. Other out-of-tree platforms may have a need to customize view flattening behaviors.

This change adds a ViewTraitsInitializer header that out of tree platforms can inject to include platform-specific ViewProps fields when considering view flattening behaviors.

## Changelog:
[General] [Added] - Support customization of View traits for flattening in out of tree platform Fabric implementations

Differential Revision: https://internalfb.com/D47721377

fbshipit-source-id: 39dab5c7d66617ad5fc922b7f8504dced18ebe4a
…facebook#38582)

Summary:
Pull Request resolved: facebook#38582

Some out of tree platforms may have extra events (e.g., events for different input modalities) that don't exist on other platforms.

For example, react-native-windows and react-native-macos have `onKeyUp` and `onKeyDown` that can be emitted from any native component.

This change provides a hook for out of platforms to customize which events can be emitted from all native components.

## Changelog:
[General] [Added] - Support additional View events in out of tree platform Fabric implementations

Differential Revision: https://internalfb.com/D47721603

fbshipit-source-id: 52e16e3b36ce0051ae174d4deede9c229ad16eef
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 6ee8acb05e6bd7a5c797f2e5bb40387bcbbd2e2d
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47873465

rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: 817e43df1042db5fcf84e9f30965972b7f250d8a
rozele added a commit to rozele/react-native-macos that referenced this pull request Jul 31, 2023
Summary:
Pull Request resolved: facebook#38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Differential Revision: https://internalfb.com/D47873465

fbshipit-source-id: f544cf085153f689dd9fcf3fa8d0e78b985333ce
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 31, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 2b688f6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants