Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {
streamURL,
autoPlay,
muted,
accessibilityLabel,
accessible,
children,
defaultSource,
onLayout,
source,
testID
} = this.props;
const displayRTCView = resolveAssetSource(!isLoaded ? defaultSource : source);
const backgroundRTCView = displayRTCView ? `url("${displayRTCView}")` : null;
let style = StyleSheet.flatten(this.props.style);
const resizeMode = this.props.resizeMode || style.resizeMode || RTCViewResizeMode.cover;
// remove 'resizeMode' style, as it is not supported by View (N.B. styles are frozen in dev)
style = process.env.NODE_ENV !== 'production' ? { ...style } : style;
delete style.resizeMode;
/**
* RTCView is a non-stretching View. The rtcVideoView is displayed as a background
* rtcVideoView to support `resizeMode`. The HTML rtcVideoView is hidden but used to
* provide the correct responsive rtcVideoView dimensions, and to support the
* rtcVideoView context menu. Child content is rendered into an element absolutely
* positioned over the rtcVideoView.
*/
var attributes = {src: streamURL}
if (muted != null && muted != undefined && muted)
attributes.muted = 'muted'
function transform(node) {
if (!node || !node.props) return node;
const { className, style: styles, ...props } = node.props;
const children = (node.children || node.props.children || []).map(transform);
const flattened = StyleSheet.flatten(styles);
const style = Object.keys(flattened || {}).length ? { style: flattened } : {};
return React.cloneElement(
withoutProps(node),
omitBy(
{
...cleanSvgProps(node, props),
...transformRenderProps(props, transform),
...cleanClassNames(className),
...style
},
excludeProps
),
...children
);
}
export const flattenStyleTransform = (accum, node, props, children) => {
const { style: styles, ...other } = props;
const flattened = StyleSheet.flatten(styles);
const style = Object.keys(flattened || {}).length ? { style: flattened } : {};
return {
accum,
children,
node,
props: {
...other,
...style
}
};
};