26 lines
925 B
TypeScript
26 lines
925 B
TypeScript
// Metro module 15915 (f15916).
|
|
import { useRef, useInsertionEffect, useEffect } from "react";
|
|
import ExternalPip_android from "./ExternalPip.android";
|
|
export default function useExternalPipAspectRatioUpdater(a0, a1, a2) {
|
|
const current = a2;
|
|
const ref = useRef(a2);
|
|
useInsertionEffect(() => {
|
|
ref.current = current;
|
|
});
|
|
useEffect(() => {
|
|
const targetDimensions = a1.getTargetDimensions(ref.current);
|
|
ExternalPip_android.setPipAspectRatio(targetDimensions.width, targetDimensions.height);
|
|
return a1.subscribeFromItem(() => {
|
|
const targetDimensions2 = a1.getTargetDimensions(ref.current);
|
|
const { width, height } = targetDimensions2;
|
|
if (!(width === targetDimensions.width && height === targetDimensions.height)) {
|
|
targetDimensions = {
|
|
width,
|
|
height
|
|
};
|
|
ExternalPip_android.setPipAspectRatio(width, height);
|
|
}
|
|
});
|
|
}, [a1]);
|
|
};
|