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

Property updates switching between PlatformColors would no-op #14398

Merged
merged 3 commits into from
Mar 7, 2025

Conversation

acoates-ms
Copy link
Contributor

@acoates-ms acoates-ms commented Mar 6, 2025

Description

In our HostPlatformColor object we had a bool that was representing an undefined color. There were a couple of places where we were treating this bool as isDefined, instead of isUndefined. This caused the == operator of Color to return true when comparing any PlatformColors. - Which causes various issues.

With the following component, the text would not change color when pressing the button:

const Bootstrap = () => {
  const [isHighlight, setIsHighlight] = React.useState(false);
  const swapColors = () => {
    setIsHighlight(!isHighlight);
  };
  return (
    <View>
      <Button title="Press" onPress={swapColors} />
      <Text
        style={{
          color: isHighlight ? PlatformColor('Highlight') : PlatformColor('WindowText'),
        }}>
        <Text>Text here</Text>
      </Text>
    </View>
  );
};

I just removed the whole m_isUndefined property. It is not needed as SharedColor has a bool operator that just compares the color to the global Undefined color, which doesn't need an additional bool.

Microsoft Reviewers: Open in CodeFlow

@acoates-ms acoates-ms requested a review from a team as a code owner March 6, 2025 23:18
@acoates-ms acoates-ms merged commit 782335b into microsoft:main Mar 7, 2025
62 checks passed
acoates-ms added a commit to acoates-ms/react-native-windows that referenced this pull request Mar 7, 2025
…oft#14398)

* Property updates switching between PlatformColors would no-op

* Change files

* format
acoates-ms added a commit that referenced this pull request Mar 7, 2025
…degen fix (#14406)

* Fix tooltips in high dpi (#14397)

* Fix tooltips in high dpi

* Change files

* format

* tooltips dont respect textscalefactor

* Fix build issue building component codegen using clang (#14393)

* Fix build issue building component codegen using clang

* Change files

* Property updates switching between PlatformColors would no-op (#14398)

* Property updates switching between PlatformColors would no-op

* Change files

* format

* update change files
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.

3 participants