npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-box-lite

v0.1.2

Published

Box lite for React Native, It's good for web developer to move to mobile developer

Downloads

275

Readme

react-native-box-lite

components-demo

Installation

$ npm install react-native-box-lite

Extension for react-native-box-lite

To use suggestion for className, you need to install extension react-native-components-intellisense in your vscode.

Usage

import {Box, Button, Text} from 'react-native-box-lite';
import {View} from 'react-native';

const test =()=>{
   const containerStyle = useClassName({
      className: "flex-1 bg-white p-4"
   })
   const containerHeaderStyle = useClassName({
      className: "bg-black p-4 h-10 w-screen"
   })

   return (
      <View style={containerStyles}>
         <Box style={containerHeaderStyle}>
            <Text className="text-white font-bold text-xl">
               Title Demo rn component
            </Text>
         </Box>
         <Box className="bg-amber-200 h-12 w-12">
            <Text className="text-white font-bold text-md">
               Demo rn component
            </Text>
         </Box>
         <Button title="Demo Button Default" />
         <Button varian="outline" title="Demo Button Outline" />
         <Button varian="primary" title="Demo Button Primary" />
      <View>
   )
}

Usage custom styles

  • use passed number in [] as w-[200] => width: 200
  • scale you can use function horizontalScale fontSize,... [${horizontalScale(30)}]
import {Box, Text} from 'react-native-box-lite';

const customStyles = () => {
  return (
    <Box>
      <Box className="w-[200] h-[350] bg-white center" />
      <Text className="text-[22] text-green-500 font-bold">
        Demo rn component
      </Text>
    </Box>
  );
};

Note

Type class Gap: support react-native version >= 0.71

HOOK: useClassName

| Prop | Description | Default | | ----------------- | ----------------------------------- | ------- | | className | class of component as:w-1 h-1 | null | | scaleScreen | Active use scale by width of screen | true |

Checkbox

| Prop | Description | Default | | ----------------------- | ----------------------------------------------------------------- | -------------------------------- | | checked | state checked | false | | value | state parameter when event press | null | | label | label of checkbox | null | | color | properties checked and default | checked: blue, default: gray | | size | size of checkbox | 20 | | sizeChildren | size of state checked if has size && (!sizeChildren) => size/2 | 10 | | iconChecked | custom icon checked, type: ImageSourcePropType | null | | renderIconChecked | function render icon checked | null | | className | class styles of container | null | | classNameParent | class styles of Parent | null | | classNameChildren | class styles of Children | null | | classNameLabel | class styles of Label | null | | isDebounce | Active debounce when event press | false | | delayDebounce | time debounce of debounce | 500 |

import {Checkbox} from 'react-native-box-lite';

<Checkbox label="Label" />
<Checkbox checked label="Checked" />
<Checkbox
   size={28}
   checked
   color={{checked: 'green'}}
   label="Custom color and size"
/>
 <Checkbox
   size={28}
   checked
   iconChecked={Add}
   color={{checked: 'green'}}
   label="Custom icon"
/>

example

RadioButton

| Prop | Description | Default | | ----------------------- | ----------------------------------------------------------------- | ------------------------------- | | checked | state checked | false | | value | state parameter when press | null | | label | label of radio | null | | color | properties checked and default | checked: blue,default: gray | | size | size of radio | 20 | | sizeChildren | size of state checked if has size && (!sizeChildren) => size/2 | 8 | | className | class styles of container | null | | classNameParent | class styles of Parent | null | | classNameChildren | class styles of Children | null | | classNameLabel | class styles of Label | null | | isDebounce | Active debounce when press | false | | delayDebounce | time debounce of debounce | 500 |

import {RadioButton} from 'react-native-box-lite';

<RadioButton label="Label" />
<RadioButton checked label="Checked" />
<RadioButton
   size={28}
   checked
   color={{checked: 'green'}}
   label="Custom color and size"
/>

example

Box

| Prop | Description | Default | | ----------------- | ----------------------------------- | ------- | | className | class styles of component | null | | scaleScreen | Active use scale by width of screen | true | | rest | extents from ViewProps | |

import {Box} from 'react-native-box-lite';

<Box className="row gap-2">
  <Box className="w-10 h-10 bg-red-400" />
  <Box className="w-10 h-10 bg-green-400" />
  <Box className="w-10 h-10 bg-yellow-400" />
</Box>;

example

Button

| Prop | Description | Default | | ------------------- | ----------------------------------- | ------- | | varian | type of primary, outline | null | | className | class styles of component | null | | scaleScreen | Active use scale by width of screen | true | | isDebounce | Active debounce when press | false | | delayDebounce | time debounce of debounce | 500 | | rest | extents from TouchableOpacityProps | |

import {Button} from 'react-native-box-lite';

<Button title="Demo Button Default" />
<Button varian="outline" title="Demo Button Outline" />
<Button varian="primary" title="Demo Button Primary" />

example

Text

| Prop | Description | Default | | ----------------- | ----------------------------------- | ------- | | className | class styles of component | null | | scaleScreen | Active use scale by width of screen | true | | rest | extents from TextProps | |

import {Text} from 'react-native-box-lite';

<Text className="font-bold text-xl text-black">Text xl</Text>
<Text className="font-normal text-xl text-black">Font normal</Text>

example

scale screen

| function | Description | parameter | | --------------------- | -------------------------------------------------------------- | --------- | | horizontalScale | scale by ratio width device default guidelineBaseWidth = 375 | number | | verticalScale | scale by ratio height device default guidelineBaseHeight = 812 | number | | moderateScale | scale by ratio width and height | number | | fontSize | scale by ratio width and height | number |