Skip to content

Commit b5adc22

Browse files
committed
Update match object example to use React Native's dimensions
1 parent 909d36f commit b5adc22

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ const styleObject = {
115115

116116
```js
117117
import { process } from "react-native-css-media-query-processor";
118+
import { Dimensions } from "react-native";
118119

119-
const matchObject = {
120-
width: 110,
121-
height: 100,
122-
orientation: "landscape",
123-
aspect-ratio: 1.1,
120+
const win = Dimensions.get("window");
121+
const matchObj = {
122+
width: win.width,
123+
height: win.height,
124+
orientation: win.width > win.height ? "landscape" : "portrait",
125+
"aspect-ratio": win.width / win.height,
124126
type: "screen"
125-
}
127+
};
126128

127129
process(styleObject, matchObject);
128130
```

0 commit comments

Comments
 (0)