Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-component-kits

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-component-kits

React Native Components

  • 1.0.39
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52
increased by333.33%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-component-kits

npm version npm


fateh999




Getting started

$ npm install react-native-component-kits --save

  • OR

$ yarn add react-native-component-kits

Descriptions

This library will help you improve your code, faster and easier.

Components

ViewVisibleAnimated

<ViewVisibleAnimated >
    <Text>Hello</Text>
</ViewVisibleAnimated> 
  • Props
type ViewVisibleAnimatedProps = {
    scaleEnable?: Boolean,
    autoHide?: Boolean,
    onShowDone?: void,
    onDone?: void,
    onShowStart?: void,
    style?: StyleProp<ViewStyle>,
    delay?: Number,
    duration?: Number,
    timeout?: Number,
    autoShow?: Boolean,
    pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto',
    scaleType?: 'in' | 'out',
    renderHiddenContent?: any // Content show when component hide, default null
};
  • Method
show(callback, isDelay)

hide(callback)

ScaleButton

<ScaleButton onPress={()=>{}}>
    <Text>Hello</Text>
</ScaleButton> 
  • Props
type TouchableWithoutFeedbackProps

Toast

import { toastRef, Toast, showToast } from 'react-native-component-kits';

// Used
showToast({
    message: 'Copy success!',
    type: 'success',
    position: 'top',
});

<Toast ref={toastRef} />
// or custom children
<Toast>
{({ title, type, message }) => <Text>{message}</Text>}
</Toast>
  • Props
export type ToastProps = {
    translateEnable?: Boolean,
    scaleEnable?: Boolean,
    style?: StyleProp<ViewStyle>,
};

export type ShowToastProps = {
    message: String,
    duration?: Number,
    position?: 'top' | 'bottom',
    type?: 'success' | 'fail',
    onPress?: void,
    title?: String,
    // rest | You can pass any props to your children params
};

Functions
FunctionsDescriptionType
memoDeepEqualUsing memo of React but deep compare preProps with nextProps to check component should be return true or false.Higher Order Function
memoWithRefIt's like memoDeepEqual but using forwardRef to get ref of component.Higher Order Function
useStateCallbackUsing useState of React and handle to get callback after setStateHook
useStateSafeUsing useState of React and handle don't update state when component unmountedHook
detectEmailCheck string is emailBoolean
detectUserNameCheck string is user nameBoolean
detectPhoneNumberCheck string is user phone numberBoolean
withAnimatedConvert class component to use AnimatedFunction
Hooks
FunctionsDescriptionType
useCountdownCountdown value. Params: startDate, endDate, autoStart,intervalTimeHooks
useIntervalCountdown value. Params: callback, delay, autoStartHooks
useFetchDataCountdown value. Params: api,loadingDefault, pathDataHooks

How to use

memoDeepEqual

const App = ()=>{
    return <Text>Hello</Text>
}
export default memoDeepEqual(App) 

// OR

const App = memoDeepEqual(()=>{
    return <Text>Hello</Text>
})

export default App

memoWithRef

const App = (props, ref)=>{
    const updateValue = (value)=>{
        console.log(value)
    }

    useImperativeHandle(
        ref,
        () => ({
            updateValue  
        }),
        [],
    )
    return <Text>Hello</Text>
}
export default memoWithRef(App) 

useStateCallback

const [state, setState] = useStateCallback(initialState)

setState('123',(nextState)=>{
    console.log(nextState)
})

License

This module is MIT licensed


Keywords

FAQs

Package last updated on 16 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc