bubble-dev / _

🍱 metarepo of many packages and various monorepos
52 stars 6 forks source link

🌱 stili: support transform style as an array in stili web #327

Closed DonGideon closed 4 years ago

DonGideon commented 4 years ago

a simple change that will solve this:

<Block style={{ transform: [{ scale }] }}> in web to not have a lint error:

Type '{ transform: { scale: number; }[]; }' is not assignable to type 'TExtend<CSSProperties, { fontSmoothing?: string | undefined; tapHighlightColor?: string | undefined; fontWeight?: 400 | 100 | 200 | 300 | 500 | 600 | 700 | 800 | 900 | undefined; fontSize?: number | undefined; }>'.
  Type '{ transform: { scale: number; }[]; }' is not assignable to type 'Pick<CSSProperties, "contain" | "alignContent" | "alignItems" | "alignSelf" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | ... 748 more ... | "vectorEffect">'.
    Types of property 'transform' are incompatible.
      Type '{ scale: number; }[]' is not assignable to type 'string'.
codecov[bot] commented 4 years ago

Codecov Report

Merging #327 into master will not change coverage by %. The diff coverage is n/a.

Impacted Files Coverage Δ
packages/stili/src/index.web.ts 100.00% <ø> (ø)
DonGideon commented 4 years ago

@deepsweet @xaviervia would really appreciate your input here... after that i will open a PR in Primitives to update the dependency of Stili after that... i will open a PR in Next to update the dependency of Primitives/Block after that i will go to sleep

deepsweet commented 4 years ago

The PR just fixes types and not normalizing anything, my guess was that there will be only array allowed and then it goes directly to styles on native and through a helper on web.

Also, I'd extract those transform types and not import react-native in web file even for types.

DonGideon commented 4 years ago

@deepsweet yes! but isn't the normalization happening here: https://github.com/bubble-dev/_/blob/6bb00f53bcfc27578f7f18e8848682bdcd776c75/packages/primitives/block/src/index.web.tsx#L73 ?

deepsweet commented 4 years ago

oh, then it should be extracted, I think it's more of a stili responsibility @xaviervia