1"use strict"; 2var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 3 if (k2 === undefined) k2 = k; 4 var desc = Object.getOwnPropertyDescriptor(m, k); 5 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 6 desc = { enumerable: true, get: function() { return m[k]; } }; 7 } 8 Object.defineProperty(o, k2, desc); 9}) : (function(o, m, k, k2) { 10 if (k2 === undefined) k2 = k; 11 o[k2] = m[k]; 12})); 13var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 14 Object.defineProperty(o, "default", { enumerable: true, value: v }); 15}) : function(o, v) { 16 o["default"] = v; 17}); 18var __importStar = (this && this.__importStar) || function (mod) { 19 if (mod && mod.__esModule) return mod; 20 var result = {}; 21 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 22 __setModuleDefault(result, mod); 23 return result; 24}; 25var __importDefault = (this && this.__importDefault) || function (mod) { 26 return (mod && mod.__esModule) ? mod : { "default": mod }; 27}; 28Object.defineProperty(exports, "__esModule", { value: true }); 29exports.LogBoxInspectorMessageHeader = void 0; 30/** 31 * Copyright (c) 650 Industries. 32 * Copyright (c) Meta Platforms, Inc. and affiliates. 33 * 34 * This source code is licensed under the MIT license found in the 35 * LICENSE file in the root directory of this source tree. 36 */ 37const react_1 = __importDefault(require("react")); 38const react_native_1 = require("react-native"); 39const LogBoxMessage_1 = require("../UI/LogBoxMessage"); 40const LogBoxStyle = __importStar(require("../UI/LogBoxStyle")); 41const SHOW_MORE_MESSAGE_LENGTH = 300; 42function ShowMoreButton({ message, collapsed, onPress, }) { 43 if (message.content.length < SHOW_MORE_MESSAGE_LENGTH || !collapsed) { 44 return null; 45 } 46 return (react_1.default.createElement(react_native_1.Text, { style: styles.collapse, onPress: onPress }, "... See More")); 47} 48function LogBoxInspectorMessageHeader(props) { 49 return (react_1.default.createElement(react_native_1.View, { style: styles.body }, 50 react_1.default.createElement(react_native_1.View, { style: styles.heading }, 51 react_1.default.createElement(react_native_1.Text, { style: [styles.headingText, styles[props.level]] }, props.title)), 52 react_1.default.createElement(react_native_1.Text, { style: styles.bodyText }, 53 react_1.default.createElement(LogBoxMessage_1.LogBoxMessage, { maxLength: props.collapsed ? SHOW_MORE_MESSAGE_LENGTH : Infinity, message: props.message, style: styles.messageText }), 54 react_1.default.createElement(ShowMoreButton, { ...props })))); 55} 56exports.LogBoxInspectorMessageHeader = LogBoxInspectorMessageHeader; 57const styles = react_native_1.StyleSheet.create({ 58 body: { 59 backgroundColor: LogBoxStyle.getBackgroundColor(1), 60 boxShadow: `0 2px 0 2px #00000080`, 61 }, 62 bodyText: { 63 color: LogBoxStyle.getTextColor(1), 64 fontSize: 14, 65 includeFontPadding: false, 66 lineHeight: 20, 67 fontWeight: '500', 68 paddingHorizontal: 12, 69 paddingBottom: 10, 70 }, 71 heading: { 72 alignItems: 'center', 73 flexDirection: 'row', 74 paddingHorizontal: 12, 75 marginTop: 10, 76 marginBottom: 5, 77 }, 78 headingText: { 79 flex: 1, 80 fontSize: 20, 81 fontWeight: '600', 82 includeFontPadding: false, 83 lineHeight: 28, 84 }, 85 warn: { 86 color: LogBoxStyle.getWarningColor(1), 87 }, 88 error: { 89 color: LogBoxStyle.getErrorColor(1), 90 }, 91 fatal: { 92 color: LogBoxStyle.getFatalColor(1), 93 }, 94 syntax: { 95 color: LogBoxStyle.getFatalColor(1), 96 }, 97 static: { 98 color: LogBoxStyle.getFatalColor(1), 99 }, 100 messageText: { 101 color: LogBoxStyle.getTextColor(0.6), 102 }, 103 collapse: { 104 color: LogBoxStyle.getTextColor(0.7), 105 fontSize: 14, 106 fontWeight: '300', 107 lineHeight: 12, 108 }, 109 button: { 110 paddingVertical: 5, 111 paddingHorizontal: 10, 112 borderRadius: 3, 113 }, 114}); 115//# sourceMappingURL=LogBoxInspectorMessageHeader.js.map