{"repo":"akvelon/react-native-sms-user-consent","free":true,"listed":false,"github":"https://github.com/akvelon/react-native-sms-user-consent","clone":"git clone https://github.com/akvelon/react-native-sms-user-consent.git","description":"React Native wrapper for Android's SMS User Consent API, ready to use in React Native apps with minimum effort.","language":"Java","stars":99,"topics":["react-native","android","otp","one-time","verification","code","mobile","2fa","two-factor","auth"],"license":null,"category":"mobile-apps","readme_excerpt":"React Native SMS User Consent React Native wrapper for Android's SMS User Consent API, ready to use in React Native apps with minimum effort. The purpose of SMS User Consent API is to provide one-tap auto-filling of SMS verification codes. iOS SMS User Consent API exists only on Android, so this package is Android-only. Calling this package's APIs on iOS is no-op. If you want auto-filling on iOS, textContentType=\"oneTimeCode\" for TextInput is the way to go. Basically, this is the only way for iOS. Getting started Install the package: or Basic usage In the example we use a controlled TextInput for the code entry. retrievedCode equals to the empty string initially, and whenever an SMS is handled retrievedCode receives the code from it. We use the useEffect to update the input value when an SMS is handled. Customise verification code parser Set the length of the validation code: Provide a custom regular expression: API useSmsUserConsent() React hook that starts SMS handling and provides the received code as its return value, which is the empty string initially. Stops handling SMS messages on unmount. Uses startSmsHandling and retrieveVerificationCode internally. This hook is the way to go in most cases. Alternatively, you can use startSmsHandling and retrieveVerificationCode directly if dealing with something that is not a functional component or you need some more flexibility. On iOS it just returns the empty string, so no additional code to handle iOS is needed. Accepts an opt","default_branch":null,"files":null,"tree":[],"storefront":"/r/akvelon","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/akvelon/react-native-sms-user-consent/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}