Comparing version 4.0.0 to 4.0.1
@@ -15,13 +15,13 @@ import { Platform } from 'react-native'; | ||
$8: 512, | ||
0: 0, | ||
1: 4, | ||
2: 8, | ||
3: 16, | ||
4: 32, | ||
5: 64, | ||
6: 128, | ||
7: 256, | ||
8: 512, | ||
// 0: 0, | ||
// 1: 4, | ||
// 2: 8, | ||
// 3: 16, | ||
// 4: 32, | ||
// 5: 64, | ||
// 6: 128, | ||
// 7: 256, | ||
// 8: 512, | ||
}, | ||
fontSizes: [12, 14, 16, 20, 24, 32, 48, 64, 72], | ||
// fontSizes: [12, 14, 16, 20, 24, 32, 48, 64, 72], | ||
}; | ||
@@ -187,6 +187,5 @@ const responsive = (styles, { breakpoint } = {}) => (theme) => { | ||
const scaleName = prop in scales ? scales[prop] : undefined; | ||
// @ts-expect-error | ||
const scale = get(theme, scaleName, get(theme, prop, {})); | ||
const transform = get(transforms, prop, get); | ||
const value = transform(scale, val, val); | ||
// const transform = get(transforms, prop, get) | ||
const value = get(scale, val, val); | ||
if (key === 'fontFamily') { | ||
@@ -193,0 +192,0 @@ // ok, building off of fontWeight prior |
@@ -1,2 +0,2 @@ | ||
import { useCallback, useRef } from 'react'; | ||
import { useRef } from 'react'; | ||
import { useDripsyTheme } from './use-dripsy-theme'; | ||
@@ -9,4 +9,4 @@ import { css } from './css'; | ||
const breakpoint = useBreakpointIndex(); | ||
const cache = useRef({}); | ||
return useCallback((sx, { themeKey } = {}) => { | ||
const cache = useRef(new Map()); | ||
return (sx, { themeKey } = {}) => { | ||
const themedStyle = css(sx, breakpoint)({ | ||
@@ -17,8 +17,8 @@ theme, | ||
const hash = stableHash(themedStyle); | ||
if (!cache.current[hash]) { | ||
cache.current[hash] = themedStyle; | ||
if (!cache.current.has(hash)) { | ||
cache.current.set(hash, themedStyle); | ||
} | ||
return cache.current[hash]; | ||
}, [breakpoint, theme]); | ||
return cache.current.get(hash); | ||
}; | ||
} | ||
//# sourceMappingURL=use-sx.js.map |
@@ -6,4 +6,16 @@ # Change Log | ||
## [4.0.1](https://github.com/nandorojo/dripsy/compare/v4.0.0...v4.0.1) (2023-04-05) | ||
### Bug Fixes | ||
* pressable types ([a33a05c](https://github.com/nandorojo/dripsy/commit/a33a05cb62f4d4ae8640e67c123d77fb551be746)) | ||
* transforms ([f662761](https://github.com/nandorojo/dripsy/commit/f662761a205480e4f04f7e8ce51b7cfe331eeeda)) | ||
**Note:** Version bump only for package dripsy | ||
@@ -10,0 +22,0 @@ |
{ | ||
"name": "dripsy", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "🍷 A super-simple responsive design system for React Native Web.", | ||
@@ -89,3 +89,3 @@ "main": "build/index.js", | ||
"sideEffects": false, | ||
"gitHead": "30b0c4ac0c984a8a22cdf1745da6be0b735f502f" | ||
"gitHead": "f92a68ef234d65349ed83ec2fd63b1875eefe039" | ||
} |
@@ -14,21 +14,21 @@ import { useCallback, useRef } from 'react' | ||
const cache = useRef<Record<string, StyleProp<any>>>({}) | ||
const cache = useRef<Map<string, StyleProp<any>>>(new Map()) | ||
return useCallback( | ||
(sx: SxProp, { themeKey }: { themeKey?: keyof DripsyFinalTheme } = {}) => { | ||
const themedStyle = css( | ||
sx, | ||
breakpoint | ||
)({ | ||
theme, | ||
themeKey, | ||
}) | ||
const hash = stableHash(themedStyle) | ||
if (!cache.current[hash]) { | ||
cache.current[hash] = themedStyle | ||
} | ||
return cache.current[hash] | ||
}, | ||
[breakpoint, theme] | ||
) | ||
return ( | ||
sx: SxProp, | ||
{ themeKey }: { themeKey?: keyof DripsyFinalTheme } = {} | ||
) => { | ||
const themedStyle = css( | ||
sx, | ||
breakpoint | ||
)({ | ||
theme, | ||
themeKey, | ||
}) | ||
const hash = stableHash(themedStyle) | ||
if (!cache.current.has(hash)) { | ||
cache.current.set(hash, themedStyle) | ||
} | ||
return cache.current.get(hash) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
299165
4449