I found the actual reason it did not behave as expected: My ThemeContext component shares the same name as a component from the react navigation library, and I accidentally imported that one...
After making sure the correct things were imported, everything works as expected.