Skip to content

Conversation

@alexandre-eliot
Copy link

  • Add TIME and TIMING into tokenTypes
  • Add NUMBER support to directionFactory
  • Add valuesFactory for transition and animation properties
  • Add PERCENT support to transforms
  • Add animation and transition support
  • Add box-shadow opacity support
  • Add support for non-unit number in box-shadow

Copy link
Contributor

@jacobp100 jacobp100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this! To summarise the review,

  • Omitting units has been discussed at length - the conclusion was we will require them where CSS does
  • I'm not sure opacity in a box shadow is valid CSS
  • Could we double check percent support for transforms in RN? I'm pretty certain it doesn't support them
  • I love the idea of supporting animations/transitions, but the API should split these off from regular RN styles


it('transforms box-shadow with rgba color and opacity', () => {
expect(
transformCss([['box-shadow', '10px 20px rgba(100, 100, 100, 0.5) 0.5']])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you point to a spec for the last number? AFAICT it's not part of CSS


it('animation a single property', () => {
expect(transformCss([['animation', 'slide-in linear .3s']])).toEqual({
animationName: ['slide-in'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be pretty great to support this stuff in this library

I have a slight issue with mixing RN styles with things RN cannot handle

Perhaps we could change the API to return { styles, animation, transition } etc. where styles is all the stuff that's compatible with RN, then all the other properties are things libraries can use to polyfill support etc.

@@ -1,2 +1 @@
/node_modules
/index.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this just for testing purposes?

})
})

it('allows shorthands without unit', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #40

const match = node.value.match(timeRe)
if (match === null) return null

return Number(match[1]) * (match[2]==='s' ? 1000 : 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run prettier on this file?

}
const xyNumber = xyTransformFactory(NUMBER)
const xyLength = xyTransformFactory(LENGTH)
const xyLength = xyTransformFactory(LENGTH, PERCENT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think RN doesn't support percents in transforms

@jacobp100
Copy link
Contributor

I'm going to close this, but if you want to continue work on this, just @ me

@jacobp100 jacobp100 closed this Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants