Browse Source

slider 값 sync

goodboy 6 years ago
parent
commit
f0e3be9b3b
2 changed files with 7 additions and 7 deletions
  1. 4 4
      src/components/PlayerContents.js
  2. 3 3
      src/components/PlayerControls.js

+ 4 - 4
src/components/PlayerContents.js

@@ -4,7 +4,7 @@ import { Icon, Slider } from 'react-native-elements';
 import C from 'rn-class';
 
 export default props => {
-  const { Pages } = props;
+  const { Pages, currentPlayerValue, setCurrentPlayerValue} = props;
   const [curPlayerValue, setCurPlayerValue] = useState(0);
   const [isPlay, setPlay] = useState(false);
   const onSetPlay = () => {
@@ -40,11 +40,11 @@ export default props => {
           trackStyle={{height:2}}
           thumbTintColor="#333"
           thumbStyle={{ width: 10, height: 5 }}
-          value={curPlayerValue}
-          onValueChange={value => setCurPlayerValue(value)}
+          value={currentPlayerValue}
+          onValueChange={value => setCurrentPlayerValue(value)}
         />
         <C.View cls="w95 jc-sb flx-row">
-          <C.Text>Time : {curPlayerValue}</C.Text>
+          <C.Text>Time : {currentPlayerValue}</C.Text>
           <C.Text>{`2:50`}</C.Text>
         </C.View>
       </C.View>

+ 3 - 3
src/components/PlayerControls.js

@@ -15,7 +15,7 @@ const { width } = Dimensions.get('window');
 export const PLACEHOLDER_WIDTH = width / 4;
 
 export default PlayerControls = props => {
-  const { Pages, closePlayer } = props;
+  const { Pages, closePlayer, currentPlayerValue, setCurrentPlayerValue} = props;
   const [curPlayerValue, setCurPlayerValue] = useState(0);
   const [isPlay, setPlay] = useState(false);
   const onSetPlay = () => {
@@ -45,8 +45,8 @@ export default PlayerControls = props => {
             trackStyle={sliderLayout.th}
             thumbTintColor="#333"
             thumbStyle={{width:10, height:5, ...sliderLayout.tt}}
-            value={curPlayerValue}
-            onValueChange={value => setCurPlayerValue(value)}
+            value={currentPlayerValue}
+            onValueChange={value => setCurrentPlayerValue(value)}
           />
         </C.View>
         <C.View cls="flx0.5 jc-sa ai-sa flx-row">