diff --git a/docs/usewindowdimensions.md b/docs/usewindowdimensions.md index 3e8a8077370..a34784eb0d4 100644 --- a/docs/usewindowdimensions.md +++ b/docs/usewindowdimensions.md @@ -16,7 +16,7 @@ const {height, width} = useWindowDimensions(); ## Example ```SnackPlayer name=useWindowDimensions&supportedPlatforms=ios,android -import {StyleSheet, Text, useWindowDimensions} from 'react-native'; +import {StyleSheet, Text, View, useWindowDimensions} from 'react-native'; import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context'; const App = () => { @@ -25,23 +25,38 @@ const App = () => { Window Dimension Data - Height: {height} - Width: {width} - Font scale: {fontScale} - Pixel ratio: {scale} + + Height: {height} + Width: {width} + Font scale: {fontScale} + Pixel ratio: {scale} + + + Dynamic Box + ); }; + const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', + gap: 12, }, header: { fontSize: 20, - marginBottom: 12, + }, + box: { + minWidth: 100, + backgroundColor: '#06bcee', }, }); @@ -58,6 +73,10 @@ useWindowDimensions().fontScale; The scale of the font currently used. Some operating systems allow users to scale their font sizes larger or smaller for reading comfort. This property will let you know what is in effect. +:::note +Changing the font size percentage can be leveraged to dynamically adjust the sizes of UI elements, such as padding, margins, and container heights, to ensure a consistent and accessible user experience. By using the fontScale property, developers can make their applications more adaptable to users' preferences for larger or smaller text, enhancing readability and usability. +::: + --- ### `height`