-
Notifications
You must be signed in to change notification settings - Fork 5
Remove StyleProvider
#29
base: master
Are you sure you want to change the base?
Conversation
@@ -1,15 +1,13 @@ | |||
import * as React from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is just from the sample, was just fiddling with some things.
return ( | ||
<StyleProvider> | ||
<AppBody /> | ||
</StyleProvider> | ||
); | ||
return <AppBody />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more Provider wrapper, woot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
* - Used to hold state (like colorScheme preference), which can be updated from a single | ||
* event listener, and have those updates emitted out to multiple hook-usages. | ||
*/ | ||
export class SimpleStore<S> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THE NEXT REDUX!
Jk, this is like the most barebones possible state-management solution. I like it because it's lean, and doesn't require Context
.
|
||
type StyleProviderProps = { | ||
colorScheme?: "light" | "dark" | "auto"; | ||
}; | ||
|
||
/** | ||
* TODO: Deprecate this. No longer needed, but leaving for now. | ||
*/ | ||
export const StyleProvider = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the following comment
/**
* @deprecated This provider should not be used
*/
export class SimpleStore<InitialValue, OutputValue = InitialValue> { | ||
#value!: OutputValue; | ||
#ee = new SimpleEventEmitter<OutputValue>(); | ||
#transformer!: (val: InitialValue) => OutputValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first time ever seeing private class vars in ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just recently started using them, and then realized like half of the class vars I use should be considered private, and I love that there's now an easy way for declaring them as such.
Damn, just now seeing that RNW doesn't support I'm torn on this. I really like this change to the API, but not supporting RNW is a real downside. UPDATE!Looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment, otherwise looks great.
LGTM? 🥇 |
What is this?
This PR removes the need to wrap your app in
StyleProvider
. The reason for this change is twofold:This PR also adds a bunch of cleanup around tests.