PlayerControls.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import React, { useState } from 'react';
  2. import {
  3. View,
  4. StyleSheet,
  5. Text,
  6. Dimensions,
  7. TouchableWithoutFeedback
  8. } from 'react-native';
  9. import { Icon, Slider } from 'react-native-elements';
  10. import C from 'rn-class';
  11. const { width } = Dimensions.get('window');
  12. export const PLACEHOLDER_WIDTH = width / 4;
  13. const setPlayer = () => {};
  14. const PlayerControls = props => {
  15. const { title, closePlayer, slideup } = props;
  16. const [curPlayIdx, setCurPlayIdx] = useState(0);
  17. return (
  18. <TouchableWithoutFeedback onPress={slideup}>
  19. <View style={styles.container}>
  20. <View style={styles.placeholder} />
  21. <C.View cls="flx2">
  22. <Text numerOfLine={1}>{title}</Text>
  23. <Slider
  24. thumbTintColor="#333"
  25. value={curPlayIdx}
  26. onValueChange={value => setCurPlayIdx(value)}
  27. />
  28. </C.View>
  29. <C.View cls="flx1 jc-sa ai-sa flx-row">
  30. <C.EL.Icon type="entypo" name="controller-play" />
  31. <C.EL.Icon type="entypo" name="cross" onPress={closePlayer} />
  32. </C.View>
  33. </View>
  34. </TouchableWithoutFeedback>
  35. );
  36. };
  37. const styles = StyleSheet.create({
  38. container: {
  39. ...StyleSheet.absoluteFillObject,
  40. flexDirection: 'row',
  41. justifyContent: 'space-around',
  42. alignItems: 'center'
  43. },
  44. title: {
  45. flex: 2,
  46. flexWrap: 'wrap',
  47. paddingLeft: 8
  48. },
  49. placeholder: {
  50. width: PLACEHOLDER_WIDTH
  51. },
  52. icon: {
  53. fontSize: 24,
  54. color: 'gray',
  55. padding: 8
  56. }
  57. });
  58. export default PlayerControls;