Home Reference Source

src/views/assessment/components/buttons/ClearAllButton.js

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

import BaseDrawingButton from './BaseDrawingButton';
import TrashIconSvgr from '../../../../assets/iconsSvgr/TrashIconSvgr';

/**
 * The button clicked when clearing the drawing.
 * @param {Object} props - Properties
 * @param {Object} props.componentStyle - The style of the button
 * @param {number} props.position - Positioning of the button: 0 for LEFT, 1 for RIGHT and 2 for MIDDLE
 * @param {function} props.onPress - Action for the button
 * @returns {Object} The button clicked when clearing the drawing
 */
export default function ClearAllButton(props) {
    // Retrieve props
    const componentStyle = props.componentStyle;
    const position = props.position;
    const onPressAction = props.onPress;

    return (
        <BaseDrawingButton
            componentStyle={componentStyle}
            position={position}
            onPress={onPressAction}>
            <TrashIconSvgr style={styles.icon} />
        </BaseDrawingButton>
    );
}

/**
 * Local styles
 * @type {Object}
 */
const styles = StyleSheet.create({
    icon: {
        flex: 1,
        width: '100%',
        height: '100%',
    },
});