-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7594 from ahmdshrif/fix/rtl-mode
Fix: App changes positions of Ui elements when phone language RTL
- Loading branch information
Showing
11 changed files
with
66 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import _ from 'underscore'; | ||
// eslint-disable-next-line no-restricted-imports | ||
import {TextInput} from 'react-native'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const propTypes = { | ||
/** A ref to forward to the text input */ | ||
forwardedRef: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
forwardedRef: () => {}, | ||
}; | ||
|
||
const RNTextInput = props => ( | ||
<TextInput | ||
ref={(ref) => { | ||
if (!_.isFunction(props.forwardedRef)) { | ||
return; | ||
} | ||
props.forwardedRef(ref); | ||
}} | ||
|
||
// By default, align input to the left to override right alignment in RTL mode which is not yet supported in the App. | ||
// eslint-disable-next-line react/jsx-props-no-multi-spaces | ||
textAlign="left" | ||
|
||
// eslint-disable-next-line | ||
{...props} | ||
/> | ||
); | ||
|
||
RNTextInput.propTypes = propTypes; | ||
RNTextInput.defaultProps = defaultProps; | ||
RNTextInput.displayName = 'RNTextInput'; | ||
|
||
export default React.forwardRef((props, ref) => ( | ||
/* eslint-disable-next-line react/jsx-props-no-spreading */ | ||
<RNTextInput {...props} forwardedRef={ref} /> | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters