Home Reference Source

src/views/assessment/components/ConfirmationMenu.js

import React from 'react';
import {StyleSheet, View} from 'react-native';

import CloseRoundButton from '../../../components/buttons/CloseRoundButton';
import OkRoundButton from '../../../components/buttons/OkRoundButton';

import {RoundButtonSize} from '../../../utils/DimensionsConstants';

/**
 * Menu shown when user is exiting, prompting user to save the drawing
 * @param {Object} props - Properties
 * @param {function} props.onPressClose - Function run when user presses Close button
 * @param {function} props.onPressOk - Function run when user presses OK button
 * @returns {Object} A view containing OK and Close buttons
 */
export default function ConfirmationMenu(props) {
    // Retrieve props
    const onCloseAction = props.onPressClose;
    const onValidateAction = props.onPressOk;

    return (
        <View style={styles.buttonContainer}>
            <CloseRoundButton
                containerStyle={styles.button}
                buttonSize={RoundButtonSize.SMALL}
                onPress={onCloseAction}
            />
            <OkRoundButton
                containerStyle={styles.button}
                onPress={onValidateAction}
            />
        </View>
    );
}

/**
 * Local styles
 * @type {Object}
 */
const styles = StyleSheet.create({
    buttonContainer: {
        position: 'absolute',
        alignItems: 'flex-end',
        bottom: 0,
        right: 0,
    },
    button: {
        marginRight: 20,
        marginBottom: 17,
    },
});