55 CursorShape ,
66 NodeWidget ,
77 QIcon ,
8- FlexLayout
8+ FlexLayout ,
9+ WidgetAttribute
910} from "@nodegui/nodegui" ;
1011import { RNWidget , RNProps } from "../config" ;
1112
@@ -106,6 +107,11 @@ export interface ViewProps extends RNProps {
106107 * Prop to set the ref. The ref will return the underlying nodegui widget.
107108 */
108109 ref ?: any ;
110+ /**
111+ * Prop to set the Widget Attributes. example:
112+ * <View attributes={{Qt::WA_Disabled: true}} />
113+ */
114+ attributes ?: WidgetAttributesMap ;
109115}
110116
111117/**
@@ -128,6 +134,7 @@ export const setViewProps = (
128134 console . warn ( "Both styleSheet and inlineStyle can't be used together" ) ;
129135 }
130136 widget . setInlineStyle ( inlineStyle ) ;
137+ console . log ( inlineStyle ) ;
131138 } ,
132139 set geometry ( geometry : Geometry ) {
133140 widget . setGeometry (
@@ -202,6 +209,11 @@ export const setViewProps = (
202209 widget . addEventListener ( eventType , newEvtListener ) ;
203210 }
204211 ) ;
212+ } ,
213+ set attributes ( attributesMap : WidgetAttributesMap ) {
214+ Object . entries ( attributesMap ) . forEach ( ( [ attribute , value ] ) => {
215+ widget . setAttribute ( Number ( attribute ) , value ) ;
216+ } ) ;
205217 }
206218 } ;
207219 Object . assign ( setter , newProps ) ;
@@ -269,3 +281,7 @@ type Position = {
269281interface ListenerMap {
270282 [ key : string ] : ( payload ?: any ) => void ;
271283}
284+
285+ type WidgetAttributesMap = {
286+ [ key : number ] : boolean ;
287+ } ;
0 commit comments