Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b5adc22

Browse files
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)

AltStyle によって変換されたページ (->オリジナル) /