1.0.5 ā€¢ Published 8 months ago

@wjdghks963/react-native-shuffle-pincode v1.0.5

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

šŸ”‘ react-native-pincode

PIN CODE component for react-native

If you have any suggestions or bugs, please don't hesitate to register an issue or PR. Thank you šŸ„³

šŸŽ„ Sample Video

šŸ¤– AOS

and

šŸŽ IOS

ios

šŸ“¦ Installation

install with react-native-reanimated and follow react-native-reanimated to set babel plugin

npm i @wjdghks963/react-native-shuffle-pincode react-native-reanimated

āš™ļø Usage

Simple Usage

function App(): JSX.Element {
  const isDarkMode = useColorScheme() === 'dark';

  const backgroundStyle = {
    backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
  };

  const pincode = ['1', '1', '1', '1', '1', '1'];

  const [backGroundColor, setBackGroundColor] = useState < string > ('');

  return (
    <SafeAreaView style={backgroundStyle}>
      <StatusBar
        barStyle={isDarkMode ? 'light-content' : 'dark-content'}
        backgroundColor={backgroundStyle.backgroundColor}
      />
      <View style={{ height: '100%' }}>
        <PinCode
          pinCount={pincode.length}
          correctPin={pincode}
          afterClear={() => setBackGroundColor('yellow')}
          backgroundColor={backGroundColor}>
          <PinCode.PinContent filledColor="red" emptyColor=""/>
          <PinCode.NumberPad
            emptyIcon={<Text>ā­ļø</Text>}
            deleteIcon={<Text>DEL</Text>}
            shuffleIcon={<Text>Shuffle</Text>}
            backgroundColor={'red'}
          />
        </PinCode>
      </View>
    </SafeAreaView>
  );
}

šŸ”§ Properties

Properties that accept React.ReactNode can accommodate any type of component, whether they are native components from React Native's core or components from third-party libraries. This flexibility allows you to seamlessly integrate a wide range of UI elements and widgets into your PIN CODE screen.

ex)

<View/>, <Text/>, <Image/> ...

PinCode

PropertyNameTypeDescriptionDefault
pinCountnumberLength of pin coderequired
correctPinstring[]The value You've specified as an answerrequired
afterClearanyFunction that execute when correctPin and User input is samerequired
backgroundColorstring?Main Container background color""

PINContent

PropertyNameTypeDescriptionDefault
titleReactNode?Title that above pinsnull
filledColorstring?Circle Color when user input pinred
emptyColorstring?Circle Color before input comes#fca5a5
badgeSizenumber?Size of badges23

NumberPad

PropertyNameTypeDescriptionDefault
emptyIconReact.ReactNodeComponent that Represents a blank space in the Numpadrequired
deleteIconReact.ReactNodeComponent that can delete inputrequired
shuffleIconReact.ReactNode?Component that can shuffle numpad''
backgroundColorstring?Numpad background color#dc2626
textColorstring?Numpad text colorwhite

License

MIT


Made with create-react-native-library