Skip to content

Commit 686e71f

Browse files
committed
fix: reconcile code with the new stop and pause button
1 parent b9b2753 commit 686e71f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

example/src/App.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const RenderListItem = React.memo(
6262
const styles = stylesheet({ currentUser: item.fromCurrentUser });
6363
const [isLoading, setIsLoading] = useState(true);
6464

65-
const handlePlayStopAction = async () => {
65+
const handlePlayPauseAction = async () => {
6666
let currentPlayer = currentPlayingRef?.current;
6767

6868
// If no player or if current player is stopped just start it!
@@ -80,9 +80,9 @@ const RenderListItem = React.memo(
8080
return;
8181
}
8282

83-
// Always stop current player if it was playing
83+
// Pause current player if it was playing
8484
if (currentPlayer.currentState === PlayerState.playing) {
85-
await currentPlayingRef?.current?.stopPlayer();
85+
await currentPlayingRef?.current?.pausePlayer();
8686
}
8787

8888
// Start player when it is a different one!
@@ -95,13 +95,17 @@ const RenderListItem = React.memo(
9595
}
9696
};
9797

98+
const handleStopAction = async () => {
99+
ref.current?.stopPlayer();
100+
};
101+
98102
return (
99103
<View key={item.path} style={[styles.listItemContainer]}>
100104
<View style={styles.listItemWidth}>
101105
<View style={[styles.buttonContainer]}>
102106
<Pressable
103107
disabled={isLoading}
104-
onPress={handlePlayStopAction}
108+
onPress={handlePlayPauseAction}
105109
style={styles.playBackControlPressable}>
106110
{isLoading ? (
107111
<ActivityIndicator color={'#FFFFFF'} />

0 commit comments

Comments
 (0)