react-native-xenon
Version:
A powerful in-app debugging tool for React Native.
48 lines (47 loc) • 1.36 kB
JavaScript
;
import { memo } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { CONSOLE_ITEM_HEIGHT } from "../../../core/constants.js";
import { formatLogMessage, getConsoleTypeColor } from "../../../core/utils.js";
import colors from "../../../theme/colors.js";
import Touchable from "../common/Touchable.js";
import { jsx as _jsx } from "react/jsx-runtime";
const ConsolePanelItem = /*#__PURE__*/memo(({
type,
values,
onPress
}) => {
return /*#__PURE__*/_jsx(Touchable, {
onPress: onPress,
style: styles.container,
children: /*#__PURE__*/_jsx(View, {
style: [styles.wrapper, {
backgroundColor: getConsoleTypeColor(type)
}],
children: /*#__PURE__*/_jsx(Text, {
numberOfLines: 1,
style: styles.text,
children: formatLogMessage(values)
})
})
});
}, (prevProps, nextProps) => prevProps.type === nextProps.type && JSON.stringify(prevProps.values) === JSON.stringify(nextProps.values));
const styles = StyleSheet.create({
container: {
flex: 1,
paddingBottom: 4,
height: CONSOLE_ITEM_HEIGHT
},
wrapper: {
flex: 1,
paddingHorizontal: 8,
justifyContent: 'center',
borderRadius: 8
},
text: {
color: colors.black,
fontSize: 14
}
});
export default ConsolePanelItem;
//# sourceMappingURL=ConsolePanelItem.js.map