stop expo-speech when transition starts

How do I stop expo-speech from playing when moving out of the current page?

I tried to use the code below but it didn’t work…

useEffect(() => {
  const unsubscribe = navigation.addListener('transitionStart', e => {
    // Do something
  });
  return unsubscribe;
}, [navigation]);

[EDIT]

Nevermind, I decided to use this instead:

const isFocused = useIsFocused();
isFocused ? null : Speech.stop();