1.0.2 • Published 3 years ago

react-native-lock-screen v1.0.2

Weekly downloads
11
License
Apache License
Repository
github
Last release
3 years ago
ReactNative: Lock Screen (Android/iOS)

If this project has helped you out, please support us with a star 🌟

An easy-to-use, customizable and Material Design ready Pattern/Pin Lock view for Android & iOS.

Pin
Pattern
With Background

📖 Getting started

$ yarn add react-native-lock-screen --save

RN60 >= RNLS V1 >

RN60 above please use react-native-lock-screen V1 and above

$ yarn add react-native-lock-screen

$ yarn add react-native-svg

$ yarn add react-native-vector-icons

  • iOS

iOS Prerequisite: Please make sure CocoaPods is installed on your system

- Add the following to your `Podfile` -> `ios/Podfile` and run pod update:
  use_native_modules!

  pod 'RNLockScreen', :path => '../node_modules/react-native-lock-screen/ios'
  • Android

RN60 < RNLS V1 <

RN60 below please use react-native-lock-screen V.0.*

$ react-native link react-native-lock-screen

$ react-native link react-native-svg

$ react-native link react-native-vector-icons

  • Android
    • Please add below snippet into your app build.gradle
buildscript {
    repositories {
      jcenter()
      maven { url "https://maven.google.com" }
		...
    }
	...
}


allprojects {
    repositories {
      maven { url 'https://jitpack.io' }
		  maven { url "https://maven.google.com" }
		...
    }
}

Note: This library is support on Android 27 > above

  • iOS

  • After react-native link react-native-lock-screen, please verify node_modules/react-native-lock-screen/ios/ contains Pods folder. If does not exist please execute pod install command on node_modules/react-native-lock-screen/ios/, if any error => try pod repo update then pod install

💻 Usage

import RNLockScreen from 'react-native-lock-screen';

<RNLockScreen type={RNLockScreen.Type.Pin} mode={RNLockScreen.Mode.Capture} onCapture={lock => {
  }} onVerified={() => {

  }}
  lock={'123'}
/>

💡 Props

PropTypeDefaultNote
typenumberPin - 0Specify type of lock (Pin/Pattern)
modenumberCapture - 0Specify mode of lock (Capture/Verify)
lockstringSpecify lock then the mode is Verify
lockLimitnumber4Specify lock limit of lock
clearLockOnErrorbooltrueSpecify clear flag on error, it will automatically reset pin visualize state to it's default
onCapturefuncSpecify onCapture event function, this is invoked once passcode is captured
onVerifiedfuncSpecify onVerified event function, this is invoked when the passcode is verified
backgroundImagenumber : optionalSpecify lock screen background image
renderHeaderFragmentfunc : optionalSpecify func to customize header fragment
renderSeparatorfunc : optionalSpecify func to customize separator
renderLockFragmentfunc : optionalSpecify func to customize lock fragment
patternPropsobject : optionalSpecify obj to pass pattern props
pinPropsobject : optionalSpecify obj to pass pin props
headerFragmentPropsobject : optionalSpecify obj to pass header fragment props
lockFragmentPropsobject : optionalSpecify obj to pass lock fragment props
defaultStateobject : optionalSpecify obj to pass DEFAULT state props
reenterStateobject : optionalSpecify obj to pass REENTER state props
successStateobject : optionalSpecify obj to pass SUCCESS state props
errorStateobject : optionalSpecify obj to pass error state props
confirmPinobject : optionalSpecify obj to pass confirm pin state props
deletePinobject : optionalSpecify obj to pass delete pin state props
  • Default State Props: defaultState
PropTypeDefaultNote
titlestringEnter a passcodeSpecify the header fragment title
titleStylestring{ fontSize: 24, color: "#FFF" }Specify title style
iconstringlock iconSpecify the header circle icon
dotPropsstringstyle: { backgroundColor: "#FFF" }Specify the Dot component props
  • Reenter State Props: reenterState
PropTypeDefaultNote
titlestringEnter a passcodeSpecify the header fragment title
titleStylestring{ fontSize: 24, color: "#FFF" }Specify title style
iconstringlock iconSpecify the header circle icon
dotPropsstringstyle: { backgroundColor: "#FFF" }Specify the Dot component props
  • Success State Props: successState
PropTypeDefaultNote
titlestringEnter a passcodeSpecify the header fragment title
titleStylestring{ fontSize: 24, color: "#FFF" }Specify title style
iconstringlock iconSpecify the header circle icon
dotPropsstringstyle: { backgroundColor: "#037d50" }Specify the Dot component props
  • Error State Props: errorState
PropTypeDefaultNote
titlestringEnter a passcodeSpecify the header fragment title
titleStylestring{ fontSize: 24, color: "#FFF" }Specify title style
iconstringlock iconSpecify the header circle icon
dotPropsstringstyle: { backgroundColor: "#be0000" }Specify the Dot component props
  • Pin Props
PropTypeDefaultNote
confirmPinstringSpecify text/icon/style of confirm pin
deletePinstringSpecify text/icon/style of delete pin
ripplePropsstringSpecify props of ripple. Please refer react-native-material-ripple
containerStylestringSpecify style of root container
textStylestringSpecify style of text displayed
suggestionStylestringSpecify style of suggestion displayed
alphabetPinSuggestionbooltrueEnable/Disable alphabet suggestion
  • Confirm/Delete Pin Props
PropTypeDefaultNote
titlestringSpecify text of confirm pin
iconstringConfirm Icon/Delete IconSpecify icon of confirm pin
stylestringSpecify style of title/icon

✨ Credits

🤔 How to contribute

Have an idea? Found a bug? Please raise to ISSUES. Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list below. ✨

📜 License

This library is provided under the Apache License.

RNLockScreen @ prscX

💖 Support my projects

I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like 🚀
  • If you're feeling especially charitable, please follow prscX on GitHub.

    Thanks! ❤️ prscX.github.io </ Pranav >

1.0.2

3 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago