Skip to content

Commit 96f5ce2

Browse files
authored
feat: android_ripple.borderless & android_ripple.foreground (#139)
1 parent 5f2ac53 commit 96f5ce2

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/__tests__/compiler/declarations.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { compileWithAutoDebug } from "react-native-css/jest";
44
const tests = [
55
["-rn-ripple-color: black;", [{ d: [["black", ["android_ripple", "color"]]], s: [1, 1] }]],
66
["-rn-ripple-style: borderless;", [{ d: [[true, ["android_ripple", "borderless"]]], s: [1, 1] }]],
7+
["-rn-ripple-radius: 10;", [{ d: [[10, ["android_ripple", "radius"]]], s: [1, 1] }]],
8+
["-rn-ripple-layer: foreground;", [{ d: [[true, ["android_ripple", "foreground"]]], s: [1, 1] }]],
79
["caret-color: black", [{ d: [["#000", ["cursorColor"]]], s: [1, 1] }]],
810
["fill: black;", [{ d: [["#000", ["fill"]]], s: [1, 1] }]],
911
["rotate: 3deg;", [{ d: [[[{}, "rotateZ", "3deg"], "rotateZ"]], s: [1, 1] }]],

src/compiler/atRules.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
8888
"-webkit-line-clamp": ["numberOfLines"],
8989
"-rn-ripple-color": ["android_ripple", "color"],
9090
"-rn-ripple-style": ["android_ripple", "borderless"],
91+
"-rn-ripple-radius": ["android_ripple", "radius"],
92+
"-rn-ripple-layer": ["android_ripple", "foreground"],
9193
};
9294

9395
if (!rules) return mapping;

src/compiler/declarations.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -983,11 +983,17 @@ export function parseCustomDeclaration(
983983
parseUnparsed(declaration.value.value, builder, property),
984984
);
985985
} else if (property === "-rn-ripple-style") {
986-
builder.addDescriptor(
987-
property,
988-
parseUnparsed(declaration.value.value, builder, property) ===
989-
"borderless",
990-
);
986+
if (
987+
parseUnparsed(declaration.value.value, builder, property) === "borderless"
988+
) {
989+
builder.addDescriptor(property, true);
990+
}
991+
} else if (property === "-rn-ripple-layer") {
992+
if (
993+
parseUnparsed(declaration.value.value, builder, property) === "foreground"
994+
) {
995+
builder.addDescriptor(property, true);
996+
}
991997
} else if (property === "object-fit") {
992998
// https://github.com/parcel-bundler/lightningcss/issues/1046
993999
parseObjectFit(declaration.value, builder);

0 commit comments

Comments
 (0)