Skip to content

Commit 603f7ee

Browse files
authored
feat: @media(hover) (#87)
1 parent f36d867 commit 603f7ee

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/compiler/__tests__/media-query.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,27 @@ describe.skip("platform media queries", () => {
6161
});
6262
});
6363
});
64+
65+
test("@media (hover: hover)", () => {
66+
const compiled = compile(`
67+
@media (hover: hover) {
68+
.my-class { color: red; }
69+
}
70+
`);
71+
72+
expect(compiled.stylesheet()).toStrictEqual({
73+
s: [
74+
[
75+
"my-class",
76+
[
77+
{
78+
s: [2, 1],
79+
d: [{ color: "#f00" }],
80+
m: [["=", "hover", "hover"]],
81+
v: [["__rn-css-color", "#f00"]],
82+
},
83+
],
84+
],
85+
],
86+
});
87+
});

src/runtime/native/conditions/media-query.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ function testComparison(mediaQuery: MediaCondition, get: Getter): Boolean {
3838
const right = mediaQuery[2];
3939

4040
switch (mediaQuery[1]) {
41+
case "hover":
42+
return true;
4143
case "platform":
4244
return right === "native" || right === Platform.OS;
4345
case "prefers-color-scheme": {

0 commit comments

Comments
 (0)