(
props: TProps,
{
theme,
dimensions,
}: {
theme: Theme;
dimensions: Dimensions | null;
},
)
| 40 | |
| 41 | // TInputProps is a superset of TProps since TProps are only the Restyle Props |
| 42 | const buildStyle = ( |
| 43 | props: TProps, |
| 44 | { |
| 45 | theme, |
| 46 | dimensions, |
| 47 | }: { |
| 48 | theme: Theme; |
| 49 | dimensions: Dimensions | null; |
| 50 | }, |
| 51 | ): RNStyle => { |
| 52 | const styles: ViewStyle = {}; |
| 53 | const options = {theme, dimensions}; |
| 54 | // We make the assumption that the props object won't have extra prototype keys. |
| 55 | // eslint-disable-next-line guard-for-in |
| 56 | for (const key in props) { |
| 57 | const mappedProps = funcsMap[key](props, options); |
| 58 | // eslint-disable-next-line guard-for-in |
| 59 | for (const mappedKey in mappedProps) { |
| 60 | styles[mappedKey as keyof ViewStyle] = mappedProps[mappedKey]; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | const {stylesheet} = StyleSheet.create({stylesheet: styles}); |
| 65 | return stylesheet; |
| 66 | }; |
| 67 | return { |
| 68 | buildStyle, |
| 69 | properties, |
no outgoing calls
no test coverage detected
searching dependent graphs…