File tree 10 files changed +75
-73
lines changed
10 files changed +75
-73
lines changed Original file line number Diff line number Diff line change 22
22
"react" : " 16.9.0"
23
23
},
24
24
"devDependencies" : {
25
- "@nodegui/nodegui" : " ^0.1.8 " ,
25
+ "@nodegui/nodegui" : " ^0.1.9 " ,
26
26
"@types/node" : " ^12.0.10" ,
27
27
"@types/react-reconciler" : " ^0.18.0" ,
28
28
"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 {
20
20
}
21
21
22
22
export interface CheckBoxProps extends ViewProps {
23
- children ?: string ;
24
23
text ?: string ;
25
24
checked ?: boolean ;
26
25
}
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ export class RNLineEdit extends QLineEdit implements RNWidget {
19
19
}
20
20
21
21
export interface LineEditProps extends ViewProps {
22
- children ?: string ;
23
22
text ?: string ;
24
23
placeholderText ?: string ;
25
24
readOnly ?: boolean ;
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ export class RNPlainTextEdit extends QPlainTextEdit implements RNWidget {
20
20
}
21
21
22
22
export interface PlainTextEditProps extends ViewProps {
23
- children ?: string ;
24
23
text ?: string ;
25
24
readOnly ?: boolean ;
25
+ placeholderText ?: string ;
26
26
}
27
27
28
28
export const setProps = (
@@ -36,6 +36,9 @@ export const setProps = (
36
36
} ,
37
37
set readOnly ( isReadOnly : boolean ) {
38
38
widget . setReadOnly ( isReadOnly ) ;
39
+ } ,
40
+ set placeholderText ( text : string ) {
41
+ widget . setPlaceholderText ( text ) ;
39
42
}
40
43
} ;
41
44
Object . assign ( setter , newProps ) ;
Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ import { RNWidget } from "../config";
4
4
5
5
export class RNScrollArea extends QScrollArea implements RNWidget {
6
6
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 ( ) ;
9
12
}
10
13
appendInitialChild ( child : NodeWidget ) : void {
11
14
this . setWidget ( child ) ;
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export class RNView extends QWidget implements RNWidget {
60
60
return ;
61
61
}
62
62
( this . layout as FlexLayout ) . removeWidget ( child ) ;
63
+ child . close ( ) ;
63
64
}
64
65
}
65
66
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export class RNWindow extends QMainWindow implements RNWidget {
26
26
return ;
27
27
}
28
28
( this . layout as FlexLayout ) . removeWidget ( child ) ;
29
+ child . close ( ) ;
29
30
}
30
31
}
31
32
Original file line number Diff line number Diff line change @@ -9,56 +9,66 @@ import { ScrollArea } from "./components/ScrollArea";
9
9
10
10
const App = ( ) => {
11
11
const winRef = useRef < QMainWindow > ( null ) ;
12
- const [ fileUrl , setFileUrl ] = useState ( ) ;
13
- const [ imageSrc , setImageSrc ] = useState ( ) ;
12
+ const [ value , setValue ] = useState ( false ) ;
14
13
useEffect ( ( ) => {
15
14
if ( winRef . current ) {
16
15
winRef . current . resize ( 800 , 450 ) ;
17
16
}
18
17
} , [ ] ) ;
19
- const lineEditHandler = useMemo (
20
- ( ) => ( {
21
- [ QLineEditEvents . textChanged ] : ( text : string ) => {
22
- setFileUrl ( text ) ;
23
- }
24
- } ) ,
25
- [ ]
26
- ) ;
27
18
28
- const loadButtonHandler = useMemo (
19
+ const toggleHandler = useMemo (
29
20
( ) => ( {
30
21
[ QPushButtonEvents . clicked ] : ( ) => {
31
- setImageSrc ( fileUrl ) ;
22
+ setValue ( ! value ) ;
32
23
}
33
24
} ) ,
34
- [ fileUrl ]
25
+ [ value ]
35
26
) ;
36
27
37
28
return (
38
29
< >
39
30
< Window ref = { winRef } styleSheet = { styleSheet } >
40
31
< View id = "container" >
41
32
< 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 } />
49
34
</ View >
50
35
< ScrollArea style = { `width:400px;height:400px;` } >
51
- < View
52
- style = { `
36
+ { value ? (
37
+ < View
38
+ style = { `
39
+ min-width: 0;
53
40
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;
58
67
` }
59
- >
60
- < Text > Hello</ Text >
61
- </ View >
68
+ >
69
+ < Text > World</ Text >
70
+ </ View >
71
+ ) }
62
72
</ ScrollArea >
63
73
</ View >
64
74
</ Window >
Original file line number Diff line number Diff line change @@ -11,5 +11,5 @@ export { ProgressBar } from "./components/ProgressBar";
11
11
export { RadioButton } from "./components/RadioButton" ;
12
12
export { Dial } from "./components/Dial" ;
13
13
export { SpinBox } from "./components/SpinBox" ;
14
- // export { ScrollArea } from "./components/ScrollArea"; // TODO: Not working correctly yet
14
+ export { ScrollArea } from "./components/ScrollArea" ;
15
15
export { useEventHandler } from "./hooks" ;
You can’t perform that action at this time.
0 commit comments