@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
17 lines • 686 B
JavaScript
import React from 'react';
import { PlayButton } from './PlayButton';
import { useDebouncedValue, useWaiting } from '../../hooks/barrel';
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
const DEFAULT_DELAY_MS = 200;
/**
* A conditional play/pause button for the `react-native-theoplayer` UI, which hides itself while the player is
* not ready.
*/
export function ConditionalPlayButton(props) {
const waiting = useWaiting();
const hiding = useDebouncedValue(waiting, props.delay ?? DEFAULT_DELAY_MS);
return hiding ? /*#__PURE__*/_jsx(_Fragment, {}) : /*#__PURE__*/_jsx(PlayButton, {
...props
});
}
//# sourceMappingURL=ConditionalPlayButton.js.map