@livelike/react-native
Version:
LiveLike React Native package
21 lines (19 loc) • 520 B
text/typescript
import { StyleSheet } from 'react-native';
import { createStylesArg } from '../types';
export function createStyles<TStyles>({
componentStyles,
stylesProp,
}: createStylesArg<TStyles>) {
if (!stylesProp || !Object.keys(stylesProp).length) {
return componentStyles;
}
for (const style in componentStyles) {
if (stylesProp[style]) {
componentStyles[style] = StyleSheet.compose(
componentStyles[style],
stylesProp[style]
) as any;
}
}
return { ...componentStyles };
}