Right to Left in react-native

前端 未结 1 994
醉梦人生
醉梦人生 2021-02-13 03:28

By using this code(in below),The App has been RTL but location of Right & Left changed(So things must be shown in Right are turned to Left).I did it via tutorial.

         


        
相关标签:
1条回答
  • 2021-02-13 03:48

    you can use this code :

    first :

    import { I18nManager } from 'react-native';
    

    second in the App class use this :

    constructor(props) {
        super(props);
        I18nManager.forceRTL(true);
    }
    

    something like this :

    import React, { Component } from 'react';
    import { View, I18nManager } from 'react-native';
    import { Header } from './src/components/common';
    import LoginForm from './src/components/LoginForm';
    
    class App extends Component {
    
      constructor(props) {
        super(props);
        I18nManager.forceRTL(true);
      }
      render() {
        return (
          <View>
            <Header headerText="Authentication" />
            <LoginForm />
          </View>
        );
      }
    }
    
    export default App;
    
    0 讨论(0)
提交回复
热议问题