How to use the remax.macro.hostComponents.get function in remax

To help you get started, we’ve selected a few remax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remaxjs / remax / packages / remax / src / propsAlias.ts View on Github external
export function getAlias(
  prop: string,
  isNative = false,
  platform?: string,
  type?: string
) {
  if (!isNative && type) {
    const hostComponent = hostComponents.get(type);

    if (hostComponent?.alias?.[prop]) {
      return hostComponent.alias[prop];
    }
  }

  prop = prop.replace('className', 'class').replace('ClassName', 'Class');

  if (isNative) {
    return prop;
  }

  if (prop.startsWith('on') || prop.startsWith('catch')) {
    return functionPropAlias(prop, platform);
  }

remax

Remax 是一个全新的基于 React 的小程序开发框架

MIT
Latest version published 2 years ago

Package Health Score

53 / 100
Full package analysis