Picture in Picture is a bit of a tricky beast (on iOS at least, haven't dug into android as much); the ViewController that originated the Video element that has been handed over to the system for PictureInPicture mode needs to be retained (not garbage collected) in order for the video to keep playing.
One way to solve this is have a way to tell react-native-screens to "hang on to" the currently active ViewController (store the pointer in a variable somewhere) when PictureInPicture is triggered. This way, when the user navigates away (pop) from the current view, the ViewController doesn't get garbage collected, and so the PIP view keeps going.
While this is a quick & fairly cheap change, it has a couple of problems.
First, because react unmounts the screen when it's "popped", events related to PictureInPicture fail to propagate (most notably,
, using react-native-video as the video library).
In addition to the events being missing, if you try to bring back the saved ViewController (when the user touches the button on the overlay to "go back to where this video originated"), the ViewController is unresponsive, again because react has forgotten about it.
More thorough support for PictureInPicture would likely involve a way to mark a certain screen as "pinned but hidden", such that it would be ignored in RNSScreenStack's
, but retrievable at a future date when pictureinpicture wants to restore that screen.