diff --git a/packages/docs/src/pages/docs/apis/i18n-manager.md b/packages/docs/src/pages/docs/apis/i18n-manager.md index d45e3ed2..7a331a66 100644 --- a/packages/docs/src/pages/docs/apis/i18n-manager.md +++ b/packages/docs/src/pages/docs/apis/i18n-manager.md @@ -35,10 +35,6 @@ Force the application to display in RTL mode. Determine how the application is handling bidi layout. {% endcall %} -{% call macro.prop('swapLeftAndRightInRTL', '(boolean) => void') %} -Control whether the application swaps `left`/`right` styles in RTL mode. It is recommended that applications rely on `start`/`end` styles and disable automatic BiDi-flipping of `left`/`right` styles. -{% endcall %} - {% call macro.prop('setPreferredLanguageRTL', '(boolean) => void') %} Set the application's preferred writing direction to RTL. You may need to infer the user's preferred locale on the server (from HTTP headers) and decide whether it's an RTL language. (Web-only) {% endcall %} @@ -51,10 +47,6 @@ The object returned by `I18nManager.getConstants()`. Whether the application is currently in RTL mode. {% endcall %} -{% call macro.prop('doLeftAndRightSwapInRTL', 'boolean = true') %} -Whether the application swaps left/right styles in RTL mode. -{% endcall %} - --- ## Examples diff --git a/packages/docs/src/pages/docs/concepts/localization.md b/packages/docs/src/pages/docs/concepts/localization.md index 0e7fcef6..edbcb26d 100644 --- a/packages/docs/src/pages/docs/concepts/localization.md +++ b/packages/docs/src/pages/docs/concepts/localization.md @@ -30,7 +30,7 @@ return ( ); ``` -The non-standard [direction-independent style properties]({{ '/docs/styling/#non-standard-properties' | url }}) should also be used as much as possible. {{ site.name }} will automatically flip the direction of these properties when the application is re-rendered after using `I18nManager` to enable RTL mode. +The non-standard [direction-independent style properties]({{ '/docs/styling/#non-standard-properties' | url }}) should also be used as much as possible. {{ site.name }} will automatically flip the direction of these properties within subtrees based on the value of the `dir` prop on `View` or `Text` elements in the ancestral hierarchy. ```jsx // "start" is "left" for LTR and "right" for RTL diff --git a/packages/examples/pages/app-registry/index.js b/packages/examples/pages/app-registry/index.js new file mode 100644 index 00000000..770368a7 --- /dev/null +++ b/packages/examples/pages/app-registry/index.js @@ -0,0 +1,51 @@ +import React from 'react'; +import { AppRegistry, Text, StyleSheet } from 'react-native'; +import Example from '../../shared/example'; + +function App() { + return Should be red and bold; +} + +const styles = StyleSheet.create({ + text: { + color: 'red', + fontWeight: 'bold' + } +}); + +AppRegistry.registerComponent('App', () => App); + +export default function AppStatePage() { + const iframeRef = React.useRef(null); + const shadowRef = React.useRef(null); + + React.useEffect(() => { + const iframeElement = iframeRef.current; + const iframeBody = iframeElement.contentWindow.document.body; + const iframeRootTag = document.createElement('div'); + iframeRootTag.id = 'iframe-root'; + iframeBody.appendChild(iframeRootTag); + AppRegistry.runApplication('App', { rootTag: iframeRootTag }); + + const shadowElement = shadowRef.current; + const shadowRoot = shadowElement.attachShadow({ mode: 'open' }); + const shadowRootTag = document.createElement('div'); + shadowRootTag.id = 'shadow-root'; + shadowRoot.appendChild(shadowRootTag); + AppRegistry.runApplication('App', { rootTag: shadowRootTag }); + + return () => { + AppRegistry.unmountApplicationComponentAtRootTag(iframeRootTag); + AppRegistry.unmountApplicationComponentAtRootTag(shadowRootTag); + }; + }, []); + + return ( + + Styles in iframe +