我在我的 React 项目中使用 Material-Ui!
我按照文档中的步骤在我的项目中允许 RTL 并且一切正常!
除了 TextField 组件
LTR方向:
RTL方向
就像你看到的一样!问题在于标签仍在左侧(输入文本工作正常)
App.js 文件
import React, {useState} from 'react';
//i18n
import {withTranslation} from "react-i18next";
import './i18n';
//jss
import { create } from 'jss';
import rtl from 'jss-rtl';
import { StylesProvider, jssPreset } from '@material-ui/core/styles';
// Configure JSS
const jss = create({ plugins: [...jssPreset().plugins, rtl()] });
function App(props) {
// initialize Language
const { i18n } = props;
const [ prefLang, setPrefLang] = useState(i18n.language);
let theme =createMuiTheme({
palette …Run Code Online (Sandbox Code Playgroud)