Skip to content

Commit 3e2b0a9

Browse files
author
Greg B
authored
Update RNPlainTextEdit.ts (#291)
* Update RNPlainTextEdit.ts PlainTextEdit example * Update RNPlainTextEdit.ts close comment
1 parent 29b20db commit 3e2b0a9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/components/PlainTextEdit/RNPlainTextEdit.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@ import { ViewProps, setViewProps } from "../View/RNView";
77
import { RNWidget } from "../config";
88
import { throwUnsupported } from "../../utils/helpers";
99

10+
/**
11+
* The PlainTextEdit component provides ability to add and manipulate native editable text field widgets. It is based on
12+
* [NodeGui's QPlainTextEdit](https://docs.nodegui.org/docs/api/generated/classes/qplaintextedit/).
13+
* ## Example
14+
* ```javascript
15+
* import React from "react";
16+
* import { Renderer, PlainTextEdit, Window } from "@nodegui/react-nodegui";
17+
*
18+
* const plainTextRef = React.createRef();
19+
* const App = () => {
20+
* React.useEffect(() => {
21+
* plainTextRef.current.addEventListener("textChanged", () =>
22+
* console.log(plainTextRef.current.toPlainText())
23+
* );
24+
* });
25+
* return (
26+
* <Window>
27+
* <PlainTextEdit ref={plainTextRef} />
28+
* </Window>
29+
* );
30+
* };
31+
* Renderer.render(<App />);
32+
*
33+
* ```
34+
*/
35+
1036
export interface PlainTextEditProps extends ViewProps<QPlainTextEditSignals> {
1137
text?: string;
1238
readOnly?: boolean;

0 commit comments

Comments
 (0)