1.1.0 โ€ข Published 3 years ago

react-native-customized-box v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-native-customized-box ยท Version License Downloads DocsPassing

React Native Customized Box is very simple and easy to use.

Content

Getting started

Prerequisites

  • Node (version 12 or greater).
  • Yarn (version 1.5 or greater).
  • React, React-Native should be installed
  • A fork of the repo (for any contributions).

Installation

Using NPM

npm i --save react-native-customized-box

Using Yarn

yarn add react-native-customized-box

Overview

๐Ÿ“– Below we provide examples with code how to use!

import CustomBox from "react-native-customized-box";

โ–บ Example - 1

โ†’ Box fully customizable

Code Snippet โ†“

      <CustomBox
        placeholder={"Username"}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
        boxStyle={{ borderRadius: 40, borderWidth: 2 }}
      />
      <CustomBox
        placeholder={"Password"}
        toggle={true}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
        boxStyle={{ borderRadius: 40, borderWidth: 2, borderStyle: "dotted" }}
      />

โ–บ Example - 2

โ†’ Toggle feature enabled

Code Snippet โ†“

      <CustomBox placeholder={"Username"} />
      <CustomBox placeholder={"Password"} toggle={true} />

โ–บ Example - 3

โ†’ Box color change while focusing

Code Snippet โ†“

      <CustomBox
        placeholder={"Username"}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
      />
      <CustomBox
        placeholder={"Password"}
        toggle={true}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
      />

โ–บ Example - 4

โ†’ Label and Required option enable to give error on condition

Code Snippet โ†“

      <CustomBox
        placeholder={"Username"}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
        boxStyle={{ borderRadius: 40, borderWidth: 2, borderStyle: "dashed" }}
        inputStyle={{ textAlign: "center", fontWeight: "bold", color: "red" }}
        labelConfig={{
          text: "Username",
          style: {
            color: "#1f5212",
            fontWeight: "bold",
          },
        }}
        requiredConfig={{
          text: "*This is Required",
        }}
      />
      <CustomBox
        placeholder={"Password"}
        toggle={true}
        boxColor={"dodgerblue"}
        focusColor={"#33ff00"}
        boxStyle={{ borderRadius: 40, borderWidth: 2 }}
        inputStyle={{ fontWeight: "bold", color: "red" }}
        labelConfig={{
          text: "Password",
          style: {
            color: "#0e0e21",
            fontWeight: "bold",
          },
        }}
        requiredConfig={{
          text: <Text>*Add Custom Message and decoreate your own</Text>,
          style: { textAlign: "center", textDecorationLine: "underline" },
        }}
      />

Method and Props Configuration

๐Ÿ”ง Below are the method which you can use to customized the Box in your style

MethodTypeDescription
widthNumberThis is not *Mandatory By default set to 300 but you can change and add your own
heightNumberThis is not *Mandatory By default set to 50 but you can change and add your own
placeholderStringProvide text for the Placeholder
toggleBooleanProvide True to display SHOW/HIDE by default set to False
boxColorStringProvide Color for the InputBox by default color set to silver
focusColorStringProvide Color for change the box color while focusing the InputBox
boxStyleObjectProvide custom style/decoration for the InputBox
inputStyleObjectProvide custom style/decoration for the Text inside the InputBox
labelConfigObjecttext: Provide text for the Label (String) style: Provide custom style for the Label (Object)
requiredConfigObjecttext: Provide custom mandatory message to display like(*This is Required) you can add your own (String) style: Provide custom style for the required text (Object)
valuesStringYou can use this to set predefine values or get the current InputBox value
onChangeTextFunctionFunction like onChangeText

Author

Thank You All ๐Ÿ™๐Ÿป

Made with ๐Ÿ–ค by

Author : Rishu Chowdhary

Email : hi.10rishu@gmail.com

License

MIT License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE.md file for details