Skip to content

Commit 2b02a51

Browse files
committed
fix bugs
1 parent 383d233 commit 2b02a51

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,13 @@ function App(): JSX.Element {
142142
onVideoClick={setVideoUrl}
143143
/>
144144
<Show when={videoUrl}>
145-
<CustomVideo ref={videoRef} videoUrl={videoUrl!} />
145+
<CustomVideo
146+
ref={videoRef}
147+
videoUrl={videoUrl!}
148+
onVideoEnd={() => {
149+
setVideoUrl(null);
150+
}}
151+
/>
146152
</Show>
147153
</>
148154
);

src/components/ui/CustomVideo.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Video, {VideoRef} from 'react-native-video';
44

55
export interface CustomVideoProps {
66
videoUrl: string;
7-
onVideoEnd?: () => void;
7+
onVideoEnd: () => void;
88
}
99

1010
export interface CustomVideoRef {
@@ -18,7 +18,7 @@ export const CustomVideo = forwardRef<CustomVideoRef, CustomVideoProps>(
1818
useImperativeHandle(ref, () => ({
1919
stopVideo: () => {
2020
videoRef.current?.setFullScreen(false);
21-
props.onVideoEnd?.();
21+
props.onVideoEnd();
2222
},
2323
}));
2424

@@ -30,7 +30,6 @@ export const CustomVideo = forwardRef<CustomVideoRef, CustomVideoProps>(
3030
fullscreen
3131
playInBackground={false}
3232
style={styles.container}
33-
onEnd={props.onVideoEnd}
3433
/>
3534
);
3635
},

0 commit comments

Comments
 (0)