@idealyst/blur 1.2.57 → 1.2.59

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/blur",
3
- "version": "1.2.57",
3
+ "version": "1.2.59",
4
4
  "description": "Cross-platform blur component for React and React Native",
5
5
  "readme": "README.md",
6
6
  "main": "src/index.ts",
@@ -35,7 +35,7 @@
35
35
  "publish:npm": "npm publish"
36
36
  },
37
37
  "peerDependencies": {
38
- "@idealyst/components": "^1.2.57",
38
+ "@idealyst/components": "^1.2.59",
39
39
  "@react-native-community/blur": ">=4.0.0",
40
40
  "react": ">=16.8.0",
41
41
  "react-native": ">=0.60.0"
@@ -52,7 +52,7 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@idealyst/components": "^1.2.57",
55
+ "@idealyst/components": "^1.2.59",
56
56
  "@react-native-community/blur": "^4.4.1",
57
57
  "@types/react": "^19.1.0",
58
58
  "react": "^19.1.0",
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { BlurViewWebProps, BlurType } from './types';
3
+ import { flattenStyle } from './flattenStyle';
3
4
 
4
5
  /**
5
6
  * Get the background color based on blur type
@@ -43,7 +44,7 @@ export const BlurView: React.FC<BlurViewWebProps> = ({
43
44
  backdropFilter: `blur(${blurAmount}px)`,
44
45
  WebkitBackdropFilter: `blur(${blurAmount}px)`,
45
46
  backgroundColor: getBackgroundColor(blurType),
46
- ...(style as React.CSSProperties),
47
+ ...flattenStyle(style),
47
48
  };
48
49
 
49
50
  return (
@@ -0,0 +1,21 @@
1
+ import type { StyleProp } from 'react-native';
2
+
3
+ /**
4
+ * Flattens a style prop (which can be a single style, an array of styles,
5
+ * or nested arrays) into a single style object.
6
+ */
7
+ export function flattenStyle<T extends object>(
8
+ style: StyleProp<T> | React.CSSProperties | undefined
9
+ ): React.CSSProperties {
10
+ if (!style) {
11
+ return {};
12
+ }
13
+
14
+ if (Array.isArray(style)) {
15
+ return style.reduce<React.CSSProperties>((acc, s) => {
16
+ return { ...acc, ...flattenStyle(s as StyleProp<T>) };
17
+ }, {});
18
+ }
19
+
20
+ return style as React.CSSProperties;
21
+ }