1import { StyleSheet } from 'react-native';
2// Remove the unsupported web styles from the style object
3// to prevent crashing.
4const WEB_STYLES = [
5    'backdropFilter',
6    'animationDelay',
7    'animationDirection',
8    'animationDuration',
9    'animationFillMode',
10    'animationName',
11    'animationIterationCount',
12    'animationPlayState',
13    'animationTimingFunction',
14    'backgroundAttachment',
15    'backgroundBlendMode',
16    'backgroundClip',
17    'backgroundImage',
18    'backgroundOrigin',
19    'backgroundPosition',
20    'backgroundRepeat',
21    'backgroundSize',
22    'boxShadow',
23    'boxSizing',
24    'clip',
25    'cursor',
26    'filter',
27    'gridAutoColumns',
28    'gridAutoFlow',
29    'gridAutoRows',
30    'gridColumnEnd',
31    'gridColumnGap',
32    'gridColumnStart',
33    'gridRowEnd',
34    'gridRowGap',
35    'gridRowStart',
36    'gridTemplateColumns',
37    'gridTemplateRows',
38    'gridTemplateAreas',
39    'outline',
40    'outlineColor',
41    'overflowX',
42    'overflowY',
43    'overscrollBehavior',
44    'overscrollBehaviorX',
45    'overscrollBehaviorY',
46    'perspective',
47    'perspectiveOrigin',
48    'touchAction',
49    'transformOrigin',
50    'transitionDelay',
51    'transitionDuration',
52    'transitionProperty',
53    'transitionTimingFunction',
54    'userSelect',
55    'willChange',
56];
57export function filterStyles(styleProp) {
58    if (!styleProp) {
59        return styleProp;
60    }
61    const style = StyleSheet.flatten(styleProp);
62    const filteredStyle = Object.fromEntries(Object.entries(style).filter(([k]) => !WEB_STYLES.includes(k)));
63    return processNativeStyles(filteredStyle);
64}
65function processNativeStyles(style) {
66    if (!style)
67        return style;
68    if (style.visibility) {
69        if (style.visibility === 'hidden') {
70            // style.display = "none";
71            style.opacity = 0;
72        }
73        delete style.visibility;
74    }
75    if (style.position) {
76        if (!['absolute', 'relative'].includes(style.position)) {
77            console.warn(`Unsupported position: '${style.position}'`);
78            style.position = 'relative';
79        }
80    }
81    return style;
82}
83//# sourceMappingURL=filterStyles.js.map