react-native-zephyr icon indicating copy to clipboard operation
react-native-zephyr copied to clipboard

Remove `StyleProvider`

Open gksander opened this issue 2 years ago • 2 comments

What is this?

This PR removes the need to wrap your app in StyleProvider. The reason for this change is twofold:

  1. It's easier to setup if you don't have to wrap your app. I like that, and then dark mode just sort of "magically" works without the provider.
  2. I'm working toward a set of response utilities, where you can apply "classes" based on screen size. This will require a top-level WindowDimensions listener. I'd like to keep things as performant as possible, and not have to deal with Context values changing and triggering cascading re-renders.

This PR also adds a bunch of cleanup around tests.

gksander avatar Jul 06 '22 16:07 gksander

Damn, just now seeing that RNW doesn't support Appearance.addChangeListener, so this is going to fail for RNW 😢

I'm torn on this. I really like this change to the API, but not supporting RNW is a real downside.

UPDATE!

Looks like Appearance.addChangeListener does exist, it just doesn't conform to RN's new API for change listeners (e.g., returning a remove method from the subscription). I've created a PR for RNW to support this.

gksander avatar Jul 06 '22 17:07 gksander

LGTM? 🥇

atanaskanchev avatar Jul 28 '23 17:07 atanaskanchev