Not Able to set association In Mendix Native Pluggable Widget

0
I have created a Searchable Drop-down for a native app. I  want to set the association when I select the value from the drop-down, but it is not set properly.    I was going through other forum and i stumbled upon this one : https://community.mendix.com/link/space/widgets/questions/105072   Is this functionality implemented?   Any help !! I am using the below code snippet to set the association   const handleSelect = (item: ObjectItem) => {   try {     if (props.ref?.setValue) {       props.ref.setValue(item);     }     Ref is my prop for the Association type.Is this the correct way to set the association for native widget, or am I missing something?. Please let me know how to set it   I am also pasting the XML and TSX logic here:       XML:     <property key="ref" type = "association" required = "true" selectableObjects = "objectsDatasource" >       <caption>       Reference       </caption>       <description>           The association to set when an object is selected.         </description>       < associationTypes >       <associationType name="Reference" />         </associationTypes>         </property>         < property key = "objectsDatasource" type = "datasource" isList = "true" required = "true" >           <caption>           Selectable Objects             </caption>             <description>           The list of selectable options.         </description>       </property>       < property key = "displayAttribute" type = "attribute" required = "true" dataSource = "objectsDatasource" >         <caption>         Display Attribute TSX Logic:     const filteredOptions = props.objectsDatasource?.items?.filter(item => {       const label = props.displayAttribute.get(item)?.value ?? "";       return label.toLowerCase().includes(searchText.toLowerCase());     }) ?? [];     const handleSelect = (item: ObjectItem) => {       try {         if (props.ref?.setValue) {           props.ref.setValue(item);         } My Render Function:         <FlatList             data={ filteredOptions }         keyExtractor = { item => item.id} renderItem = {({ item }) => {   const label = props.displayAttribute.get(item)?.value ?? "Unnamed";   return (     <TouchableOpacity                   onPress= {() => handleSelect(item) } style = {   [   styles.item,   props.ref?.value?.id === item.id ? styles.selectedItem : null   ]}   >   <Text style={ styles.itemText }> { label } </Text>     </TouchableOpacity>               );             }}
asked
1 answers
0

In React, the ref property has a specific meaning and is not advisable to use it here. 

It seems it has been used or overwritten by the framework and after changing the property name issue has been resolved.

answered