-
Notifications
You must be signed in to change notification settings - Fork 16
Description
react-native-figma-squircle + shadow styles
Reproduce:
- Disable new arch with RCT_NEW_ARCH_ENABLED=0 pod install
<SquircleView
squircleParams={{
cornerSmoothing: 1,
cornerRadius: 20,
strokeColor: 'green',
strokeWidth: 1,
fillColor: 'green',
}}
style={[
getShadow(shadow),
style,
]}
{...props}
/>
const SHADOW_MAP: Record<TShadow, TShadowConfig> = {
0: {height: 0, shadowRadius: 0, elevation: 0},
100: {height: 2, shadowRadius: 4, elevation: 2},
200: {height: 4, shadowRadius: 6, elevation: 4},
300: {height: 6, shadowRadius: 8, elevation: 6},
400: {height: 6, shadowRadius: 12, elevation: 8},
500: {height: 6, shadowRadius: 14, elevation: 10},
600: {height: 8, shadowRadius: 18, elevation: 12},
700: {height: 8, shadowRadius: 22, elevation: 14},
800: {height: 8, shadowRadius: 28, elevation: 18},
};
export const getShadow = (level: TShadow): ViewStyle => {
const config = SHADOW_MAP[level];
return {
shadowColor: COLORS.main.shadow,
shadowOffset: {width: 0, height: config.height},
shadowOpacity: 0.12,
shadowRadius: config.shadowRadius,
elevation: config.elevation,
};
};
Setting backgroundColor in style is not a fix, in this case cornerSmoothing is not visible.
