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

Refactor: Fetch high contrast state via a cross platform hook #470

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

Saadnajmi
Copy link
Contributor

@Saadnajmi Saadnajmi commented Jul 9, 2024

Description

Why

This is part of a series of commits to reduce dependence on React Native Windows specific APIs, and allow the gallery to potentially run on macOS.

Currently, App.tsx uses a React Native Windows specific JS API to fetch the high contrast state. This adds a direct import to react-native-windows that isn't gated inside a platform check or file. This commit refactors the code to fetch high contrast state into a hook, so that the windows specific imports can be moved to a foo.windows.tsx file, and so that we can also implement the macOS / mobile implementations separately.

What

Moves high contrast fetching code to a new hook useHighContrastState()

Screenshots

No change should be seen to final app.

Microsoft Reviewers: Open in CodeFlow

@Saadnajmi Saadnajmi changed the title refactor: Fetch high contrast state via a cross platform hook Refactor: Fetch high contrast state via a cross platform hook Jul 9, 2024
Copy link
Contributor

@chiaramooney chiaramooney left a comment

Choose a reason for hiding this comment

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

👍

@chiaramooney chiaramooney merged commit f2de4f3 into microsoft:main Jul 9, 2024
2 checks passed
@Saadnajmi Saadnajmi deleted the hc branch July 9, 2024 20:37
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