Skip to content

Commit 76dc1ab

Browse files
committed
Use start / end styles instead of left / right
1 parent f7f1ab5 commit 76dc1ab

3 files changed

Lines changed: 30 additions & 30 deletions

File tree

‎packages/react-native/Libraries/Modal/Modal.js‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import * as React from 'react';
2222
const ScrollView = require('../Components/ScrollView/ScrollView').default;
2323
const View = require('../Components/View/View').default;
2424
const AppContainer = require('../ReactNative/AppContainer').default;
25-
const I18nManager = require('../ReactNative/I18nManager').default;
2625
const {RootTagContext} = require('../ReactNative/RootTag');
2726
const StyleSheet = require('../StyleSheet/StyleSheet').default;
2827

@@ -367,17 +366,13 @@ class Modal extends React.Component<ModalProps, ModalState> {
367366
}
368367
}
369368

370-
const side = I18nManager.getConstants().isRTL ? 'right' : 'left';
371369
const styles = StyleSheet.create({
372370
modal: {
373371
position: 'absolute',
374372
},
375-
/* $FlowFixMe[incompatible-type] Natural Inference rollout. See
376-
* https://fburl.com/workplace/6291gfvu */
377373
container: {
378-
// $FlowFixMe[incompatible-type]
379-
[side]: 0,
380374
top: 0,
375+
start: 0,
381376
flex: 1,
382377
backgroundColor: 'white',
383378
},

‎packages/react-native/Libraries/Modal/__tests__/Modal-itest.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ import {createRef} from 'react';
1919
import {Modal} from 'react-native';
2020

2121
const DEFAULT_MODAL_CHILD_VIEW = (
22-
<rn-view backgroundColor="rgba(255, 255, 255, 1)" flex="1" left="0" top="0" />
22+
<rn-view
23+
backgroundColor="rgba(255, 255, 255, 1)"
24+
flex="1"
25+
start="0"
26+
top="0"
27+
/>
2328
);
2429

2530
describe('<Modal>', () => {

‎packages/rn-tester/js/examples/RTL/RTLExample.js‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const IconsExample = withRTLState(({isRTL, setRTL}) => {
124124
Without directional meaning
125125
</RNTexterText>
126126
</View>
127-
<View style={styles.rightAlignStyle}>
127+
<View style={styles.endAlignStyle}>
128128
<Image
129129
source={require('../../assets/poke.png')}
130130
style={[styles.image, styles.withRTLStyle]}
@@ -231,7 +231,7 @@ class RTLToggleExample extends React.Component<any, RTLToggleState> {
231231
<View style={styles.switchRowSwitchView}>
232232
<Switch
233233
onValueChange={this._onDirectionChange}
234-
style={styles.rightAlignStyle}
234+
style={styles.endAlignStyle}
235235
value={this.state.isRTL}
236236
/>
237237
</View>
@@ -349,8 +349,8 @@ const PaddingExample = withRTLState(({isRTL, setRTL}) => {
349349
backgroundColor: 'white',
350350
paddingTop: 5,
351351
paddingBottom: 5,
352-
borderLeftWidth: 1,
353-
borderRightWidth: 1,
352+
borderStartWidth: 1,
353+
borderEndWidth: 1,
354354
borderColor: 'gray',
355355
}}>
356356
<RTLToggler setRTL={setRTL} isRTL={isRTL} />
@@ -383,8 +383,8 @@ const MarginExample = withRTLState(({isRTL, setRTL}) => {
383383
paddingBottom: 5,
384384
marginStart: 50,
385385
marginEnd: 10,
386-
borderLeftWidth: 1,
387-
borderRightWidth: 1,
386+
borderStartWidth: 1,
387+
borderEndWidth: 1,
388388
borderColor: 'gray',
389389
}}>
390390
<RTLToggler setRTL={setRTL} isRTL={isRTL} />
@@ -484,8 +484,8 @@ const BorderColorExample = withRTLState(({isRTL, setRTL}) => {
484484
style={{
485485
borderStartColor: 'red',
486486
borderEndColor: 'green',
487-
borderLeftWidth: 20,
488-
borderRightWidth: 20,
487+
borderStartWidth: 20,
488+
borderEndWidth: 20,
489489
padding: 10,
490490
}}>
491491
<View>
@@ -681,16 +681,16 @@ const styles = StyleSheet.create({
681681
switchRowSwitchView: {
682682
flex: 3,
683683
},
684-
rightAlignStyle: {
685-
right: 10,
684+
endAlignStyle: {
685+
end: 10,
686686
position: 'absolute',
687687
},
688688
list: {
689689
height: 120,
690690
marginBottom: 5,
691691
borderTopWidth: 0.5,
692-
borderLeftWidth: 0.5,
693-
borderRightWidth: 0.5,
692+
borderStartWidth: 0.5,
693+
borderEndWidth: 0.5,
694694
borderColor: '#e5e5e5',
695695
},
696696
row: {
@@ -720,7 +720,7 @@ const styles = StyleSheet.create({
720720
transform: [{scaleX: IS_RTL ? -1 : 1}],
721721
},
722722
image: {
723-
left: 30,
723+
start: 30,
724724
width: 48,
725725
height: 48,
726726
},
@@ -750,11 +750,11 @@ const styles = StyleSheet.create({
750750
fontSizeExtraSmall: {
751751
fontSize: 8,
752752
},
753-
textAlignLeft: {
754-
textAlign: 'left',
753+
textAlignStart: {
754+
textAlign: 'start',
755755
},
756-
textAlignRight: {
757-
textAlign: 'right',
756+
textAlignEnd: {
757+
textAlign: 'end',
758758
},
759759
textBox: {
760760
width: 28,
@@ -805,34 +805,34 @@ exports.examples = [
805805
},
806806
},
807807
{
808-
title: "Using textAlign: 'left'",
808+
title: "Using textAlign: 'start'",
809809
description: ('In iOS/Android, text alignment flips regardless of ' +
810810
'languages or text content.') as string,
811811
render: function (): React.MixedElement {
812812
return (
813813
<TextAlignmentExample
814-
style={[styles.fontSizeSmall, styles.textAlignLeft]}
814+
style={[styles.fontSizeSmall, styles.textAlignStart]}
815815
/>
816816
);
817817
},
818818
},
819819
{
820-
title: "Using textAlign: 'right'",
820+
title: "Using textAlign: 'end'",
821821
description: ('In iOS/Android, text alignment flips regardless of ' +
822822
'languages or text content.') as string,
823823
render: function (): React.MixedElement {
824824
return (
825825
<TextAlignmentExample
826-
style={[styles.fontSizeSmall, styles.textAlignRight]}
826+
style={[styles.fontSizeSmall, styles.textAlignEnd]}
827827
/>
828828
);
829829
},
830830
},
831831
{
832-
title: "Using textAlign: 'right' for TextInput",
832+
title: "Using textAlign: 'end' for TextInput",
833833
description: 'Flip TextInput direction to RTL' as string,
834834
render: function (): React.MixedElement {
835-
return <TextInputExample style={[styles.textAlignRight]} />;
835+
return <TextInputExample style={[styles.textAlignEnd]} />;
836836
},
837837
},
838838
{

0 commit comments

Comments
 (0)