Skip to content
Snippets Groups Projects
Select Git revision
  • a6492f7b017c942012b4dcbb20ea1c88412fba4b
  • master default protected
  • 69-resize-image-before-upload
  • 60-add-match-salamander-modal-to-edit-salamander
  • 50-fix-server-error-message
  • 48-fix-gradle
  • 31-camera-communicate-with-api-and-delete-from-cache-2
  • 20-changing-verification-step-in-profile-to-modal
  • 4-add-all-basic-views
  • 1-setup
10 results

CustomButton.js

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CustomButton.js 1.31 KiB
    import * as React from "react";
    import { Button } from "react-native-paper";
    import { StyleSheet } from "react-native";
    
    /**
     * A customizable component, that renders a button styled by the react native paper library. 
     * 
     * @param {Object} props.style - (Optional) can override the default style of the button where necessary, like size and position
     * @param {String} props.color - (Optional) color of the button
     * @param {IconSource} props.icon - (Optional) Icon to display for the button
     * @param {String} props.mode - Mode/emphasis of the button. The modes outlined and contained have mostly been used.
     * @param {Function} props.onPress - function that is run when the button the pressed (gets passed down from the mother component in this case)
     * @param {Boolean} props.disabled - Whether the button is disabled. 
     * @param {String} props.title - The text on the button
     * 
     * @returns the component
     */
    
    const CustomButton = (props) => (
      <Button
        style={{ ...styles.button, ...props.style }}
        color={props.color}
        icon={props.icon}
        mode={props.mode}
        color="#435768"
        onPress={props.onPress}
        disabled={props.disabled}
      >
        {props.title}
      </Button>
    );
    
    export default CustomButton;
    
    const styles = StyleSheet.create({
      button: {
        width: "40%",
        alignSelf: "center",
        color: "#435768",
      },
    });