Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = {
renderSectionHeader: ({ section: { title } }) =>
// $FlowFixMe
Render.renderElement(title, stylesheets, onUpdate, options),
};
renderItem: ({ item }) =>
Render.renderElement(item, stylesheets, onUpdate, options),
// $FlowFixMe: return value should be of ?React.Element
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}
);
}
renderItem: ({ item }) =>
Render.renderElement(item, stylesheets, onUpdate, options),
showsHorizontalScrollIndicator: horizontal && showScrollIndicator,