Skip to content

Commit 7df9240

Browse files
authored
Fix issue with transparent color swatch as square (#3260)
1 parent 95d4892 commit 7df9240

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

demo/src/screens/componentScreens/ColorSwatchScreen.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,26 @@ export default class ColorSwatchScreen extends Component {
6060

6161
return (
6262
<ScrollView>
63-
<View flex center useSafeArea>
63+
<View flex center paddingT-s5>
6464
<Text margin-5 text60>
6565
Single ColorSwatch
6666
</Text>
67-
<View row>
67+
<View row spread gap-15>
6868
<View>
6969
<ColorSwatch selected={selected} onPress={this.onPress}/>
7070
</View>
71-
<View>
72-
<ColorSwatch color={Colors.$backgroundMajorLight}/>
73-
<Text text90R>Disabled</Text>
74-
</View>
7571
<View>
7672
<ColorSwatch unavailable onPress={this.unavailableOnPress} color={Colors.yellow10}/>
7773
<Text text90R>Unavailable</Text>
7874
</View>
75+
<View>
76+
<ColorSwatch transparent/>
77+
<Text text90R>Transparent</Text>
78+
</View>
79+
<View center>
80+
<ColorSwatch style={{borderRadius: 0}} transparent/>
81+
<Text text90R>Square</Text>
82+
</View>
7983
</View>
8084

8185
<Text marginT-20 text60>
413 Bytes
Loading
162 Bytes
Loading
372 Bytes
Loading
-912 Bytes
Loading
-2.23 KB
Loading

src/components/colorSwatch/colorSwatch.api.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
{"name": "onPress", "type": "(value: string, colorInfo: ColorInfo) => void", "description": "Callback from press event"},
2020
{"name": "index", "type": "number", "description": "The index of the Swatch if in array"},
2121
{"name": "style", "type": "ViewStyle", "description": "Component's style"},
22-
{"name": "testID", "type": "string", "description": "The test id for e2e tests"},
2322
{"name": "unavailable", "type": "boolean", "description": "Is the initial state is unavailable"},
2423
{"name": "size", "type": "number", "description": "Color Swatch size"}
2524
],

src/components/colorSwatch/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {PureComponent} from 'react';
22
import {StyleSheet, Animated, Easing, LayoutChangeEvent, StyleProp, ViewStyle} from 'react-native';
33
import Assets from '../../assets';
4-
import {BorderRadiuses, Colors} from '../../style';
4+
import {Colors} from '../../style';
55
import {asBaseComponent, BaseComponentInjectedProps, Constants, ColorsModifiers} from '../../commons/new';
66
import View from '../view';
77
import TouchableOpacity from '../touchableOpacity';
@@ -228,14 +228,15 @@ function createStyles({color = Colors.grey30}) {
228228
backgroundColor: color,
229229
borderWidth: color === 'transparent' ? undefined : 1,
230230
borderColor: Colors.rgba(Colors.$outlineDisabledHeavy, 0.2),
231-
margin: SWATCH_MARGIN
231+
margin: SWATCH_MARGIN,
232+
overflow: 'hidden'
232233
},
233234
transparentImage: {
234235
...StyleSheet.absoluteFillObject,
235236
width: DEFAULT_SIZE,
236237
height: DEFAULT_SIZE,
237238
borderWidth: 1,
238-
borderRadius: BorderRadiuses.br100,
239+
// borderRadius: BorderRadiuses.br100,
239240
borderColor: Colors.rgba(Colors.$outlineDisabledHeavy, 0.2)
240241
},
241242
unavailable: {

0 commit comments

Comments
 (0)