简体   繁体   English

REACT- 为什么将“样式”与 react-draft-wysiwyg 一起使用不起作用?

[英]REACT- Why using 'style' with react-draft-wysiwyg is not working?

Is there a way to delimit my textboxes in a rectangle and give a default height for them?有没有办法在矩形中分隔我的文本框并为它们提供默认高度? I tried using style in my <Editor /> but it's not working.我尝试在我的<Editor />中使用style ,但它不起作用。

import { Editor } from "react-draft-wysiwyg";
import { EditorState } from "draft-js";
import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";

const TabContent = ({ name, typeProof }) => {
  const [text, setText] = useState(
  () => EditorState.createEmpty(),);    

  return (
    <>
      <SafeAreaView>
        <Editor
          editorState={text}
          onEditorStateChange={setText}
          wrapperClassName="wrapperClassName"
          editorClassName="editorClassName"
          toolbarClassName="toolbarClassName"
          placeholder="Enter your text here:"
          style={{
            height: 200,
            margin: 12,
            borderWidth: 0.5,
            padding: 10,
            borderRadius: "2px"
          }}
          toolbar={{
              options: ['inline', 'blockType', 'fontSize', 'fontFamily', 'list', 'textAlign', 'colorPicker', 'embedded', 'remove', 'history'],
         ...
         }}
        />
      </SafeAreaView>     
    </>
  );
};   

Here my code这是我的代码

Maybe you need to use也许你需要使用

editorStyle={{ height: 200, margin: 12,borderWidth: 0.5,padding: 10,borderRadius: "2px" }} editorStyle={{ height: 200, margin: 12,borderWidth: 0.5,padding: 10,borderRadius: "2px" }}

attribute instead of style属性而不是样式

在此处输入图像描述

在此处输入图像描述

it works for me `它对我有用`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM