mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-13 01:18:18 +08:00
fix: runtime error with undefined styles
This commit is contained in:
5
.changeset/bright-rice-drive.md
Normal file
5
.changeset/bright-rice-drive.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"nativewind": patch
|
||||
---
|
||||
|
||||
fix runtime error with undefined styles
|
||||
@@ -44,7 +44,7 @@ export function useTailwind<T>({
|
||||
return [
|
||||
store.subscribe,
|
||||
store.getSnapshot,
|
||||
(snapshot: Snapshot) => snapshot[selector],
|
||||
(snapshot: Snapshot): StylesArray | undefined => snapshot[selector],
|
||||
];
|
||||
}, [
|
||||
store,
|
||||
@@ -84,11 +84,11 @@ export function useTailwind<T>({
|
||||
|
||||
if (flatten) {
|
||||
const flatStyles: StylesArray = [StyleSheet.flatten(stylesArray)];
|
||||
flatStyles.mask = styles.mask;
|
||||
flatStyles.mask = styles?.mask;
|
||||
return flatStyles;
|
||||
}
|
||||
|
||||
stylesArray.mask = styles.mask;
|
||||
stylesArray.mask = styles?.mask;
|
||||
return stylesArray;
|
||||
}, [styles, inlineStyles, additionalStyles, flatten]) as StylesArray<T>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user