Merge pull request #4525 from BlueWallet/ismodal

REF: Use builtin nav state for modal detection
This commit is contained in:
GLaDOS 2022-02-22 12:30:43 +00:00 committed by GitHub
commit 3d9701d786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -213,7 +213,6 @@ export const TransactionListItem = React.memo(({ item, itemPriceUnit = BitcoinUn
navigate('LNDViewInvoice', {
invoice: item,
walletID: lightningWallet[0].getID(),
isModal: false,
});
}
}

View file

@ -228,7 +228,6 @@ const LNDCreateInvoice = () => {
navigate('LNDViewInvoice', {
invoice: invoiceRequest,
walletID: wallet.current.getID(),
isModal: true,
});
} catch (Err) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
@ -531,7 +530,7 @@ const styles = StyleSheet.create({
});
export default LNDCreateInvoice;
LNDCreateInvoice.routeName = 'LNDCreateInvoice';
LNDCreateInvoice.navigationOptions = navigationStyle(
{
closeButton: true,

View file

@ -4,7 +4,7 @@ import Share from 'react-native-share';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { Icon } from 'react-native-elements';
import QRCodeComponent from '../../components/QRCodeComponent';
import { useNavigation, useRoute, useTheme } from '@react-navigation/native';
import { useNavigation, useNavigationState, useRoute, useTheme } from '@react-navigation/native';
import {
BlueLoading,
BlueText,
@ -19,9 +19,10 @@ import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { BitcoinUnit } from '../../models/bitcoinUnits';
import { SuccessView } from '../send/success';
import LNDCreateInvoice from './lndCreateInvoice';
const LNDViewInvoice = () => {
const { invoice, walletID, isModal } = useRoute().params;
const { invoice, walletID } = useRoute().params;
const { wallets, setSelectedWallet, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext);
const wallet = wallets.find(w => w.getID() === walletID);
const { colors, closeImage } = useTheme();
@ -31,6 +32,8 @@ const LNDViewInvoice = () => {
const [invoiceStatusChanged, setInvoiceStatusChanged] = useState(false);
const [qrCodeSize, setQRCodeSize] = useState(90);
const fetchInvoiceInterval = useRef();
const isModal = useNavigationState(state => state.routeNames[0] === LNDCreateInvoice.routeName);
const stylesHook = StyleSheet.create({
root: {
backgroundColor: colors.background,
@ -59,7 +62,7 @@ const LNDViewInvoice = () => {
useEffect(() => {
setOptions(
isModal === true
isModal
? {
headerStyle: {
borderBottomWidth: 0,