Home Reference Source

src/views/diary/components/NavNextPage.js

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

import NextRoundButton from '../../../components/buttons/NextRoundButton';

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

/**
 * Diary menu bar to navigate to next page. Button is visible if props.isVisible is true.
 * @param {Object} props - Properties
 * @param {Object} props.containerStyle - Style of the container view
 * @param {boolean} props.isVisible - If true, the button is visible. Otherwise not visible
 * @param {function} props.onPress -  Action to be executed when the button is pressed
 * @returns {Object} Menu to navigate to the next page
 */
export default function NavNextPage(props) {
    // Retrieve props
    const containerStyle = props.containerStyle;
    const isVisible = props.isVisible;
    const onPressAction = props.onPress;

    return (
        <View style={containerStyle}>
            {isVisible && (
                <NextRoundButton
                    buttonSize={RoundButtonSize.NORMAL}
                    onPress={onPressAction}
                    containerStyle={styles.button}
                />
            )}
        </View>
    );
}

/** Local styles */
const styles = StyleSheet.create({
    button: {
        alignSelf: 'center',
    },
});