frontend: type the cloned children in Grid
Pedro Lucas Porcellis porcellis@eletrotupi.com · 12 days ago
d3148e518650704af20e24cef5d4d463e7ea7858 Browse filesParents
32b1e68Changed files
1
Additions
+3
Deletions
-3
frontend/components/ui/LayoutHelpers.tsx
1 1
import React from 'react';
2 -
import { View, ViewStyle } from 'react-native';
2 +
import { View, ViewStyle, type StyleProp } from 'react-native';
3 3
import { Spacing } from '@/constants/theme';
4 4
5 5
interface FlexLayoutProps {
6 6
children: React.ReactNode;
7 7
gap?: number;
60 60
},
61 61
style,
62 62
]}
63 63
>
64 64
{React.Children.map(children, (child) =>
65 -
React.cloneElement(child as React.ReactElement, {
65 +
React.cloneElement(child as React.ReactElement<{ style?: StyleProp<ViewStyle> }>, {
66 66
style: [
67 67
{
68 68
width: `${100 / columns - (gap * (columns - 1)) / columns}%`,
69 69
},
70 -
(child as React.ReactElement).props.style,
70 +
(child as React.ReactElement<{ style?: StyleProp<ViewStyle> }>).props.style,
71 71
],
72 72
})
73 73
)}
74 74
</View>
75 75
);
108 108
]}
109 109
>
110 110
{children}
111 111
</View>
112 112
);