react-strict-dom icon indicating copy to clipboard operation
react-strict-dom copied to clipboard

(feature) CSS calc function

Open KingAmo opened this issue 1 month ago • 4 comments

Describe the issue

import { css } from 'react-strict-dom';

const styles = css.create({
  test: {
    width: 150,
    height: 'calc(100px + 50px)',
    backgroundColor: 'pink',
  },
});

css calc not work in react native (it works in web)

Expected behavior

css calc works in react native

Steps to reproduce

code above

Test case

No response

Additional comments

No response

KingAmo avatar Oct 30 '25 07:10 KingAmo

https://facebook.github.io/react-strict-dom/api/css/#compatibility

i find the Compatibility section in doc, calc not support yet

KingAmo avatar Oct 30 '25 07:10 KingAmo

is there any plan to support calc in react native?

KingAmo avatar Oct 30 '25 07:10 KingAmo

Yes there is the intent to support calc in RN but it's blocked on landing a CSS unit parser, which is itself stalled.

FWIW, you don't need calc if the units are the same as in your example.

necolas avatar Oct 30 '25 08:10 necolas

Yes there is the intent to support calc in RN but it's blocked on landing a CSS unit parser, which is itself stalled.

FWIW, you don't need calc if the units are the same as in your example.

i am using react-strict-dom in a brown field react-native project , i want to pollyfill env(safe-area-inset-bottom) , so there are use case like height: 'calc(env(safe-area-inset-bottom) + 50px)'

so there is another question, if i already have Device.safeArea.bottom , how to pollyfill env(safe-area-inset-bottom) in react strict dom? currently i use patch-package to patch react-strict-dom:

Image

KingAmo avatar Oct 30 '25 08:10 KingAmo