UNPKG

react-native-xenon

Version:

A powerful in-app debugging tool for React Native.

66 lines (65 loc) 1.82 kB
"use strict"; import { StyleSheet, Text, View } from 'react-native'; import colors from "../../../theme/colors.js"; import { showNewLine } from "../../../core/utils.js"; import ShareableText from "../common/ShareableText.js"; import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime"; export default function NetworkRequestDetailsItem({ label, content }) { const renderContent = () => { switch (true) { case typeof content === 'string': return /*#__PURE__*/_jsxs(ShareableText, { style: styles.text, children: [content, showNewLine(!content.endsWith('\n'))] }); case Array.isArray(content): return /*#__PURE__*/_jsx(View, { children: content.map(([key, value], index) => /*#__PURE__*/_jsxs(View, { style: styles.pairContainer, children: [/*#__PURE__*/_jsxs(Text, { style: [styles.label, styles.subLabel], children: [key, ':'] }), /*#__PURE__*/_jsxs(ShareableText, { style: styles.text, children: [value, showNewLine(index === content.length - 1)] })] }, `${key}-${index}`)) }); } }; return /*#__PURE__*/_jsxs(View, { style: styles.container, children: [/*#__PURE__*/_jsx(Text, { style: styles.label, children: label }), renderContent()] }); } const styles = StyleSheet.create({ container: { rowGap: 2 }, pairContainer: { flexDirection: 'row', columnGap: 4 }, text: { fontSize: 14, fontWeight: 'normal', color: colors.black, flexShrink: 1 }, label: { fontSize: 16, fontWeight: 'bold', color: colors.black }, subLabel: { fontSize: 14, fontWeight: 'bold' } }); //# sourceMappingURL=NetworkRequestDetailsItem.js.map