@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.
47 lines (46 loc) • 1.75 kB
JavaScript
import * as React from 'react';
import { View } from 'react-native';
import { LeaveIcon } from '../Icons';
import { useHMSRoomStyleSheet, useModalType } from '../hooks-util';
import { ModalTypes } from '../utils/types';
import { PressableIcon } from './PressableIcon';
import { COLORS } from '../utils/theme';
import { TestIds } from '../utils/constants';
export const HMSManageLeave = props => {
// TODO: read current meeting joined state
const isMeetingJoined = true;
if (!isMeetingJoined) {
return null;
}
return /*#__PURE__*/React.createElement(LeaveButton, props);
};
const LeaveButton = props => {
const {
handleModalVisibleType
} = useModalType();
/**
* Opens the Leave Popup Menu
*/
const handleLeaveButtonPress = () => {
handleModalVisibleType(ModalTypes.LEAVE_ROOM);
};
const hmsRoomStyles = useHMSRoomStyleSheet(theme => ({
button: {
backgroundColor: theme.palette.alert_error_default,
borderColor: theme.palette.alert_error_default
},
icon: {
tintColor: COLORS.WHITE
}
}));
const leaveIconDelegate = 'leaveIconDelegate' in props && props.leaveIconDelegate ? props.leaveIconDelegate : /*#__PURE__*/React.createElement(LeaveIcon, {
style: hmsRoomStyles.icon
});
const leaveButtonDelegate = 'leaveButtonDelegate' in props && props.leaveButtonDelegate ? props.leaveButtonDelegate : /*#__PURE__*/React.createElement(PressableIcon, null, /*#__PURE__*/React.cloneElement(leaveIconDelegate));
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.cloneElement(leaveButtonDelegate, {
onPress: handleLeaveButtonPress,
style: hmsRoomStyles.button,
testID: TestIds.footer_leave_btn
}));
};
//# sourceMappingURL=HMSManageLeave.js.map