Skip to content

I18nManager.forceRTL doesn't apply changes on react-native components without reloading the app #16215

Closed
@hadar-ayoub

Description

Is this a bug report?

(yes)

I was working lately on a mobile app using react-native, i was led to implement i18n for both languages (arabic and english). to switch between these two languages, i force RTL using I18nManager but the app needs to be reloaded to apply the changes, i use react-native-restart to reload app automatically after persisting the chosen language. is there any convenient way to force RTL without restating the app. Here is my code snippets :

Have you read the Contributing Guidelines?

(yes)

Environment

Environment:
OS: macOS Sierra 10.12.4
Node: 7.10.0
Yarn: 0.23.4
npm: 4.2.0
Watchman: 4.7.0
Xcode: Version 8.3.2 Build version 8E2002
Android Studio: 2.2.3 AI.145.3537739

Packages: (wanted => installed)
react-native: 0.47.2 => 0.47.2
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native-localization: 0.1.32 => 0.1.32

Steps to Reproduce

  1. create a screen with a Switch component to change displaying react-native components from LTR to RTL
  2. call I18nManager.forceRTL method on the onValueChange param of the Switch component
  3. call setLanguage method to set RTL language (arabic, hebrew …)

Expected Behavior

Render the screen with the chosen RTL language and alignement

Actual Behavior

Render the screen with chosen language but screen components doesn’t change alignement from right to left.

Reproducible Demo

(https://github.com/hadar-ayoub/react-native-RTLdemo.git)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions