We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When rotating the screen on an open alert, the useWindowDimensions hook doesn't update. Happens on both iOS and Android.
useWindowDimensions
0.72.6
npx react-native info
System: OS: macOS 14.0 CPU: (10) arm64 Apple M1 Pro Memory: 110.34 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 18.18.0 path: ~/.asdf/installs/nodejs/18.18.0/bin/node Yarn: version: 1.22.19 path: ~/.asdf/shims/yarn npm: version: 9.8.1 path: ~/.asdf/plugins/nodejs/shims/npm Watchman: version: 2023.09.25.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.2 path: /Users/robrechtme/.asdf/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: version: 15.0.1/15A507 path: /usr/bin/xcodebuild Languages: Java: version: 18.0.2.1 path: /Users/robrechtme/.asdf/shims/javac Ruby: version: 3.2.2 path: /Users/robrechtme/.asdf/shims/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.6 wanted: 0.72.6 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false
https://snack.expo.dev/@robrechtme/usewindowdimensions-bug
import { Text, SafeAreaView, StyleSheet, useWindowDimensions, Button, Alert } from 'react-native'; export default function App() { const { width, height } = useWindowDimensions(); return ( <SafeAreaView style={styles.container}> <Button title="trigger alert" onPress={() => Alert.alert('now rotate the screen before closing')} /> <Text style={styles.paragraph}> Width: {width} </Text> <Text style={styles.paragraph}> Height: {height} </Text> </SafeAreaView> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', backgroundColor: '#ecf0f1', padding: 8, }, paragraph: { margin: 24, fontSize: 18, fontWeight: 'bold', textAlign: 'center', }, });
The text was updated successfully, but these errors were encountered:
Basically a duplicate of #37704
Sorry, something went wrong.
any update on this?
I'm experiencing the same issue
No branches or pull requests
Description
When rotating the screen on an open alert, the
useWindowDimensions
hook doesn't update.Happens on both iOS and Android.
React Native Version
0.72.6
Output of
npx react-native info
Steps to reproduce
=> The useWindowDimensions hook still returns portrait mode info
Snack, screenshot, or link to a repository
iphone.mp4
https://snack.expo.dev/@robrechtme/usewindowdimensions-bug
The text was updated successfully, but these errors were encountered: