Skip to content

Commit

Permalink
Temp Fix for the bleeding border issue(facebook/react-native#17998).
Browse files Browse the repository at this point in the history
Revisit  after this PR merged to RN - facebook/react-native#19451
  • Loading branch information
gbhasha committed Aug 6, 2018
1 parent 58e47bd commit 6407d0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Example/ExampleMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ExampleMain extends Component {
<View style={styles.container}>
<Text style={styles.headerText} >Default segmented control with single selection</Text>
<SegmentedControlTab
values={["one", "two"]}
selectedIndex={this.state.selectedIndex}
tabStyle={styles.tabStyle}
activeTabStyle={styles.activeTabStyle}
Expand Down Expand Up @@ -111,7 +112,7 @@ const styles = StyleSheet.create({
marginVertical: 24
},
tabStyle: {
borderColor: '#D52C43'
borderColor: '#000000'
},
activeTabStyle: {
backgroundColor: '#D52C43'
Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const SegmentedControlTab = ({
accessibilityLabels,
}) => {

const firstTabStyle = [{ borderRightWidth: values.length == 2 ? 1 : 0, borderTopLeftRadius: borderRadius, borderBottomLeftRadius: borderRadius }]
const firstTabStyle = [{ borderRightWidth: 0, borderTopLeftRadius: borderRadius, borderBottomLeftRadius: borderRadius}]
const lastTabStyle = [{ borderLeftWidth: 0, borderTopRightRadius: borderRadius, borderBottomRightRadius: borderRadius }]

return (
Expand All @@ -97,9 +97,9 @@ const SegmentedControlTab = ({
text={item}
textNumberOfLines={textNumberOfLines}
onTabPress={(index) => handleTabPress(index, selectedIndex, onTabPress)}
firstTabStyle={index === 0 ? [{ borderRightWidth: 0 }, firstTabStyle] : {}}
lastTabStyle={index === values.length - 1 ? [{ borderLeftWidth: 0 }, lastTabStyle] : {}}
tabStyle={[tabStyle, index !== 0 && index !== values.length - 1 ? { marginLeft: -1 } : {}]}
firstTabStyle={index === 0 ? [firstTabStyle] : {}}
lastTabStyle={index === values.length - 1 ? [lastTabStyle] : {}}
tabStyle={[tabStyle]}
activeTabStyle={activeTabStyle}
tabTextStyle={tabTextStyle}
activeTabTextStyle={activeTabTextStyle}
Expand Down

0 comments on commit 6407d0b

Please sign in to comment.