From 5e61135cf59f944c68828fd688a718c4c6d82d77 Mon Sep 17 00:00:00 2001
From: First-Terraner <40151034+KKA11010@users.noreply.github.com>
Date: Mon, 19 Jun 2023 21:28:26 +0200
Subject: [PATCH] Add keyboardAvoidingView. Fixes #8 (#72)
* add keyboardAvoidingView. Fixes #8
* update top navigation in contact details
---
src/components/InvoiceAmount.tsx | 10 ++++---
src/components/modal/index.tsx | 5 ++--
.../screens/Addressbook/Contact.tsx | 26 ++-----------------
.../screens/Lightning/payInvoice.tsx | 7 ++---
src/consts/env.ts | 3 ++-
5 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/src/components/InvoiceAmount.tsx b/src/components/InvoiceAmount.tsx
index a186d49e..e8a260f2 100644
--- a/src/components/InvoiceAmount.tsx
+++ b/src/components/InvoiceAmount.tsx
@@ -1,6 +1,7 @@
import { getDecodedLnInvoice } from '@cashu/cashu-ts'
import Button from '@comps/Button'
import useLoading from '@comps/hooks/Loading'
+import { isIOS } from '@consts'
import type { IInvoiceState } from '@model/ln'
import { InvoiceAmountModal, InvoiceModal } from '@screens/Lightning/modal'
import { ThemeContext } from '@src/context/Theme'
@@ -8,7 +9,7 @@ import { globals, highlight as hi } from '@styles'
import { cleanUpNumericStr, vib } from '@util'
import { requestMint } from '@wallet'
import { createRef, useContext, useEffect, useState } from 'react'
-import { Animated, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native'
+import { Animated, KeyboardAvoidingView, StyleSheet, Text, TextInput, TouchableOpacity } from 'react-native'
import { useShakeAnimation } from './animation/Shake'
@@ -90,7 +91,10 @@ export default function LNInvoiceAmountModal({
Satoshi
-
+
+
{children}
diff --git a/src/components/screens/Addressbook/Contact.tsx b/src/components/screens/Addressbook/Contact.tsx
index 0fdb0808..998acf48 100644
--- a/src/components/screens/Addressbook/Contact.tsx
+++ b/src/components/screens/Addressbook/Contact.tsx
@@ -6,6 +6,7 @@ import { delContact, editContact as editC, getContacts } from '@db'
import { l } from '@log'
import MyModal from '@modal'
import type { IContactPageProps } from '@model/nav'
+import TopNav from '@nav/TopNav'
import { ContactsContext } from '@src/context/Contacts'
import { ThemeContext } from '@src/context/Theme'
import { globals, highlight as hi } from '@styles'
@@ -58,17 +59,7 @@ export default function ContactPage({ navigation, route }: IContactPageProps) {
}, [openEdit])
return (
- {/* Go back button */}
-
- navigation.navigate('Address book')}
- >
-
- Back
-
-
-
+
{/* Contact info */}
@@ -154,19 +145,6 @@ const styles = StyleSheet.create({
flex: 1,
paddingTop: 100
},
- topNav: {
- position: 'absolute',
- top: 75,
- left: 20,
- right: 20,
- flex: 1,
- flexDirection: 'row',
- justifyContent: 'flex-end',
- },
- topIconR: {
- paddingLeft: 20,
- paddingBottom: 20
- },
contactContainer: {
borderWidth: 1,
borderRadius: 25,
diff --git a/src/components/screens/Lightning/payInvoice.tsx b/src/components/screens/Lightning/payInvoice.tsx
index 0b0ba988..7ff4a38b 100644
--- a/src/components/screens/Lightning/payInvoice.tsx
+++ b/src/components/screens/Lightning/payInvoice.tsx
@@ -12,6 +12,7 @@ import type { TPayLNInvoicePageProps } from '@model/nav'
import TopNav from '@nav/TopNav'
import AddressbookModal from '@screens/Addressbook/modal'
import { CoinSelectionModal, CoinSelectionResume } from '@screens/Lightning/modal'
+import { isIOS } from '@src/consts'
import { useKeyboard } from '@src/context/Keyboard'
import { ThemeContext } from '@src/context/Theme'
import { sumProofsValue } from '@src/wallet/proofs'
@@ -21,7 +22,7 @@ import { cleanUpNumericStr, formatExpiry, formatInt, formatMintUrl, getInvoiceFr
import { checkFees, payLnInvoice } from '@wallet'
import * as Clipboard from 'expo-clipboard'
import { useCallback, useContext, useEffect, useState } from 'react'
-import { StyleSheet, Switch, Text, TextInput, TouchableOpacity, View } from 'react-native'
+import { KeyboardAvoidingView, StyleSheet, Switch, Text, TextInput, TouchableOpacity, View } from 'react-native'
// TODO adapt style
export default function PayInvoicePage({ navigation, route }: TPayLNInvoicePageProps) {
@@ -342,7 +343,7 @@ export default function PayInvoicePage({ navigation, route }: TPayLNInvoicePageP
}
{/* Bottom section */}
-
+
{/* Open LNURL address book */}
{invoiceAmount === 0 &&
}
-
+
{/* address book */}
{showAddressBook &&