Home Reference Source

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

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

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

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

/**
 * The button to activate the eraser.
 * @param {Object} props - Properties
 * @param {Object} props.componentStyle - The style of the button
 * @param {ButtonPosition} props.position - Positioning of the button
 * @param {function} props.onPress - Action for the button
 * @returns {Object} The button to activate the eraser
 **/
export default function EraserButton(props) {
    // Retrieve props
    const componentStyle = props.componentStyle;
    const position = props.position;
    const onPressAction = props.onPress;

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

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