5
5
CursorShape ,
6
6
NodeWidget ,
7
7
QIcon ,
8
- FlexLayout
8
+ FlexLayout ,
9
+ WidgetAttribute
9
10
} from "@nodegui/nodegui" ;
10
11
import { RNWidget , RNProps } from "../config" ;
11
12
@@ -106,6 +107,11 @@ export interface ViewProps extends RNProps {
106
107
* Prop to set the ref. The ref will return the underlying nodegui widget.
107
108
*/
108
109
ref ?: any ;
110
+ /**
111
+ * Prop to set the Widget Attributes. example:
112
+ * <View attributes={{Qt::WA_Disabled: true}} />
113
+ */
114
+ attributes ?: WidgetAttributesMap ;
109
115
}
110
116
111
117
/**
@@ -128,6 +134,7 @@ export const setViewProps = (
128
134
console . warn ( "Both styleSheet and inlineStyle can't be used together" ) ;
129
135
}
130
136
widget . setInlineStyle ( inlineStyle ) ;
137
+ console . log ( inlineStyle ) ;
131
138
} ,
132
139
set geometry ( geometry : Geometry ) {
133
140
widget . setGeometry (
@@ -202,6 +209,11 @@ export const setViewProps = (
202
209
widget . addEventListener ( eventType , newEvtListener ) ;
203
210
}
204
211
) ;
212
+ } ,
213
+ set attributes ( attributesMap : WidgetAttributesMap ) {
214
+ Object . entries ( attributesMap ) . forEach ( ( [ attribute , value ] ) => {
215
+ widget . setAttribute ( Number ( attribute ) , value ) ;
216
+ } ) ;
205
217
}
206
218
} ;
207
219
Object . assign ( setter , newProps ) ;
@@ -269,3 +281,7 @@ type Position = {
269
281
interface ListenerMap {
270
282
[ key : string ] : ( payload ?: any ) => void ;
271
283
}
284
+
285
+ type WidgetAttributesMap = {
286
+ [ key : number ] : boolean ;
287
+ } ;
0 commit comments