File tree Expand file tree Collapse file tree
builder-config/framework-reactnative
designto-react-native/tokens-to-rn-widget Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export type ReactNativeBlurConfig = {
2+ layer : "none" | ReactNativeExpoBlurConfig | ReactNativeCommunityBlurConfig ;
3+ background : "none" | null ;
4+ image : ReactNativeImageBlurConfig ;
5+ } ;
6+
7+ /**
8+ * RN has a built-in blur effect for image based elements - Image, BackgroundImage
9+ */
10+ interface ReactNativeImageBlurConfig { }
11+
12+ interface ReactNativeExpoBlurConfig {
13+ module : "expo-blur" ;
14+ }
15+
16+ interface ReactNativeCommunityBlurConfig {
17+ module : "@react-native-community/blur" ;
18+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type { ReactNativeSvgConfig } from "./reactnative-config-svg";
88import type { ReactNativeGradientConfig } from "./reactnative-config-gradient" ;
99import type { ReactNativeTextGradientConfig } from "./reactnative-config-gradient-text" ;
1010import type { ReactNativeShadowConfig } from "./reactnative-config-shadow" ;
11+ import type { ReactNativeBlurConfig } from "./reactnative-config-blur" ;
1112
1213export interface ReactNativeFrameworkConfig {
1314 framework : "react-native" ;
@@ -17,6 +18,10 @@ export interface ReactNativeFrameworkConfig {
1718 gradient_text : ReactNativeTextGradientConfig ;
1819 shadow : ReactNativeShadowConfig ;
1920 svg : ReactNativeSvgConfig ;
21+ /**
22+ * @deprecated not supported at this moment - wip
23+ */
24+ blur ?: ReactNativeBlurConfig ;
2025 component_declaration_style : {
2126 exporting_style : ReactComponentExportingCofnig ;
2227 // not supported yet
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
3- import * as css from "@web-builder/styles " ;
3+ import type { ViewStyle } from "react-native " ;
44
5+ /**
6+ * @deprecated Blur for RN not supported yet.
7+ *
8+ * Learn more
9+ * - https://stackoverflow.com/questions/37131278/how-to-make-the-blur-effect-with-react-native
10+ *
11+ * @param widget
12+ * @param child_composer
13+ * @returns
14+ */
515export function compose_wrapped_with_blurred (
616 widget : core . Blurred ,
717 child_composer : Composer
@@ -10,12 +20,14 @@ export function compose_wrapped_with_blurred(
1020 const isBlurVisibile = widget . blur . visible ;
1121 if ( isBlurVisibile ) {
1222 if ( widget . blur . type === "LAYER_BLUR" ) {
13- child . extendStyle ( {
14- filter : css . blur ( widget . blur . radius ) ,
23+ child . extendStyle < ViewStyle > ( {
24+ // FIXME: blur not supported in RN
25+ // filter: css.blur(widget.blur.radius),
1526 } ) ;
1627 } else if ( widget . blur . type === "BACKGROUND_BLUR" ) {
17- child . extendStyle ( {
18- "backdrop-filter" : css . blur ( widget . blur . radius ) ,
28+ child . extendStyle < ViewStyle > ( {
29+ // FIXME: backdrop-filter not supported in RN
30+ // "backdrop-filter": css.blur(widget.blur.radius),
1931 } ) ;
2032 }
2133 }
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
33import * as css from "@web-builder/styles" ;
4+ import type { ViewStyle } from "react-native" ;
45
56export function compose_wrapped_with_opacity (
67 widget : core . Opacity ,
78 child_composer : Composer
89) {
910 const child = child_composer ( widget . child ) ;
10- child . extendStyle ( {
11+ child . extendStyle < ViewStyle > ( {
1112 opacity : css . opacity ( widget . opacity ) ,
1213 } ) ;
1314 return child ;
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
3+ import type { ViewStyle } from "react-native" ;
34
45export function compose_wrapped_with_overflow_box (
56 widget : core . OverflowBox ,
67 child_composer : Composer
78) {
89 const child = child_composer ( widget . child ) ;
9- child . extendStyle ( {
10+ child . extendStyle < ViewStyle > ( {
1011 overflow : "hidden" ,
1112 } ) ;
1213 return child ;
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
33import * as css from "@web-builder/styles" ;
4+ import type { ViewStyle } from "react-native" ;
45
56export function compose_wrapped_with_positioned (
67 widget : core . Positioned ,
@@ -9,7 +10,7 @@ export function compose_wrapped_with_positioned(
910 const child = child_composer ( widget . child ) ;
1011 // -------------------------------------
1112 // override w & h with position provided w/h
12- child . extendStyle ( {
13+ child . extendStyle < ViewStyle > ( {
1314 width : css . length ( widget . width ) ,
1415 height : css . length ( widget . height ) ,
1516 } ) ;
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
3- import * as css from "@web-builder/styles " ;
3+ import type { ViewStyle } from "react-native " ;
44
55export function compose_wrapped_with_rotation (
66 widget : core . Rotation ,
77 child_composer : Composer
88) {
99 const child = child_composer ( widget . child ) ;
10- child . extendStyle ( {
11- transform : css . rotation ( widget . rotation ) ,
10+ child . extendStyle < ViewStyle > ( {
11+ transform : [
12+ {
13+ rotate : `${ widget . rotation } deg` ,
14+ } ,
15+ ] ,
1216 } ) ;
1317 return child ;
1418}
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
33import * as css from "@web-builder/styles" ;
4+ import type { ViewStyle } from "react-native" ;
45
56export function compose_wrapped_with_sized_box (
67 widget : core . SizedBox ,
78 child_composer : Composer
89) {
910 const child = child_composer ( widget . child ) ;
10- child . extendStyle ( {
11+ child . extendStyle < ViewStyle > ( {
1112 width : css . px ( widget . width ) ,
1213 height : css . px ( widget . height ) ,
1314 } ) ;
Original file line number Diff line number Diff line change 11import * as core from "@reflect-ui/core" ;
22import { Composer } from "." ;
33import { Stretched } from "@designto/token/tokens" ;
4+ import type { ViewStyle } from "react-native" ;
45
56export function compose_wrapped_with_clip_stretched (
67 widget : Stretched ,
@@ -17,8 +18,8 @@ export function compose_wrapped_with_clip_stretched(
1718 }
1819
1920 const child = child_composer ( widget . child ) ;
20- child . extendStyle ( {
21- "align-self" : "stretch" ,
21+ child . extendStyle < ViewStyle > ( {
22+ alignSelf : "stretch" ,
2223 [ remove_size ] : undefined ,
2324 } ) ;
2425 return child ;
You can’t perform that action at this time.
0 commit comments