diff --git a/packages/uniwind/src/core/native/store.ts b/packages/uniwind/src/core/native/store.ts index 62c6e337..73e728d6 100644 --- a/packages/uniwind/src/core/native/store.ts +++ b/packages/uniwind/src/core/native/store.ts @@ -11,9 +11,10 @@ type StylesResult = { styles: RNStyle dependencies: Array dependencySum: number + hasDataAttributes: boolean } -const emptyState: StylesResult = { styles: {}, dependencies: [], dependencySum: 0 } +const emptyState: StylesResult = { styles: {}, dependencies: [], dependencySum: 0, hasDataAttributes: false } class UniwindStoreBuilder { runtime = UniwindRuntime @@ -28,7 +29,11 @@ class UniwindStoreBuilder { return emptyState } - const cacheKey = `${className}${state?.isDisabled ?? false}${state?.isFocused ?? false}${state?.isPressed ?? false}` + const stateFlags = (state ? 8 : 0) + | (state?.isDisabled ? 4 : 0) + | (state?.isFocused ? 2 : 0) + | (state?.isPressed ? 1 : 0) + const cacheKey = `${className}:${stateFlags}` if (this.cache.has(cacheKey)) { return this.cache.get(cacheKey)!