React Native, Detect screen rotation change using portrait mode
问题 I am using portrait mode in react-native application. But I want to capture the rotation event of the screen. Is there a way to do this? Thanks... 回答1: Well, you have several options. You can use the Dimensions API https://reactnative.dev/docs/dimensions You can add a listener for Dimensions.change and you could do something like function isPortrait() { const dim = Dimension.get("screen") return dim.height >= dim.width } function isLandscape() { const dim = Dimension.get("screen") return dim