Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/react-native/Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import * as React from 'react';
const ScrollView = require('../Components/ScrollView/ScrollView').default;
const View = require('../Components/View/View').default;
const AppContainer = require('../ReactNative/AppContainer').default;
const I18nManager = require('../ReactNative/I18nManager').default;
const {RootTagContext} = require('../ReactNative/RootTag');
const StyleSheet = require('../StyleSheet/StyleSheet').default;

Expand Down Expand Up @@ -367,17 +366,13 @@ class Modal extends React.Component<ModalProps, ModalState> {
}
}

const side = I18nManager.getConstants().isRTL ? 'right' : 'left';
const styles = StyleSheet.create({
modal: {
position: 'absolute',
},
/* $FlowFixMe[incompatible-type] Natural Inference rollout. See
* https://fburl.com/workplace/6291gfvu */
container: {
// $FlowFixMe[incompatible-type]
[side]: 0,
top: 0,
start: 0,
flex: 1,
backgroundColor: 'white',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import {createRef} from 'react';
import {Modal} from 'react-native';

const DEFAULT_MODAL_CHILD_VIEW = (
<rn-view backgroundColor="rgba(255, 255, 255, 1)" flex="1" left="0" top="0" />
<rn-view
backgroundColor="rgba(255, 255, 255, 1)"
flex="1"
start="0"
top="0"
/>
);

describe('<Modal>', () => {
Expand Down
46 changes: 23 additions & 23 deletions packages/rn-tester/js/examples/RTL/RTLExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const IconsExample = withRTLState(({isRTL, setRTL}) => {
Without directional meaning
</RNTexterText>
</View>
<View style={styles.rightAlignStyle}>
<View style={styles.endAlignStyle}>
<Image
source={require('../../assets/poke.png')}
style={[styles.image, styles.withRTLStyle]}
Expand Down Expand Up @@ -231,7 +231,7 @@ class RTLToggleExample extends React.Component<any, RTLToggleState> {
<View style={styles.switchRowSwitchView}>
<Switch
onValueChange={this._onDirectionChange}
style={styles.rightAlignStyle}
style={styles.endAlignStyle}
value={this.state.isRTL}
/>
</View>
Expand Down Expand Up @@ -349,8 +349,8 @@ const PaddingExample = withRTLState(({isRTL, setRTL}) => {
backgroundColor: 'white',
paddingTop: 5,
paddingBottom: 5,
borderLeftWidth: 1,
borderRightWidth: 1,
borderStartWidth: 1,
borderEndWidth: 1,
borderColor: 'gray',
}}>
<RTLToggler setRTL={setRTL} isRTL={isRTL} />
Expand Down Expand Up @@ -383,8 +383,8 @@ const MarginExample = withRTLState(({isRTL, setRTL}) => {
paddingBottom: 5,
marginStart: 50,
marginEnd: 10,
borderLeftWidth: 1,
borderRightWidth: 1,
borderStartWidth: 1,
borderEndWidth: 1,
borderColor: 'gray',
}}>
<RTLToggler setRTL={setRTL} isRTL={isRTL} />
Expand Down Expand Up @@ -484,8 +484,8 @@ const BorderColorExample = withRTLState(({isRTL, setRTL}) => {
style={{
borderStartColor: 'red',
borderEndColor: 'green',
borderLeftWidth: 20,
borderRightWidth: 20,
borderStartWidth: 20,
borderEndWidth: 20,
padding: 10,
}}>
<View>
Expand Down Expand Up @@ -681,16 +681,16 @@ const styles = StyleSheet.create({
switchRowSwitchView: {
flex: 3,
},
rightAlignStyle: {
right: 10,
endAlignStyle: {
end: 10,
position: 'absolute',
},
list: {
height: 120,
marginBottom: 5,
borderTopWidth: 0.5,
borderLeftWidth: 0.5,
borderRightWidth: 0.5,
borderStartWidth: 0.5,
borderEndWidth: 0.5,
borderColor: '#e5e5e5',
},
row: {
Expand Down Expand Up @@ -720,7 +720,7 @@ const styles = StyleSheet.create({
transform: [{scaleX: IS_RTL ? -1 : 1}],
},
image: {
left: 30,
start: 30,
width: 48,
height: 48,
},
Expand Down Expand Up @@ -750,11 +750,11 @@ const styles = StyleSheet.create({
fontSizeExtraSmall: {
fontSize: 8,
},
textAlignLeft: {
textAlign: 'left',
textAlignStart: {
textAlign: 'start',
},
textAlignRight: {
textAlign: 'right',
textAlignEnd: {
textAlign: 'end',
},
textBox: {
width: 28,
Expand Down Expand Up @@ -805,34 +805,34 @@ exports.examples = [
},
},
{
title: "Using textAlign: 'left'",
title: "Using textAlign: 'start'",
description: ('In iOS/Android, text alignment flips regardless of ' +
'languages or text content.') as string,
render: function (): React.MixedElement {
return (
<TextAlignmentExample
style={[styles.fontSizeSmall, styles.textAlignLeft]}
style={[styles.fontSizeSmall, styles.textAlignStart]}
/>
);
},
},
{
title: "Using textAlign: 'right'",
title: "Using textAlign: 'end'",
description: ('In iOS/Android, text alignment flips regardless of ' +
'languages or text content.') as string,
render: function (): React.MixedElement {
return (
<TextAlignmentExample
style={[styles.fontSizeSmall, styles.textAlignRight]}
style={[styles.fontSizeSmall, styles.textAlignEnd]}
/>
);
},
},
{
title: "Using textAlign: 'right' for TextInput",
title: "Using textAlign: 'end' for TextInput",
description: 'Flip TextInput direction to RTL' as string,
render: function (): React.MixedElement {
return <TextInputExample style={[styles.textAlignRight]} />;
return <TextInputExample style={[styles.textAlignEnd]} />;
},
},
{
Expand Down
Loading