rn-css 1.6.16 → 1.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cssToRN/index.js +2 -2
- package/dist/useTheme.js +4 -2
- package/package.json +1 -1
- package/src/cssToRN/index.ts +2 -2
- package/src/useTheme.tsx +4 -2
package/dist/cssToRN/index.js
CHANGED
package/dist/useTheme.js
CHANGED
|
@@ -23,8 +23,10 @@ exports.useTheme = useTheme;
|
|
|
23
23
|
* @returns A component with the theme prop
|
|
24
24
|
*/
|
|
25
25
|
const withTheme = (Component) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const ThemedComponent = react_1.default.forwardRef((props, ref) => {
|
|
27
|
+
const theme = (0, exports.useTheme)();
|
|
28
|
+
return react_1.default.createElement(Component, { ref: ref, theme: theme, ...props });
|
|
29
|
+
});
|
|
28
30
|
ThemedComponent.displayName = 'ThemedComponent';
|
|
29
31
|
return ThemedComponent;
|
|
30
32
|
};
|
package/package.json
CHANGED
package/src/cssToRN/index.ts
CHANGED
package/src/useTheme.tsx
CHANGED
|
@@ -20,8 +20,10 @@ export const useTheme = () => React.useContext(SharedValue)
|
|
|
20
20
|
* @returns A component with the theme prop
|
|
21
21
|
*/
|
|
22
22
|
export const withTheme = <T, >(Component: React.ComponentType<T>) => {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const ThemedComponent = React.forwardRef<React.Component, T>((props: T, ref) => {
|
|
24
|
+
const theme = useTheme()
|
|
25
|
+
return <Component ref={ref} theme={theme} {...props} />
|
|
26
|
+
})
|
|
25
27
|
ThemedComponent.displayName = 'ThemedComponent'
|
|
26
28
|
return ThemedComponent
|
|
27
29
|
}
|