File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export default function Main() {
48
48
49
49
You can change the theme prop dynamically and all the components will automatically update to reflect the new theme.
50
50
51
- A theme contains the following properties:
51
+ A theme usually contains the following properties:
52
52
53
53
- ` dark ` (` boolean ` ): whether this is a dark theme or light theme.
54
54
- ` roundness ` (` number ` ): roundness of common elements, such as buttons.
@@ -60,7 +60,7 @@ A theme contains the following properties:
60
60
- ` text ` - text color for content.
61
61
- ` disabled ` - color for disabled elements.
62
62
- ` placeholder ` - color for placeholder text, such as input placeholder.
63
- - ` fonts ` (` object ` ): various fonts used throught different elements
63
+ - ` fonts ` (` object ` ): various fonts used throught different elements.
64
64
- ` regular `
65
65
- ` medium `
66
66
- ` light `
Original file line number Diff line number Diff line change @@ -10,13 +10,15 @@ const isClassComponent = (Component: Function) => !!Component.prototype.render;
10
10
11
11
export default function withTheme < Props : { } > (
12
12
Comp: React.ComponentType< Props >
13
- ): React.ComponentType< $Diff < Props , { theme : Theme } > > {
13
+ ): React.ComponentType<
14
+ $Diff < Props , { theme : Theme } > & { theme ?: $Shape < Theme > }
15
+ > {
14
16
class ThemedComponent extends React . Component < * > {
15
17
/* $FlowFixMe */
16
18
static displayName = `withTheme(${ Comp . displayName || Comp . name } )` ;
17
19
18
- _previous : ?{ a : Theme , b : ?Theme , result : Theme } ;
19
- _merge = ( a : Theme , b : ?Theme ) = > {
20
+ _previous : ?{ a : Theme , b : ?$Shape < Theme > , result : Theme } ;
21
+ _merge = ( a : Theme , b : ?$Shape < Theme > ) => {
20
22
const previous = this . _previous ;
21
23
22
24
if ( previous && previous . a === a && previous . b === b ) {
You can’t perform that action at this time.
0 commit comments