Skip to content

Commit f8ca08b

Browse files
authored
feat: android ripple (#95)
1 parent fadc623 commit f8ca08b

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.config/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"xcworkspace"
1111
],
1212
"words": [
13+
"borderless",
1314
"colorjs",
1415
"oklab",
1516
"prebuild"

src/compiler/__tests__/declarations.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { compileWithAutoDebug } from "react-native-css/jest";
22

33
// prettier-ignore
44
const tests = [
5+
["-rn-ripple-color: black;", [{ d: [["black", ["android_ripple", "color"]]], s: [1, 1] }]],
6+
["-rn-ripple-style: borderless;", [{ d: [[true, ["android_ripple", "borderless"]]], s: [1, 1] }]],
57
["caret-color: black", [{ d: [["#000", ["cursorColor"]]], s: [1, 1] }]],
68
["stroke: black;", [{ d: [["#000", ["stroke"]]], s: [1, 1] }]],
79
["rotate: 3deg;", [{ d: [[[{}, "rotateZ", "3deg"], "rotateZ"]], s: [1, 1] }]],

src/compiler/atRules.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
8282
// Include any default mapping here
8383
const mapping: StyleRuleMapping = {
8484
"caret-color": ["cursorColor"],
85+
"-webkit-line-clamp": ["numberOfLines"],
86+
"-rn-ripple-color": ["android_ripple", "color"],
87+
"-rn-ripple-style": ["android_ripple", "borderless"],
8588
};
8689

8790
if (!rules) return mapping;

src/compiler/declarations.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -943,17 +943,23 @@ export function parseCustomDeclaration(
943943
builder: StylesheetBuilder,
944944
) {
945945
const property = declaration.value.name;
946-
if (
947-
validProperties.has(property) ||
948-
property.startsWith("--") ||
949-
property.startsWith("-rn-")
950-
) {
946+
947+
if (property === "-webkit-line-clamp") {
951948
builder.addDescriptor(
952949
property,
953950
parseUnparsed(declaration.value.value, builder, property),
954951
);
955-
} else if (property === "-webkit-line-clamp") {
956-
builder.addMapping({ [property]: ["numberOfLines"] });
952+
} else if (property === "-rn-ripple-style") {
953+
builder.addDescriptor(
954+
property,
955+
parseUnparsed(declaration.value.value, builder, property) ===
956+
"borderless",
957+
);
958+
} else if (
959+
validProperties.has(property) ||
960+
property.startsWith("--") ||
961+
property.startsWith("-rn-")
962+
) {
957963
builder.addDescriptor(
958964
property,
959965
parseUnparsed(declaration.value.value, builder, property),

0 commit comments

Comments
 (0)