在 Emotion 11 之前的版本中,我曾经在开发中禁用 CSS 前缀,如下所示:
const emotionCache = createCache({
prefix: process.env.NODE_ENV === 'development' ? false : true,
})
Run Code Online (Sandbox Code Playgroud)
现在前缀器是 Stylis 解析器的插件,并且该prefix选项已被删除。他们说,如果您想自定义插件代码,可以复制并粘贴插件代码。但我想要的只是在开发中禁用它。
有没有一种干净的方法来做到这一点?
我在我的 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)