@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.
37 lines • 1.11 kB
JavaScript
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { NavigationContext } from '@react-navigation/native';
import { PressableIcon } from './PressableIcon';
import { ChevronIcon } from '../Icons';
import { useHMSRoomStyle } from '../hooks-util';
import { TestIds } from '../utils/constants';
export const BackButton = () => {
const navigation = React.useContext(NavigationContext);
const buttonStyles = useHMSRoomStyle(theme => ({
backgroundColor: theme.palette.surface_default
}));
if (!navigation || !navigation.canGoBack()) {
return null;
}
const handleGoBack = () => {
if (navigation.canGoBack()) {
navigation.goBack();
}
};
return /*#__PURE__*/React.createElement(PressableIcon, {
testID: TestIds.back_button,
style: [styles.button, buttonStyles],
rounded: true,
border: false,
onPress: handleGoBack
}, /*#__PURE__*/React.createElement(ChevronIcon, {
direction: "left"
}));
};
const styles = StyleSheet.create({
button: {
marginTop: 16,
marginLeft: 16
}
});
//# sourceMappingURL=BackButton.js.map