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.

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 4 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages