0.0.4 • Published 2 years ago

react-native-tiny-components v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-native-tiny-components

Getting started

$ npm install react-native-tiny-components

Usage

import { CheckBox, RadioButton, PopupComponent } from "react-native-tiny-components";


import React, { Component } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';

export default class ExampleApp extends Component {

  constructor(props) {
    super(props);
    this.state = {
      checked: false,
      active: false
    }
  }

  render() {
    return (
      <View style={{}} >
        <CheckBox
          name={"Select"}
          checked={this.state.checked}
          onChecked={(value) => {
            this.setState({ checked: value })
          }}
          textStyle={{ color: "black", fontSize: 16 }}
          color={"rgb(50, 168, 111)"}
          size={30} />

        <RadioButton
          textStyle={{ color: "black", fontSize: 16 }}
          name="Click Here"
          onChecked={(value) => {
            this.setState({ active: value })
          }}
          active={this.state.active}
          color={"#203546"}
          size={30} />

        <TouchableOpacity style={{
          padding: 5,
          backgroundColor: "#203546",
          margin: 10,
          height: 50,
          alignItems: "center",
          justifyContent: "center"
        }}
          onPress={() => {
            this.refs.popup.openDialog();
          }}>
          <Text style={{ color: "white", fontSize: 18 }}>{"Toggle Popup"}</Text>
        </TouchableOpacity>
        
        <PopupComponent ref="popup"
          components={
            <View style={{ backgroundColor: "white" }}>
              <Text>{"Message"}</Text>
            </View>
          }
          headerText="Click Here"
        />
      </View>
    )
  }
}

CheckBox

Props

PropTypeOptionalDefaultDescription
nameStringYesTitle of checkbox.
checkedBooleanNovalue for the checkbox is checked or not .
onCheckedFunctionNoIs called when an the checkbox is clicked .
colorStringYesColor for the check mark .
sizeIntegerYesSize for the checkbox .
textStyleStyleYesStyle for the name .

RadioButton

Props

PropTypeOptionalDefaultDescription
nameStringYesTitle for the radio button.
activeBooleanNovalue for the radio button is checked or not .
onCheckedFunctionNoIs called when an the radio button is clicked .
colorStringYesColor for the radio button .
sizeIntegerYesSize for the radio button .
textStyleStyleYesStyle for the name .

PopupComponent

Props

PropTypeOptionalDefaultDescription
refStringYesWill be used to toggle popup window.
componentsJSX ComponentsNoWhatever is passed in the components prop will be show in the popup body.
headerTextStringNoTitle for the popup .
headerStyleStyleYesStyle for the Title text .
headerTextStyleStyleYesStyle for the Title text container .

Note : This repo is still under construction