react-native-netlog-fab
Version:
Floating action button for network logging in React Native apps.
87 lines (86 loc) • 2.17 kB
JavaScript
"use strict";
import React from 'react';
import { Modal, View, StyleSheet, TouchableOpacity, Text } from 'react-native';
import NetworkLogger from 'react-native-network-logger';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const LoggerModal = ({
visible,
onClose,
height = 0.7,
theme = 'light',
sort = 'desc',
maxRows,
compact = false,
onBackPressed
}) => {
return /*#__PURE__*/_jsx(Modal, {
visible: visible,
transparent: true,
animationType: "slide",
onRequestClose: onBackPressed || onClose,
children: /*#__PURE__*/_jsx(View, {
style: styles.modalOverlay,
children: /*#__PURE__*/_jsxs(View, {
style: [styles.modalContent, {
height: `${height * 100}%`
}],
children: [/*#__PURE__*/_jsxs(View, {
style: styles.header,
children: [/*#__PURE__*/_jsx(Text, {
style: styles.headerText,
children: "Network Logs"
}), /*#__PURE__*/_jsx(TouchableOpacity, {
onPress: onClose,
style: styles.closeButton,
children: /*#__PURE__*/_jsx(Text, {
style: styles.closeButtonText,
children: "Close"
})
})]
}), /*#__PURE__*/_jsx(View, {
style: {
flex: 1
},
children: /*#__PURE__*/_jsx(NetworkLogger, {
theme: theme,
sort: sort,
maxRows: maxRows,
compact: compact
})
})]
})
})
});
};
const styles = StyleSheet.create({
modalOverlay: {
flex: 1,
backgroundColor: 'rgba(0, 0, 0, 0.5)',
justifyContent: 'flex-end'
},
modalContent: {
backgroundColor: 'white',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
padding: 20
},
header: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 10
},
headerText: {
fontSize: 18,
fontWeight: 'bold'
},
closeButton: {
padding: 5
},
closeButtonText: {
color: '#6200ee',
fontSize: 16
}
});
export default LoggerModal;
//# sourceMappingURL=LoggerModal.js.map