How to use the hyperview/src/services/render.renderElement 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 / core / hyper-ref / index.js View on Github external
const pressBehaviors = behaviorElements.filter(
      e =>
        PRESS_TRIGGERS.indexOf(
          e.getAttribute(ATTRIBUTES.TRIGGER) || TRIGGERS.PRESS,
        ) >= 0,
    );
    const visibleBehaviors = behaviorElements.filter(
      e => e.getAttribute(ATTRIBUTES.TRIGGER) === TRIGGERS.VISIBLE,
    );
    const refreshBehaviors = behaviorElements.filter(
      e => e.getAttribute(ATTRIBUTES.TRIGGER) === TRIGGERS.REFRESH,
    );

    // Render the component based on the XML element. Depending on the applied behaviors,
    // this component will be wrapped with others to provide the necessary interaction.
    let renderedComponent = Render.renderElement(
      element,
      stylesheets,
      onUpdate,
      { ...options, pressed, skipHref: true },
    );

    const styleAttr = element.getAttribute(ATTRIBUTES.HREF_STYLE);
    const hrefStyle = styleAttr
      ? styleAttr.split(' ').map(s => stylesheets.regular[s])
      : null;

    const pressHandlers: PressHandlers = {};

    // Render pressable element
    if (pressBehaviors.length > 0) {
      const props = {
github Instawork / hyperview / src / components / hv-section-list / index.js View on Github external
renderSectionHeader: ({ section: { title } }) =>
        // $FlowFixMe
        Render.renderElement(title, stylesheets, onUpdate, options),
    };
github Instawork / hyperview / src / components / hv-section-list / index.js View on Github external
renderItem: ({ item }) =>
        Render.renderElement(item, stylesheets, onUpdate, options),
      // $FlowFixMe: return value should be of ?React.Element
github Instawork / hyperview / src / index.js View on Github external
this.reload()}>
            
          
        
      );
    }
    if (!doc) {
      return (
        
      );
    }
    const body = doc.getElementsByTagNameNS(HYPERVIEW_NS, 'body')[0];
    const screenElement = Render.renderElement(
      body,
      this.state.styles,
      this.onUpdate,
      {
        screenUrl: url,
        componentRegistry: this.componentRegistry,
      },
    );

    return (
      
        {screenElement}
      
    );
  }
github Instawork / hyperview / src / components / hv-list / index.js View on Github external
renderItem: ({ item }) =>
        Render.renderElement(item, stylesheets, onUpdate, options),
      showsHorizontalScrollIndicator: horizontal && showScrollIndicator,