@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
24 lines (23 loc) • 962 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ConditionalPlayButton = ConditionalPlayButton;
var _react = _interopRequireDefault(require("react"));
var _PlayButton = require("./PlayButton");
var _barrel = require("../../hooks/barrel");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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.
*/
function ConditionalPlayButton(props) {
const waiting = (0, _barrel.useWaiting)();
const hiding = (0, _barrel.useDebouncedValue)(waiting, props.delay ?? DEFAULT_DELAY_MS);
return hiding ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayButton.PlayButton, {
...props
});
}
//# sourceMappingURL=ConditionalPlayButton.js.map