@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
31 lines (30 loc) • 943 B
JavaScript
import { useRef as u, useCallback as f } from "react";
import { usePagesRotateContext as m } from "../../contexts/PagesRotateContext.js";
import { useLicenseContext as l } from "../../contexts/LicenseContext.js";
import { LicenseType as p } from "../types.js";
import { ORGANIZATION_ALLOWED_FEATURES_MESSAGE as R } from "../const.js";
const C = () => {
const { setSinglePageRotate: n } = m(), { type: i, validating: a } = l(), r = u(0), c = f(
(s, t) => {
n((e) => {
const o = typeof t == "function" ? t(e[s] || 0) : t;
return o % 90 !== 0 ? (console.warn("rotationDegree must be a multiple of 90 got", o), e) : {
...e,
[s]: o
};
});
},
[n]
);
return a !== !1 ? {
rotate: () => {
}
} : i !== p.Organization ? {
rotate: () => {
r.current === 0 && (console.error(R), r.current++);
}
} : { rotate: c };
};
export {
C as usePageRotateContext
};