alantoa / react-native-reanimated-player

▶️ An excellent video player controller that offers animation, performance, interactivity, and customization.
MIT License
264 stars 19 forks source link

VideoPlayer's `onTapBack` property is not called when the button is clicked. #18

Open LearXD opened 1 year ago

LearXD commented 1 year ago

I tried to implement the logic below, I want to make the user go back to the previous screen when clicking on the backButton, but the event is not triggered!

My code:

export const VideoScreen = function (props: VideoScreenProps) {

  const navigation = useNavigation()

  const videoRef = React.useRef<VideoPlayerRef>();
  const videoHeight = useSharedValue(width * (9 / 16));
  const isFullScreen = useSharedValue(false);

  const [paused, setPaused] = useState(false);

  return (
    <SafeAreaProvider>
      <GestureHandlerRootView >
        <VideoPlayer
          ref={videoRef}
          navigation={navigation}
          theme={{
            minimumTrackTintColor: Colors.primary,
            bubbleBackgroundColor: Colors.primary,
          }}
          source={{
            uri: 'my url goes here!'
          }}
          onTapBack={() => {
            console.log('onTapBack') // <--------- does not print on the console when clicking on the backButton
            Alert.alert('onTapBack');
          }}
          headerBarTitle={'Darling in the Franxx'}
          onPausedChange={setPaused}
          videoHeight={videoHeight}
          paused={paused}
          isFullScreen={isFullScreen}
        />
      </GestureHandlerRootView>
    </SafeAreaProvider>
  );
}