alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
11.36k stars 1.48k forks source link

[Feature Request] Support RN Hermes Engine #3935

Open StarHosea opened 1 year ago

StarHosea commented 1 year ago

What problem does this feature solve?

hermes will not support with operator which used in json-schema expression compiler . hermes language feature excluded from support

What does the proposed API look like?

replace compiler with operator like this

const Registry = {
  silent: false,
  compile(expression: string, scope = {}) {
 // insert $root before expression vars
   expression = expression.replaceAll(/(\$\w+)/g, '$root.$1');
    if (Registry.silent) {
      try {
        return new Function('$root', ` return (${expression}); `)(
          scope
        )
      } catch {}
    } else {
      return new Function('$root', `return (${expression}); `)(
        scope
      )
    }
  },
}

another change should be the custom scope,

mrsquhuainan commented 1 year ago

希望赶快修复吧,我们也是有这个问题

cc20140820 commented 1 year ago

同上,升级rn到 0.70后默认开启Hermes引擎,不再支持【with】操作符,导致formily无法工作