From 7ffaf592d58f1b4ac6275a92cee3d85bfd6e6bb3 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Thu, 5 Jan 2017 12:44:43 -0800 Subject: [PATCH] [fix] Text automatic writing direction detection --- .../Text/__tests__/__snapshots__/index-test.js.snap | 8 ++++++-- src/components/Text/index.js | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Text/__tests__/__snapshots__/index-test.js.snap b/src/components/Text/__tests__/__snapshots__/index-test.js.snap index a229e53d..fafce863 100644 --- a/src/components/Text/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/Text/__tests__/__snapshots__/index-test.js.snap @@ -18,7 +18,8 @@ rn-paddingBottom:0px rn-paddingLeft:0px rn-textDecoration:none rn-whiteSpace:pre-wrap -rn-wordWrap:break-word"> +rn-wordWrap:break-word" + dir="auto"> children `; @@ -45,6 +46,7 @@ rn-paddingLeft:0px rn-textDecoration:none rn-whiteSpace:pre-wrap rn-wordWrap:break-word" + dir="auto" onClick={[Function]} onKeyDown={[Function]} style={Object {}} @@ -71,7 +73,8 @@ rn-paddingBottom:0px rn-paddingLeft:0px rn-textDecoration:none rn-whiteSpace:pre-wrap -rn-wordWrap:break-word" /> +rn-wordWrap:break-word" + dir="auto" /> `; exports[`components/Text prop "selectable" 2`] = ` @@ -96,5 +99,6 @@ rn-textDecoration:none rn-userSelect:none rn-whiteSpace:pre-wrap rn-wordWrap:break-word" + dir="auto" style={Object {}} /> `; diff --git a/src/components/Text/index.js b/src/components/Text/index.js index 5f3957b7..ed1462c7 100644 --- a/src/components/Text/index.js +++ b/src/components/Text/index.js @@ -56,6 +56,8 @@ class Text extends Component { numberOfLines === 1 && styles.singleLineStyle, onPress && styles.pressable ]; + // allow browsers to automatically infer the language writing direction + otherProps.dir = 'auto'; return createDOMElement('span', otherProps); }