@theoplayer/react-native-ui
Version:
A React Native UI for @theoplayer/react-native
69 lines (68 loc) • 2.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DEFAULT_CONTROL_BAR_STYLE = exports.ControlBar = exports.CenteredControlBar = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _PlayerContext = require("../util/PlayerContext");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* The default style for the control bar.
*/
const DEFAULT_CONTROL_BAR_STYLE = exports.DEFAULT_CONTROL_BAR_STYLE = {
flexDirection: 'row',
justifyContent: 'flex-end'
};
/**
* A control bar component that renders all children horizontally.
*/
const ControlBar = props => {
const {
style,
children
} = props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayerContext.PlayerContext.Consumer, {
children: context => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: [DEFAULT_CONTROL_BAR_STYLE, {
height: context.style.dimensions.controlBarHeight
}, style],
children: children
})
});
};
exports.ControlBar = ControlBar;
/**
* A control bar that can only render 3 properties in the left/middle/right. This is used to create controls in the center of the player.
*/
const CenteredControlBar = props => {
const {
style,
middle,
left,
right
} = props;
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayerContext.PlayerContext.Consumer, {
children: context => /*#__PURE__*/(0, _jsxRuntime.jsxs)(ControlBar, {
style: [{
height: context.style.dimensions.centerControlBarHeight,
width: '60%',
justifyContent: 'space-between'
}, style],
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: {
height: context.style.dimensions.centerControlBarHeight
},
children: left
}), middle, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
style: {
height: context.style.dimensions.centerControlBarHeight
},
children: right
})]
})
});
};
exports.CenteredControlBar = CenteredControlBar;
//# sourceMappingURL=ControlBar.js.map