1.0.6 • Published 1 year ago

as-components v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Installation

Using npm

npm install as-components

Using yarn

yarn add as-components

Usage

1. InlineImageTextInput

You also need to install react-native-responsive-fontsize

You can also use props of TextInput

import { InlineImageTextInput } from 'as-components'

handleChangeText=(text)=>{
        console.log(text)
}

<InlineImageTextInput
    handleChangeText={this.handleChangeText.bind(this}
    label="Enter Your Email"
    keyboardType="email"
    icon={require("../../email.png")}
    value={this.state.email}
    isSecureTextEntry={false}
    errorMessage={this.state.errorMessage}
    isSubDomain={true}
    subDomain=".subdomain.com"
    customStyle={{fontSize:16,color:"black"}}
    />

Props

PropsTypeDefaultOptionalDescription
handleChangeTextfuncnullnocallback that return the text value
placeholderstringnullYesPlaceholder text
keyboardTypestringdefaultYeskeyboardType like email,numeric
iconimage sourcenullYesicon beside text input
valuestringemptyYesvalue of text input
isSecureTextEntryboolfalseYesto hide or show text on textinput
errorMessagestringemptyYesto show error of textinput field
isSubDomainboolfalseYesshow domain text or not
isEditablebooltrueYesallow user to input text or not
pointerEventstringautoYesallow user touch or not
subDomainstring.ensurexper.comYesdomain text for show
customStyleobjectnullYestext style for textinput
labelstringnullYeslabel same as material text inut

2. ProgressiveImage

import { ProgressiveImage } from "as-components";

<ProgressiveImage
  resizeMode="contain"
  thumbnailSource={require("../../placeholder.png")}
  source={{ url: this.state.image }}
  imageStyle={{ width: 100, height: 100 }}
/>;

Props

PropsTypeDefaultOptionalDescription
containerStyleobjectnullYesimage container style
thumbnailSourcesourcestatic givenYesthumb image before loading image
sourcesourcenullNoimage url or local image
resizeModestringstretchYesimage resize mode

3. ListLoadMore

You can also use props of FlatList

import { ListLoadMore } from 'as-components'

<ListLoadMore
data={[]}
refreshing={false}
renderItem={(data,index)=>{return(<View><Text>{data.toString()}</Text></View>)}}
onNextPageLoad={{nextPage}=>{console.log("nextPage",nextPage)}}
loaderSize="small"
/>

Props

PropsTypeDefaultOptionalDescription
containerStyleobject{flex:1}Yescontainer style of list
listStyleobject{flex:1}Yesstyle of list
dataarray[]Nodata for list
refreshingboolfalseYesfor pull to refresh
renderItemfuncnullNoto render list item
reachedThreshHoldnumber0.01Yesthreshold for pagination from where pagination start
onNextPageLoadfuncnullYesget next page when list reached to its threashold
renderFooterfuncnullYesrender view for show loader at the bottom of list
loaderSizestringsmallYessize of loader in footer view
isAllDataFetchedboolfalseNoset true when all data fetched

4. GridLoadMore

You can also use props of FlatList

import { GridLoadMore } from 'as-components'
<GridLoadMore
data={[]}
refreshing={false}
renderItem={(data,index)=>{return(<View><Text>{data.toString()}</Text></View>)}}
onNextPageLoad={{nextPage}=>{console.log("nextPage",nextPage)}}
loaderSize="small"
numColumn={2}
/>

Props

PropsTypeDefaultOptionalDescription
containerStyleobject{flex:1}Yescontainer style of list
listStyleobject{flex:1}Yesstyle of list
dataarray[]Nodata for list
refreshingboolfalseYesfor pull to refresh
renderItemfuncnullNoto render list item
reachedThreshHoldnumber0.01Yesthreshold for pagination from where pagination start
onNextPageLoadfuncnullYesget next page when list reached to its threashold
renderFooterfuncnullYesrender view for show loader at the bottom of list
loaderSizestringsmallYessize of loader in footer view
numColumnnumber2Nofor show grid column
isAllDataFetchedboolfalseNoset true when all data fetched

4. LoaderButton

Example

Example Avilable in ExampleLoaderButton.js file

Alt Text

This component's style is based on default Device's System Dark Mode.

import { LoaderButton } from "as-components";

onButtonClick = () => {
  setLoading(true);
  clearTimeout(this.loadTime);
  setTimeout(() => {
    setLoading(false);
  }, 1000);
};
<LoaderButton
  title="Login"
  isLoading={this.state.loading}
  onButtonClick={() => onButtonClick()}
  loaderSize="small"
/>;

Props

PropsTypeDefaultOptionalDescription
titlestringTitleNoTitle For button
isLoadingboolfalseNoisLoading is boolean for showing loader
loaderSizestringsmallYesloaderSize is loader size
loaderColorstringblackYesloaderColor is color for loader
onButtonClickfucnundefinedNocallback function for button click
buttonStyleobjectYesstyle for button view
textStyleobjectYesstyle for text
containerStyleobjectheight : 45Yesstyle for container view of button

5. Loader

Usage

This component will placed at the end of compoent and before last closed view/scrollview or any component

import { Loader } from "as-components";

<View>
  .... other components ... other components
  <Loader
    isLoading={this.state.loading}
    backgroundColor="black"
    indicatorColor="white"
    size="small"
  />
</View>;

Props

PropsTypeDefaultOptionalDescription
isLoadingboolfalseNoisLoading is boolean for showing loader
sizestringsmallYessize is loader size
backgroundColorstring00000040YesbackgroundColor is color for loader's background
indicatorColorstringFFFFFFYesindicatorColor is color for loader

6. ReactButton

Usage

You also need to install react-native-responsive-fontsize

import { ReactButton } from "as-components";

<View>
  .... other components ... other components
  <ReactButton
    styleButton={styles.submit}
    onPress={() => {
      this.onPressSubmit();
    }}
    backgroundColor={colors.LIGHT_BLUE}
    textColor={colors.WHITE}
    label="Submit"
  />
</View>;

Props

PropsTypeDefaultOptionalDescription
labelstringemptyNolabel for button
styleButtonobjectfalsenullYesStyle for button
onPressfuncnullNocall back function for button click
backgroundColorstring00000040YesbackgroundColor is color for loader's background
disabledboolnullYesby default disabled is false, true for disable click for user action
textColorstringnullNocolor for text

7. ReactText

Usage

import { ReactText } from "as-components";

<View>
  .... other components ... other components
  <ReactText
    buttonStyle={{ width: 120, height: 45, backgroundColor: "black" }}
    textStyle={{ color: "white" }}
    onPress={() => {
      this.onPressSubmit();
    }}
    content="Submit"
  />
</View>;

Props

PropsTypeDefaultOptionalDescription
contentstringemptyNocontent for text
buttonStyleobjectfalsenullYesStyle for button
onPressfuncnullNocall back function for button click
textStyleobjectnullYesstyle for content
disabledboolnullYesby default disabled is false, true for disable click for user action
1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago