@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
36 lines (35 loc) • 970 B
JavaScript
import React from 'react';
import { StaticTimeLabel } from './StaticTimeLabel';
import { useCurrentTime, useDuration, useSeekable } from '../../hooks/barrel';
import { jsx as _jsx } from "react/jsx-runtime";
/**
* The default style for the time label.
*/
export const DEFAULT_TIME_LABEL_STYLE = {
marginLeft: 10,
marginRight: 10,
height: 20,
alignSelf: 'center'
};
/**
* The default time label component for the `react-native-theoplayer` UI.
*/
export const TimeLabel = props => {
const currentTime = useCurrentTime();
const duration = useDuration();
const {
showDuration,
style,
scrubTime
} = props;
const expectedSeekTarget = scrubTime ?? currentTime;
const seekable = useSeekable();
return /*#__PURE__*/_jsx(StaticTimeLabel, {
showDuration: showDuration,
time: expectedSeekTarget,
duration: duration,
seekable: seekable,
style: [DEFAULT_TIME_LABEL_STYLE, style]
});
};
//# sourceMappingURL=TimeLabel.js.map