How to use the hyperview/src/services/render.renderChildren function in hyperview

To help you get started, we’ve selected a few hyperview 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 Instawork / hyperview / src / components / hv-option / index.js View on Github external
},
      style: undefined,
    };
    if (props.style && props.style.flex) {
      // Flex is a style that needs to be lifted from the inner component to the outer
      // component to ensure proper layout.
      outerProps.style = { flex: props.style.flex };
    }

    return React.createElement(
      TouchableWithoutFeedback,
      outerProps,
      React.createElement(
        View,
        props,
        ...Render.renderChildren(element, stylesheets, onUpdate, newOptions),
      ),
    );
  }
}
github Instawork / hyperview / src / index.js View on Github external
export function text(element, stylesheets, onUpdate, options) {
  const { skipHref } = options || {};
  const props = createProps(element, stylesheets, options);
  const component = React.createElement(
    Text,
    props,
    ...Render.renderChildren(element, stylesheets, onUpdate, options),
  );

  return skipHref ?
    component :
    addHref(component, element, stylesheets, onUpdate, options);
}
github Instawork / hyperview / src / components / hv-view / index.js View on Github external
const registerInputHandler = ref => {
          inputRefs.push(ref);
        };
        viewOptions = { ...viewOptions, registerInputHandler };
      }

      const scrollDirection = element.getAttribute('scroll-orientation');
      if (scrollDirection === 'horizontal') {
        props.horizontal = true;
      }
    }

    const component = React.createElement(
      Component,
      props,
      ...Render.renderChildren(element, stylesheets, onUpdate, viewOptions),
    );
    return skipHref
      ? component
      : addHref(component, element, stylesheets, onUpdate, viewOptions);
  }
}
github Instawork / hyperview / src / services / index.js View on Github external
) => {
  const href = element.getAttribute('href');
  const action = element.getAttribute('action');
  const childNodes = element.childNodes ? Array.from(element.childNodes) : [];
  const behaviorElements = childNodes.filter(
    n => n && n.nodeType === 1 && n.tagName === 'behavior',
  );
  const hasBehaviors = href || action || behaviorElements.length > 0;
  if (!hasBehaviors) {
    return component;
  }

  return React.createElement(
    HyperRef,
    { element, stylesheets, onUpdate, options },
    ...Render.renderChildren(element, stylesheets, onUpdate, options),
  );
};
github Instawork / hyperview / src / components / hv-select-multiple / index.js View on Github external
render() {
    const { element, stylesheets, onUpdate, options } = this.props;
    if (element.getAttribute('hide') === 'true') {
      return null;
    }
    const props = createProps(element, stylesheets, { ...options });
    return React.createElement(
      View,
      props,
      ...Render.renderChildren(element, stylesheets, onUpdate, {
        ...options,
        onToggle: this.onToggle,
      }),
    );
  }
}
github Instawork / hyperview / src / index.js View on Github external
const registerInputHandler = ref => inputRefs.push(ref);
      viewOptions = { ...viewOptions, registerInputHandler };
    }
  }

  if (scrollable) {
    const scrollDirection = element.getAttribute('scroll-orientation');
    if (scrollDirection === 'horizontal') {
      props.horizontal = true;
    }
  }

  const component = React.createElement(
    c,
    props,
    ...Render.renderChildren(element, stylesheets, onUpdate, viewOptions),
  );
  return skipHref ?
    component :
    addHref(component, element, stylesheets, onUpdate, viewOptions);
}
github Instawork / hyperview / src / components / hv-event-source / index.js View on Github external
render() {
    const { element, stylesheets, onUpdate, options } = this.props;
    return React.createElement(
      EventSourceContext.Provider,
      { value: this.eventObject },
      ...Render.renderChildren(element, stylesheets, onUpdate, options),
    );
  }
}
github Instawork / hyperview / src / components / hv-select-single / index.js View on Github external
render() {
    const { element, stylesheets, onUpdate, options } = this.props;
    if (element.getAttribute('hide') === 'true') {
      return null;
    }
    const props = createProps(element, stylesheets, { ...options });
    return React.createElement(
      View,
      props,
      ...Render.renderChildren(element, stylesheets, onUpdate, {
        ...options,
        onSelect: this.onSelect,
      }),
    );
  }
}