File tree Expand file tree Collapse file tree 10 files changed +75
-73
lines changed Expand file tree Collapse file tree 10 files changed +75
-73
lines changed Original file line number Diff line number Diff line change 2222 "react" : " 16.9.0"
2323 },
2424 "devDependencies" : {
25- "@nodegui/nodegui" : " ^0.1.8 " ,
25+ "@nodegui/nodegui" : " ^0.1.9 " ,
2626 "@types/node" : " ^12.0.10" ,
2727 "@types/react-reconciler" : " ^0.18.0" ,
2828 "prettier" : " ^1.18.2" ,
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ export class RNCheckBox extends QCheckBox implements RNWidget {
2020}
2121
2222export interface CheckBoxProps extends ViewProps {
23- children ?: string ;
2423 text ?: string ;
2524 checked ?: boolean ;
2625}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export class RNLineEdit extends QLineEdit implements RNWidget {
1919}
2020
2121export interface LineEditProps extends ViewProps {
22- children ?: string ;
2322 text ?: string ;
2423 placeholderText ?: string ;
2524 readOnly ?: boolean ;
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ export class RNPlainTextEdit extends QPlainTextEdit implements RNWidget {
2020}
2121
2222export interface PlainTextEditProps extends ViewProps {
23- children ?: string ;
2423 text ?: string ;
2524 readOnly ?: boolean ;
25+ placeholderText ?: string ;
2626}
2727
2828export const setProps = (
@@ -36,6 +36,9 @@ export const setProps = (
3636 } ,
3737 set readOnly ( isReadOnly : boolean ) {
3838 widget . setReadOnly ( isReadOnly ) ;
39+ } ,
40+ set placeholderText ( text : string ) {
41+ widget . setPlaceholderText ( text ) ;
3942 }
4043 } ;
4144 Object . assign ( setter , newProps ) ;
Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ import { RNWidget } from "../config";
44
55export class RNScrollArea extends QScrollArea implements RNWidget {
66 removeChild ( child : NodeWidget ) : void {
7- throw new Error ( "Method not implemented." ) ;
8- //TODO: IMPLEMENT THIS
7+ const removedChild = this . takeWidget ( ) ;
8+ if ( removedChild ) {
9+ removedChild . close ( ) ;
10+ }
11+ child . close ( ) ;
912 }
1013 appendInitialChild ( child : NodeWidget ) : void {
1114 this . setWidget ( child ) ;
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export class RNView extends QWidget implements RNWidget {
6060 return ;
6161 }
6262 ( this . layout as FlexLayout ) . removeWidget ( child ) ;
63+ child . close ( ) ;
6364 }
6465}
6566
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export class RNWindow extends QMainWindow implements RNWidget {
2626 return ;
2727 }
2828 ( this . layout as FlexLayout ) . removeWidget ( child ) ;
29+ child . close ( ) ;
2930 }
3031}
3132
Original file line number Diff line number Diff line change @@ -9,56 +9,66 @@ import { ScrollArea } from "./components/ScrollArea";
99
1010const App = ( ) => {
1111 const winRef = useRef < QMainWindow > ( null ) ;
12- const [ fileUrl , setFileUrl ] = useState ( ) ;
13- const [ imageSrc , setImageSrc ] = useState ( ) ;
12+ const [ value , setValue ] = useState ( false ) ;
1413 useEffect ( ( ) => {
1514 if ( winRef . current ) {
1615 winRef . current . resize ( 800 , 450 ) ;
1716 }
1817 } , [ ] ) ;
19- const lineEditHandler = useMemo (
20- ( ) => ( {
21- [ QLineEditEvents . textChanged ] : ( text : string ) => {
22- setFileUrl ( text ) ;
23- }
24- } ) ,
25- [ ]
26- ) ;
2718
28- const loadButtonHandler = useMemo (
19+ const toggleHandler = useMemo (
2920 ( ) => ( {
3021 [ QPushButtonEvents . clicked ] : ( ) => {
31- setImageSrc ( fileUrl ) ;
22+ setValue ( ! value ) ;
3223 }
3324 } ) ,
34- [ fileUrl ]
25+ [ value ]
3526 ) ;
3627
3728 return (
3829 < >
3930 < Window ref = { winRef } styleSheet = { styleSheet } >
4031 < View id = "container" >
4132 < View id = "controls" >
42- < LineEdit
43- on = { lineEditHandler }
44- id = "textField"
45- text = { fileUrl }
46- placeholderText = "Absolute path to an image"
47- />
48- < Button text = "Load Image" on = { loadButtonHandler } />
33+ < Button text = "Toggle scollwidget" on = { toggleHandler } />
4934 </ View >
5035 < ScrollArea style = { `width:400px;height:400px;` } >
51- < View
52- style = { `
36+ { value ? (
37+ < View
38+ style = { `
39+ min-width: 0;
5340 min-width: 0;
54- min-height:0;
55- height:500px;
56- width: 500px;
57- background-color:green;
41+ min-width: 0;
42+ min-height:0;
43+ height:500px;
44+ width: 500px;
45+ background-color:green;
46+ ` }
47+ >
48+ < Text > Hello</ Text >
49+ < View
50+ style = { `
51+ height: '50%';
52+ width: '50%';
53+ background-color: pink;
54+ ` }
55+ > </ View >
56+ </ View >
57+ ) : (
58+ < View
59+ style = { `
60+ min-width: 0;
61+ min-width: 0;
62+ min-width: 0;
63+ min-height:0;
64+ height:500px;
65+ width: 500px;
66+ background-color:blue;
5867 ` }
59- >
60- < Text > Hello</ Text >
61- </ View >
68+ >
69+ < Text > World</ Text >
70+ </ View >
71+ ) }
6272 </ ScrollArea >
6373 </ View >
6474 </ Window >
Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ export { ProgressBar } from "./components/ProgressBar";
1111export { RadioButton } from "./components/RadioButton" ;
1212export { Dial } from "./components/Dial" ;
1313export { SpinBox } from "./components/SpinBox" ;
14- // export { ScrollArea } from "./components/ScrollArea"; // TODO: Not working correctly yet
14+ export { ScrollArea } from "./components/ScrollArea" ;
1515export { useEventHandler } from "./hooks" ;
You can’t perform that action at this time.
0 commit comments