react-native-patina
Advanced tools
+6
-0
| # react-native-patina | ||
| ## 0.1.1 (2020-07-02) | ||
| - Fix the user-facing type definitions: | ||
| - `cacheStyles` no longer turns the style types into `unknown`. | ||
| - `ThemeProvider` and `withTheme` use `React.ComponentType` now. | ||
| ## 0.1.0 (2020-06-27) | ||
| - Initial release. |
@@ -1,8 +0,5 @@ | ||
| declare type NativeStyles<Styles> = { | ||
| readonly [K in keyof Styles]: unknown; | ||
| }; | ||
| /** | ||
| * Memoizes a theme-to-stylesheet conversion function. | ||
| */ | ||
| export declare function cacheStyles<Theme, Styles>(callback: (theme: Theme) => Styles): (theme: Theme) => NativeStyles<Styles>; | ||
| export declare function cacheStyles<Theme, Styles>(callback: (theme: Theme) => Styles): (theme: Theme) => Styles; | ||
| /** | ||
@@ -12,2 +9,1 @@ * Adjusts the number of style objects `cacheStyles` should remember. | ||
| export declare function setCacheSize(size: number): void; | ||
| export {}; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cacheStyles.js","sourceRoot":"","sources":["../src/cacheStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,IAAI,SAAS,GAAG,CAAC,CAAA;AAMjB;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,QAAkC;IAElC,MAAM,KAAK,GAAyD,EAAE,CAAA;IAEtE,OAAO,SAAS,UAAU,CAAC,KAAY;QACrC,qCAAqC;QACrC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAEvE,4DAA4D;QAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACrC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE;gBAC5B,MAA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AC,CAAC,CAAC,KAAK,KAAK,KAAK,EAAE;gBAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBAChC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;gBACvB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;aACtB;SACF;QAED,6CAA6C;QAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;QAChD,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC/B,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS;YAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACjD,OAAO,KAAK,CAAA;IACd,CAAC,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,SAAS,GAAG,IAAI,CAAA;AAClB,CAAC"} |
@@ -21,7 +21,7 @@ import * as React from 'react'; | ||
| watchTheme(callback: WatchCallback<Theme>): Unsubscribe; | ||
| ThemeProvider: React.ComponentClass<ProviderProps>; | ||
| ThemeProvider: React.ComponentType<ProviderProps>; | ||
| useTheme(): Theme; | ||
| withTheme<Props extends { | ||
| theme: Theme; | ||
| }>(Component: React.ComponentType<Props>): React.FunctionComponent<RemoveTheme<Props>>; | ||
| }>(Component: React.ComponentType<Props>): React.ComponentType<RemoveTheme<Props>>; | ||
| } | ||
@@ -28,0 +28,0 @@ /** |
+1
-1
| { | ||
| "name": "react-native-patina", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "private": false, | ||
@@ -5,0 +5,0 @@ "description": "A simple, type-aware theming library", |
+1
-1
@@ -130,3 +130,3 @@ # react-native-patina | ||
| text { | ||
| text: { | ||
| color: theme.foregroundColor, | ||
@@ -133,0 +133,0 @@ fontSize: theme.rem(1) |
@@ -5,6 +5,2 @@ import { StyleSheet } from 'react-native' | ||
| type NativeStyles<Styles> = { | ||
| readonly [K in keyof Styles]: unknown | ||
| } | ||
| /** | ||
@@ -15,4 +11,4 @@ * Memoizes a theme-to-stylesheet conversion function. | ||
| callback: (theme: Theme) => Styles | ||
| ): (theme: Theme) => NativeStyles<Styles> { | ||
| const cache: Array<{ theme: Theme; style: NativeStyles<Styles> }> = [] | ||
| ): (theme: Theme) => Styles { | ||
| const cache: Array<{ theme: Theme; style: Styles }> = [] | ||
@@ -19,0 +15,0 @@ return function styleCache(theme: Theme) { |
@@ -45,6 +45,4 @@ // @flow | ||
| type NativeStyles<Styles: Object> = $ObjMap<Styles, (style: any) => mixed> | ||
| declare export function cacheStyles<Theme, Styles: Object>( | ||
| callback: (theme: Theme) => Styles | ||
| ): (theme: Theme) => NativeStyles<Styles> | ||
| ): (theme: Theme) => Styles |
@@ -31,7 +31,7 @@ import * as React from 'react' | ||
| // React component access: | ||
| ThemeProvider: React.ComponentClass<ProviderProps> | ||
| ThemeProvider: React.ComponentType<ProviderProps> | ||
| useTheme(): Theme | ||
| withTheme<Props extends { theme: Theme }>( | ||
| Component: React.ComponentType<Props> | ||
| ): React.FunctionComponent<RemoveTheme<Props>> | ||
| ): React.ComponentType<RemoveTheme<Props>> | ||
| } | ||
@@ -38,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
20907
-0.96%330
-2.37%