Skip to content

Commit

Permalink
Remove deprecated usage of this.refs in Home.tsx.
Browse files Browse the repository at this point in the history
This replaces usage of `this.refs` with the `createRef` API as recommneded here: https://reactjs.org/docs/refs-and-the-dom.html#legacy-api-string-refs.

I haven't meansured it yet, but this might also help improve modal performance. See: facebook/react#8333 (comment)
  • Loading branch information
CypherPoet authored and CypherPoet committed Sep 16, 2020
1 parent 560520e commit 1587693
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 153 deletions.
8 changes: 4 additions & 4 deletions src/components/QrCodeModalContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function QrCodeModalContents(props) {
const barcodeRecognized = async (barcodes) => {
if (barcodes.data) {
setOpenCameraFlag(false);
props.modalRef ? props.modalRef.snapTo(1) : ''; // closes modal
props.onClose();
props.onQrScan(getFormattedString(barcodes.data));
}
};
Expand Down Expand Up @@ -106,9 +106,9 @@ export default function QrCodeModalContents(props) {
</ImageBackground>
</AppBottomSheetTouchableWrapper>
)}
{/* { !props.flag ? <TextInput placeholder={'Enter Recipients Address'}
placeholderTextColor={Colors.borderColor}
style={styles.qrModalTextInput}
{/* { !props.flag ? <TextInput placeholder={'Enter Recipients Address'}
placeholderTextColor={Colors.borderColor}
style={styles.qrModalTextInput}
autoCorrect={false}
/> : null}
*/}
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Contacts/AddContactAddressBook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ export default function AddContactAddressBook(props) {
const renderContactListErrorModalContent = useCallback(() => {
return (
<ErrorModalContents
modalRef={contactListErrorBottomSheet}
title={'Error while accessing your contacts '}
info={errorMessage}
proceedButtonText={'Open Setting'}
Expand Down Expand Up @@ -445,7 +444,7 @@ export default function AddContactAddressBook(props) {
>
Skip Contact
</Text>
</AppBottomSheetTouchableWrapper>
</AppBottomSheetTouchableWrapper>
</View> */}
<View style={[styles.searchBoxContainer]}>
<View style={styles.searchBoxIcon}>
Expand Down
14 changes: 7 additions & 7 deletions src/pages/Contacts/TrustedContactRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ export default function TrustedContactRequest(props) {
onFocus={() => {
if (Platform.OS === 'ios') {
setOnBlurFocus(true);
props.bottomSheetRef.snapTo(2);
props.bottomSheetRef.current.snapTo(2);
}
}}
onBlur={() => {
checkForValidation(EmailId);
setOnBlurFocus(false);
props.bottomSheetRef.snapTo(1);
props.bottomSheetRef.current.snapTo(1);
}}
value={EmailId}
/>
Expand Down Expand Up @@ -158,13 +158,13 @@ export default function TrustedContactRequest(props) {
onFocus={() => {
if (Platform.OS === 'ios') {
setOnBlurFocus(true);
props.bottomSheetRef.snapTo(2);
props.bottomSheetRef.current.snapTo(2);
}
}}
onBlur={() => {
checkForValidation(PhoneNumber);
setOnBlurFocus(false);
props.bottomSheetRef.snapTo(1);
props.bottomSheetRef.current.snapTo(1);
}}
value={PhoneNumber}
/>
Expand Down Expand Up @@ -246,9 +246,9 @@ export default function TrustedContactRequest(props) {
onFocus={() => {
if (Platform.OS == 'ios') {
if (passcodeArray.length == 0 && i == 0) {
props.bottomSheetRef.snapTo(2);
props.bottomSheetRef.current.snapTo(2);
} else {
props.bottomSheetRef.snapTo(2);
props.bottomSheetRef.current.snapTo(2);
}
}
}}
Expand All @@ -258,7 +258,7 @@ export default function TrustedContactRequest(props) {
(passcodeArray.length == 0 || passcodeArray.length == 6) &&
i == 5
) {
props.bottomSheetRef.snapTo(1);
props.bottomSheetRef.current.snapTo(1);
}
}
}}
Expand Down
Loading

0 comments on commit 1587693

Please sign in to comment.