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

Dark Mode + Centralized Theme #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

charliewilco
Copy link
Collaborator

@charliewilco charliewilco commented Apr 9, 2021

First pass at a universal theme provider. This removes all references components make to a colors object in favor of a useCurrentTheme() to responds with a light or dark theme depending on the users preferences. Because we're using Expo this also adds react-native-appearance to handle resolving the user's device setting.

Outstanding Items

  • Unit testing
  • HTML file that renders the editor instance
  • Manual user override setting for theming
  • Verifying on via Android Emulator
Contacts Notes
Simulator Screen Shot - iPhone 12 - 2021-04-09 at 07 41 38 Simulator Screen Shot - iPhone 12 - 2021-04-09 at 07 41 31

@charliewilco charliewilco requested a review from nikgraf April 9, 2021 14:50
@@ -32,7 +33,6 @@ async function loadHtmlFileForAndroid() {

const styles = StyleSheet.create({
container: {
backgroundColor: "#fff",
Copy link
Member

Choose a reason for hiding this comment

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

afaik this is important for the loading screen, but can be made dynamic based on the mode

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i think this is inherited from the underlying view but if you can show me a screenshot of what you mean i can take a closer look

app/components/ui/Text.tsx Outdated Show resolved Hide resolved
app/package.json Outdated Show resolved Hide resolved
Copy link
Member

@nikgraf nikgraf left a comment

Choose a reason for hiding this comment

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

A lot of great changes!

On iOS the light might is quite broken though, dark mode looks good
Screenshot 2021-04-14 at 13 46 24

@charliewilco
Copy link
Collaborator Author

@nikgraf lots of good feedback 😇 let me walk through the light mode again make sure things shake out well.

how are we feeling about the outstanding items?

@nikgraf
Copy link
Member

nikgraf commented Apr 15, 2021

I'm really happy with the progress!

Regarding the HTML the changes basically have to go to

I wonder if the web view on iOS and Android both support https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
If so colors simply could be defined as CSS variables and re-used like in this post https://useyourloaf.com/blog/supporting-dark-mode-in-wkwebview/

I wouldn't worry about overwriting the default preference. I mean really cool things to have, but better to keep PRs small, ship and iterate often :)

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