[fix] Switch layout when left/right do not flip

The I18nManager can now disable the automatic BiDi flipping of
left/right, which caused the Switch layout to break in RTL mode. Change
the styles to use start/end.
This commit is contained in:
Nicolas Gallagher
2018-02-20 16:44:38 -08:00
parent cafe10d851
commit 5fb92da317

View File

@@ -135,7 +135,7 @@ class Switch extends Component<*> {
thumbStyle, thumbStyle,
value && styles.thumbOn, value && styles.thumbOn,
{ {
marginLeft: value ? multiplyStyleLengthValue(thumbWidth, -1) : 0 marginStart: value ? multiplyStyleLengthValue(thumbWidth, -1) : 0
} }
]} ]}
/> />
@@ -191,12 +191,12 @@ const styles = StyleSheet.create({
alignSelf: 'flex-start', alignSelf: 'flex-start',
borderRadius: '100%', borderRadius: '100%',
boxShadow: thumbDefaultBoxShadow, boxShadow: thumbDefaultBoxShadow,
left: '0%', start: '0%',
transform: [{ translateZ: 0 }], transform: [{ translateZ: 0 }],
transitionDuration: '0.1s' transitionDuration: '0.1s'
}, },
thumbOn: { thumbOn: {
left: '100%' start: '100%'
}, },
disabledThumb: { disabledThumb: {
backgroundColor: '#BDBDBD' backgroundColor: '#BDBDBD'