@vellira-ui/react-native 2.123.4 → 2.123.5
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/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccessibilityInfo, ActivityIndicator, Animated, BackHandler, Dimensions, Easing, FlatList, Modal as Modal$1, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View, findNodeHandle, useWindowDimensions } from "react-native";
|
|
2
|
-
import { Children, cloneElement, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { Children, cloneElement, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { createConsoleOverlayDiagnostics, createOverlayManagerStore, createOverlayZIndexPolicy, createRetainedResourceRegistry, deferOverlayFocusRestore, getCompoundSlot, markCompoundSlot, resolveOverlayPresentation, resolveSelectGroupSelection } from "@vellira-ui/core";
|
|
4
4
|
import { controlSizes, darkTheme, highContrastTheme, lightTheme } from "@vellira-ui/tokens";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -360,11 +360,15 @@ function useOverlayPresentation(presentation = "auto", breakpoint = 768) {
|
|
|
360
360
|
//#region src/hooks/useControllableState.ts
|
|
361
361
|
const useControllableState = ({ value, defaultValue, onChange }) => {
|
|
362
362
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
363
|
+
const onChangeRef = useRef(onChange);
|
|
364
|
+
useLayoutEffect(() => {
|
|
365
|
+
onChangeRef.current = onChange;
|
|
366
|
+
}, [onChange]);
|
|
363
367
|
const isControlled = value !== void 0;
|
|
364
368
|
return [isControlled ? value : internalValue, useCallback((next) => {
|
|
365
369
|
if (!isControlled) setInternalValue(next);
|
|
366
|
-
|
|
367
|
-
}, [isControlled
|
|
370
|
+
onChangeRef.current?.(next);
|
|
371
|
+
}, [isControlled])];
|
|
368
372
|
};
|
|
369
373
|
//#endregion
|
|
370
374
|
//#region src/hooks/useKeyboardNavigation.ts
|