UNPKG

@100mslive/react-native-room-kit

Version:

100ms Room Kit provides simple & easy to use UI components to build Live Streaming & Video Conferencing experiences in your apps.

60 lines 1.88 kB
import * as React from 'react'; import { StyleSheet, Text, TouchableOpacity } from 'react-native'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; import { HMSNotification } from './HMSNotification'; import { AlertTriangleIcon } from '../Icons'; import { useHMSRoomStyleSheet, useLeaveMethods } from '../hooks-util'; import { OnLeaveReason } from '../utils/types'; import { COLORS } from '../utils/theme'; export const HMSTerminalErrorNotification = ({ id, exception, autoDismiss, dismissDelay }) => { const { leave } = useLeaveMethods(); const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({ button: { backgroundColor: theme.palette.alert_error_default }, buttonText: { color: COLORS.WHITE, fontFamily: `${typography.font_family}-SemiBold` } })); const handleLeaveRoomPress = () => { leave(OnLeaveReason.NETWORK_ISSUES); }; const tapGesture = Gesture.Tap(); return /*#__PURE__*/React.createElement(HMSNotification, { id: id, icon: /*#__PURE__*/React.createElement(AlertTriangleIcon, null), text: exception.description || 'Something went wrong!', dismissDelay: dismissDelay, autoDismiss: autoDismiss, cta: /*#__PURE__*/React.createElement(GestureDetector, { gesture: tapGesture }, /*#__PURE__*/React.createElement(TouchableOpacity, { style: [styles.button, hmsRoomStyles.button], onPress: handleLeaveRoomPress }, /*#__PURE__*/React.createElement(Text, { style: [styles.buttonText, hmsRoomStyles.buttonText] }, "Leave"))) }); }; const styles = StyleSheet.create({ button: { paddingVertical: 8, paddingHorizontal: 16, borderRadius: 8, marginRight: 16 }, buttonText: { fontSize: 14, lineHeight: 20, letterSpacing: 0.25 } }); //# sourceMappingURL=HMSTerminalErrorNotification.js.map