yet-another-react-lightbox 3.30.0 → 3.30.1

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.d.ts CHANGED
@@ -87,7 +87,7 @@ declare function useEventCallback<Args extends unknown[], Return>(fn: (...args:
87
87
  declare function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
88
88
  declare function useForkRef<InstanceA, InstanceB>(refA: React.Ref<InstanceA> | null | undefined, refB: React.Ref<InstanceB> | null | undefined): React.Ref<InstanceA & InstanceB> | null;
89
89
 
90
- declare const useLayoutEffect: typeof React.useLayoutEffect;
90
+ declare const useLayoutEffect: typeof React.useEffect;
91
91
 
92
92
  declare function useLoseFocus(focus: () => void, disabled?: boolean): {
93
93
  onFocus: () => void;
package/dist/index.js CHANGED
@@ -739,14 +739,18 @@ const LightboxRoot = React.forwardRef(function LightboxRoot({ className, childre
739
739
  const nodeRef = React.useRef(null);
740
740
  const [isRTL, setIsRTL] = React.useState(false);
741
741
  const { trackFocusWithin } = useA11yContext();
742
- const detectRTL = React.useCallback((node) => {
743
- if (node) {
744
- setIsRTL(window.getComputedStyle(node).direction === "rtl");
742
+ const detectRTL = useEventCallback(() => {
743
+ if (nodeRef.current) {
744
+ const rtl = window.getComputedStyle(nodeRef.current).direction === "rtl";
745
+ if (rtl !== isRTL) {
746
+ setIsRTL(rtl);
747
+ }
745
748
  }
746
- }, []);
749
+ });
750
+ React.useEffect(detectRTL);
747
751
  return (React.createElement(DocumentContextProvider, { nodeRef: nodeRef },
748
752
  React.createElement(RTLContextProvider, { isRTL: isRTL },
749
- React.createElement("div", { ref: useForkRef(useForkRef(ref, nodeRef), detectRTL), className: clsx(cssClass("root"), className), ...trackFocusWithin(onFocus, onBlur), ...rest }, children))));
753
+ React.createElement("div", { ref: useForkRef(ref, nodeRef), className: clsx(cssClass("root"), className), ...trackFocusWithin(onFocus, onBlur), ...rest }, children))));
750
754
  });
751
755
 
752
756
  var SwipeState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.30.0",
3
+ "version": "3.30.1",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",