@8man/react-native-media-console
Version:
A media player for the react-native-video component
76 lines • 2.34 kB
JavaScript
import React, { memo } from 'react';
import { ImageBackground, SafeAreaView, StyleSheet, View } from 'react-native';
import { Volume } from './Volume';
import { Back } from './Back';
import { NullControl } from './NullControl';
import { styles } from './styles';
import { Title } from '@8man/react-native-media-console/src/components/Title';
export const TopControls = /*#__PURE__*/memo(({
title,
showControls,
panHandlers,
animations: {
AnimatedView,
controlsOpacity,
topControl
},
disableBack,
disableVolume,
volumeFillWidth,
volumePosition,
volumeTrackWidth,
onBack,
resetControlTimeout
}) => {
const backControl = disableBack ? /*#__PURE__*/React.createElement(NullControl, null) : /*#__PURE__*/React.createElement(Back, {
showControls: showControls,
onBack: onBack,
resetControlTimeout: resetControlTimeout
});
const volumeControl = disableVolume ? /*#__PURE__*/React.createElement(NullControl, null) : /*#__PURE__*/React.createElement(Volume, {
volumeFillWidth: volumeFillWidth,
volumeTrackWidth: volumeTrackWidth,
volumePosition: volumePosition,
volumePanHandlers: panHandlers
});
return /*#__PURE__*/React.createElement(AnimatedView, {
style: [_styles.top, controlsOpacity, topControl]
}, /*#__PURE__*/React.createElement(ImageBackground, {
source: require('../assets/img/top-vignette.png'),
style: [styles.column],
imageStyle: [styles.vignette]
}, /*#__PURE__*/React.createElement(SafeAreaView, {
style: _styles.topControlGroup
}, /*#__PURE__*/React.createElement(View, {
style: _styles.sideControl
}, backControl, /*#__PURE__*/React.createElement(Title, title)), /*#__PURE__*/React.createElement(View, {
style: _styles.pullRight
}, volumeControl))));
});
const _styles = StyleSheet.create({
pullRight: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
top: {
flex: 1,
alignItems: 'stretch',
justifyContent: 'flex-start'
},
topControlGroup: {
alignSelf: 'stretch',
alignItems: 'center',
justifyContent: 'space-between',
flexDirection: 'row',
margin: 12,
marginBottom: 18
},
sideControl: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
}
});
//# sourceMappingURL=TopControls.js.map