@fto-consult/expo-ui 1.4.9 → 1.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -68,6 +68,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
68
68
|
return React.getTextContent(content);
|
|
69
69
|
}
|
|
70
70
|
const prevMenuItems = React.usePrevious(menuItems,stableHash);
|
|
71
|
+
const areItemsEquals = prevMenuItems == menuItems;//JSON.stringify(prevMenuItems) == JSON.stringify(menuItems);
|
|
71
72
|
const prepareItems = React.useCallback(()=>{
|
|
72
73
|
const items = [];
|
|
73
74
|
selectedRef.current = null;
|
|
@@ -108,8 +109,8 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
108
109
|
setState({...state,value:currentSelectedValue,items});
|
|
109
110
|
},[stableHash(menuItems)])
|
|
110
111
|
React.useEffect(()=>{
|
|
111
|
-
if(defaultValue == value &&
|
|
112
|
-
if(
|
|
112
|
+
if(compare(defaultValue == value) && areItemsEquals) return;
|
|
113
|
+
if(!areItemsEquals){
|
|
113
114
|
prepareItems();
|
|
114
115
|
} else {
|
|
115
116
|
selectValue(defaultValue);
|
|
@@ -133,7 +134,7 @@ const SimpleSelect = React.forwardRef((props,ref)=>{
|
|
|
133
134
|
context.getValue = ()=> value;
|
|
134
135
|
|
|
135
136
|
React.useEffect(()=>{
|
|
136
|
-
if(
|
|
137
|
+
if(compare(value,prevValue)) return;
|
|
137
138
|
if(onChange){
|
|
138
139
|
onChange(defaultObj(selectedRef.current));
|
|
139
140
|
}
|