Remove silly test, use for...in
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import {test, expect} from '@jest/globals'
|
||||
|
||||
import * as utils from '../utils'
|
||||
|
||||
test(`web`, async () => {
|
||||
const result = utils.web('foo')
|
||||
expect(result).toBe(undefined)
|
||||
})
|
||||
|
||||
test(`ios`, async () => {
|
||||
const result = utils.ios('foo')
|
||||
// TODO will fail in CI
|
||||
expect(result).toBe('foo')
|
||||
})
|
||||
|
||||
test(`android`, async () => {
|
||||
const result = utils.android('foo')
|
||||
expect(result).toBe(undefined)
|
||||
})
|
||||
|
||||
test(`native`, async () => {
|
||||
const result = utils.native('foo')
|
||||
expect(result).toBe('foo')
|
||||
})
|
||||
@@ -109,13 +109,16 @@ export function createSystem<
|
||||
const {theme} = useTheme()
|
||||
const breakpoints = useBreakpoints()
|
||||
return React.useMemo(() => {
|
||||
return Object.entries(styles).reduce((acc, [key, style]) => {
|
||||
const acc = {} as {
|
||||
[Name in keyof O]: ReturnType<SystemTheme['style']>['styles']
|
||||
}
|
||||
for (const key in styles) {
|
||||
acc[key as keyof O] = theme.style(
|
||||
style as StylesAndProps,
|
||||
styles[key] as StylesAndProps,
|
||||
breakpoints.active,
|
||||
).styles
|
||||
return acc
|
||||
}, {} as {[Name in keyof O]: ReturnType<SystemTheme['style']>['styles']})
|
||||
}
|
||||
return acc
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [styles, breakpoints.current, theme])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user