A React Native component that implements security with morse code
npm install --save morse-passcode
import Doorman from 'morse-passcode';
render() {
return (
<Doorman
style={styles.container}
onPress={(x, y) => {}}
onRelease={(x, y) => {}}
passcode={[[0,84],[448,528],[960,1036]]}
leeway={1000}
onFail={input => {
// set leeway to something high like 5000 and use this to find a passcode
console.log('Failed', JSON.stringify(input));
}}
onSuccess={input => {}}
rippleDuration={2000}
fadeOutDuration={1000}
rippleColor="#ccf2ff"
>
{/* children of Doorman will act as if they were in a View */}
</Doorman>
);
}
Example code
Maybe TODO if (this gets popular)
- passcode incorporating tap location
- multiple passcodes granting different access
Inspired by this CodePen by Fabrizio Bianchi
Main differences being that this example uses React Native and takes into account press length as opposed to just taps.