Skip to content

Commit

Permalink
copy otp added
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak-Sangle committed Dec 15, 2023
1 parent f965af6 commit 786b1d6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
24 changes: 18 additions & 6 deletions mobile-client/src/screens/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,30 @@ const HomePage = ({ route, navigation }) => {
setBody("");
};

const onSelectedEvent = (index) => {
const changeOpenEvents = (index) => {
return new Promise((resolve, reject)=> {
const temp = [...openEvents];
temp[index] = !temp[index];
setOpenEvents(temp);
resolve();
});
}

const animate = (index) => {
const updatedValue = animatedHeights[index]._value === 0 ? 1 : 0;
Animated.timing(animatedHeights[index], {
toValue: updatedValue,
duration: 300,
easing: Easing.linear,
useNativeDriver: false,
}).start(()=> {
const temp = [...openEvents];
temp[index] = !temp[index];
setOpenEvents(temp);
});
}).start()
}

const onSelectedEvent = (index) => {
changeOpenEvents(index)
.then(() => {
animate(index);
});
};

const RenderAllEntries = () => {
Expand Down
25 changes: 18 additions & 7 deletions mobile-client/src/screens/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,25 @@ const Login = ({navigation}) => {
}

const setCorrectPasscode = (text, i) => {
if(text.length > 1) return;
const acceptedKeys = ['','0','1','2','3','4','5','6','7','8','9'];
if(!acceptedKeys.includes(text)) return;
if(text.length === 1 && i<3) {
passcodeRefs[i+1].current.focus();
}
let index = 0;
console.log({text, i});
const new_passcode = [...passcode];
new_passcode[i] = text;
if(text.length === 0) {
new_passcode[i] = '';
setPasscode(new_passcode);
return;
}
while(text.length > index) {
const acceptedKeys = ['','0','1','2','3','4','5','6','7','8','9'];
if(!acceptedKeys.includes(text[index])) return;
new_passcode[i] = text[index];
if(i<3) {
passcodeRefs[i+1].current.focus();
}
else break;
i++;
index++;
}
setPasscode(new_passcode);
}

Expand Down

0 comments on commit 786b1d6

Please sign in to comment.