0.1.5 • Published 10 months ago

@avi99/aui v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@avi99/aui

A minimal ui library for react native

1.Installation

npm install @avi99/aui

2. Example

See exaple from here

3.Usage

import { Button } from '@avi99/aui';

const MyButton = () => {
    return (
        <Button 
            mode='flat' 
            onPress={() => console.log("clicked")} 
            style={{ width: 80 }} 
            title="Click Me!" 
        />
    )
}

4.Components

Button

import { Button } from '@avi99/aui';

export fuction App(){
    return (
        <Button 
            mode='flat' 
            onPress={() => console.log("clicked")} 
            title="Click Me!" 
        />
    )
}
PropertyRequiredTypeDescription
modetrueStringmode of the button. mode should be one of following ('flat','outlined','text')
onPresstrueFunctionthis calls when user press the button
titletrueStringbutton text
backgroundfalseColorValuebackground color for button.default -> #1E90FF
colorfalseColorValuebutton text color.default -> #FFFFFF
outlineColorfalseColorValuebutton outline color.default -> #4169E1
containerStylefalseViewStyleadditional styling
roundedfalseBooleanif true, button corners will be rounded
ripplefalseBooleanenables ripple effect when user press the button
rippleColorfalseColorValueripple color.

Loader

import { Loader } from '@avi99/aui';

export fuction App(){
    return (
        <Loader 
           name='3-dots-blinking' 
           color={'#1C1678'} 
        />
    )
}
PropertyRequiredTypeDescription
nametrueStringname of loader.it should be one of following('6Dots','3Dots','curveSpin','triangle','dotGliding','fading-Box','4DotSquare','3DotScale','3DotBlinking','3DotSwap','3DotSway','3Rings','tinyCurve','2Curves','3Quarters','ringExpand','endlessSquares','spinningSquare','5DotWave')
durationfalseNumberduration of the animation. default value vary according to animation
colorfalseColorValuebackground color of loader. default -> #1E90FF

Switch

import { Switch } from '@avi99/aui';

export fuction App(){
    return (
        <Switch
           onChange={(state: Boolean) => setValue(state)} 
           value={value} 
        />
    )
}
PropertyRequiredTypeDescription
valuetrueBooleancurrent state of the button
onChangetrueFunctiontriggers when user press the switch
colortrueColorValuebackground color of switch. default -> #1E90FF
containerStylefalseViewStyleadditional styling

Seperator

import { Seperator } from '@avi99/aui';

export fuction App(){
    return (
        <Seperator/>
    )
}
PropertyRequiredTypeDescription
colorfalseColorValuebackground color of seperator
containerStylefasleViewStyleadditional styling

Progress Bar

import { ProgressBar } from '@avi99/aui';

export fuction App(){
    const [progress, setProgress] = React.useState<number>(0);
    return (
        <ProgressBar color={'purple'} value={progress} />
    )
}
PropertyRequiredTypeDescription
colorfalseColorValuebackground color of progress bar. default -> #5BC236
valuetrueNumberprogress value. it should be in between 0 - 100
widthfalseDimensionValuewidth of progressbar. default -> '100%' of its container
heightfalseDimensionValueheight of progressbar. default -> 8
containerStylefalseViewStyleadditional styling

OTP Input

import { OtpInput} from '@avi99/aui';

export fuction App(){
   return(
      <OtpInput length={5} onChange={(otp:String) => console.log(otp)} onComplete={(otp:String)=>console.log(otp)} />
   )
}
PropertyRequiredTypeDescription
lengthtrueNumberlength of otp component
onCompletefalseFunctiontriggers last digit entered
onChangetrueFunctiontriggers when digits are changed
containerStylefalseViewStylestyling for OTP container
boxStylefalseViewStylestyling for OTP box

TextInput

import { TextInput } from '@avi99/aui';

export fuction App(){
   return(
      <TextInput 
         onChange={(text:String)=>console.log(text)} 
         placeholder={'Enter password'} 
         secured
      ></TextInput>
   )
}
PropertyRequiredTypeDescription
onChangetrueFunctiontriggers when user input text
securedfalseBooleanis true, then entered text will be masked.default -> false
textColorfalseColorValuecolor of entered text. default -> '#000000'
outlineColorfalseColorValueborder color of textbox. default -> '#000000'
disabledfalseBooleanif true, the textinput is disabled
placeholdertrueStringplaceholder text
placeholderColorfalseColorValuecolor of placeholder text. default -> '#000000'
containerStylefalseViewStyleadditional styling

Bottomsheet

current version does not support pan gestures yet.
import { BottomSheet,type SheetRef,Button } from '@avi99/aui';

export fuction App(){
    const sheetRef = React.useRef<SheetRef>(null);
    const openSheet = () => {
      sheetRef.current?.open()
    }
    const closeSheet = () => {
      sheetRef.current?.close()
    }
  
    return(
     <BottomSheet height={'90%'} ref={sheetRef} backdropColor={'red'} onClose={closeSheet}>
         <View style={{ height: '100%', width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
            <Button onPress={closeSheet} title={'close sheet'} mode='flat' />
         </View>
      </BottomSheet>


    )
}
PropertyRequiredTypeDescription
closefalseFunctionclose function.if user pass this prop, user can close the bottomsheet by press on the backdrop
backdropColorfalseColorValuecolor of backdrop component. default -> '#000000'
heighttrueDimensionValueheight of bottomsheet
childrentrueReactNodechild nodes that required to be rendered inside bottomsheet

methods

NameDescriptionUsage
openopen the bottomsheetsheetRef.current.open()
closeclose the bottomsheetsheetRef.current.close()

Portal

import { Portal,PortalProvider } from '@avi99/aui';

export function AppWrapper(){
     return(
        <PortalProvider>
            </App>
        </PortalProvider>
     )
}

function App(){
    const sheetRef = React.useRef<SheetRef>(null);
    const openSheet = () => {
      sheetRef.current?.open()
    }
    const closeSheet = () => {
      sheetRef.current?.close()
    }
  
    return(
     <Portal name="bottomsheet">
       <BottomSheet height={'90%'} ref={sheetRef} backdropColor={'red'} onClose={closeSheet}>
         <View style={{ height: '100%', width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
           <Button onPress={closeSheet} title={'close sheet'} mode='flat' />
         </View>
       </BottomSheet>
     </Portal>
    )
}
PropertyRequiredTypeDescription
nametrueStringname for component that used to identify component uniquely
childrentrueReactNodecomponent that required to reloacate

IconButton

import { IconButton } from '@avi99/aui';

export function App(){
   return(
     <IconButton onPress={() => console.log("pressed")} title={"Home"} icon='home' ripple={true} width={80} />
   )


}
PropertyRequiredTypeDescription
onPresstrueFunctiontriggers when button is pressed
titletrueStringtitle text of the button
icontrueStringicon name
colorfalseColorValuecolor of icon & title. default -> '#FFFFFF'
containerStylefalseViewStyleadditional styling
backgroundfalseColorValuebackground color of button. default -> '#1E90FF'
outlinedfalseBooleanif true, background -> '#FFFFFF'. only outline,icon,tile are visible
reversedfalseBooleanif true, order of icon & title reversed
ripplefalseBooleanenables ripple effect when user press the button
roundedfalseBooleanif true, button corners will be rounded

License

MIT


Made with create-react-native-library

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago