Skip to content

Commit 77576b4

Browse files
update rm rn unsupported properties
1 parent f592616 commit 77576b4

4 files changed

Lines changed: 38 additions & 15 deletions

File tree

externals/coli

Submodule coli updated from 0b2bf9c to 86802c5

packages/builder-web-core/widget-core/widget-with-style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export abstract class WidgetWithStyle<OUTSTYLE = CSSProperties>
8282
abstract jsxConfig(): JSXElementConfig;
8383

8484
private extendedStyle: CSSProperties = {};
85-
extendStyle(style: CSSProperties) {
85+
extendStyle<T = CSSProperties>(style: T) {
8686
this.extendedStyle = {
8787
...this.extendedStyle,
8888
...style,
Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
11
import * as core from "@reflect-ui/core";
22
import { Composer } from ".";
33
import * as css from "@web-builder/styles";
4+
import type { ViewStyle } from "react-native";
45

56
export function compose_wrapped_with_clip_rrect(
67
widget: core.ClipRRect,
78
child_composer: Composer
89
) {
910
const child = child_composer(widget.child);
10-
child.extendStyle({
11-
...css.borderRadius(widget.borderRadius),
12-
overflow: "hidden",
11+
const br = css.borderRadius(widget.borderRadius);
12+
13+
const style: ViewStyle = {
14+
overflow: "hidden", // do we need this on rn?
1315
width: "100%", // ----- need better approach
1416
height: "100%", // ----- need better approach
15-
});
17+
};
18+
19+
// convert css property to rn property
20+
if (br["border-radius"]) {
21+
style["borderRadius"] = br["border-radius"] as any as number;
22+
} else {
23+
style["borderTopLeftRadius"] = br[
24+
"border-top-left-radius"
25+
] as any as number;
26+
style["borderTopRightRadius"] = br[
27+
"border-top-right-radius"
28+
] as any as number;
29+
style["borderBottomRightRadius"] = br[
30+
"border-bottom-right-radius"
31+
] as any as number;
32+
style["borderBottomLeftRadius"] = br[
33+
"border-bottom-left-radius"
34+
] as any as number;
35+
}
36+
37+
child.extendStyle<ViewStyle>(style);
1638
return child;
1739
}

packages/designto-react-native/tokens-to-rn-widget/index.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ function compose<T extends JsxWidget>(
139139
else if (widget instanceof core.ClipRRect) {
140140
thisRnWidget = compose_wrapped_with_clip_rrect(widget, handleChild);
141141
} else if (widget instanceof core.ClipPath) {
142-
const child = handleChild<StylableJsxWidget>(widget.child);
143-
child.extendStyle({
144-
...css.clipPath(widget),
145-
top: undefined,
146-
left: undefined,
147-
right: undefined,
148-
bottom: undefined,
149-
});
150-
thisRnWidget = child;
142+
// FIXME: add clip-path support for react-native
143+
// const child = handleChild<StylableJsxWidget>(widget.child);
144+
// child.extendStyle({
145+
// ...css.clipPath(widget),
146+
// top: undefined,
147+
// left: undefined,
148+
// right: undefined,
149+
// bottom: undefined,
150+
// });
151+
// thisRnWidget = child;
151152
}
152153
// ----- endregion clip path ------
153154
else if (widget instanceof core.RenderedText) {

0 commit comments

Comments
 (0)