Upgrade to React navigation 7 WIP

This commit is contained in:
minibits-cash
2025-02-04 17:06:51 +01:00
parent 6fd930e851
commit 2c951f94d0
33 changed files with 534 additions and 724 deletions
+4 -4
View File
@@ -33,10 +33,10 @@
"@react-native-community/netinfo": "^11.4.1",
"@react-native-firebase/app": "^21.7.1",
"@react-native-firebase/messaging": "^21.7.1",
"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^6.4.1",
"@react-navigation/bottom-tabs": "^7.2.0",
"@react-navigation/native": "^7.0.14",
"@react-navigation/native-stack": "^7.2.0",
"@react-navigation/stack": "^7.1.1",
"@scure/bip39": "1.5.0",
"@sentry/react-native": "^6.5.0",
"date-fns": "^4.1.0",
+3 -5
View File
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react'
import React from 'react'
import * as Sentry from '@sentry/react-native'
import {
APP_ENV,
@@ -49,11 +49,9 @@ if (!__DEV__) {
})
}
interface AppProps {
appName: string
}
function App(props: AppProps) {
function App() {
const {userSettingsStore, relaysStore} = useStores()
const {rehydrated} = useInitialRootStore(async() => {
+2 -1
View File
@@ -448,7 +448,8 @@
"tabNavigator": {
"contactsLabel": "Contacts",
"settingsLabel": "Settings",
"walletLabel": "Wallet"
"walletLabel": "Wallet",
"transactionsLabel": "Transactions"
},
"tokenReceiveScreen": {
"onPasteEmptyClipboard": "First copy ecash token, then paste.",
+52 -95
View File
@@ -1,17 +1,9 @@
/**
* The app navigator (formerly "AppNavigator" and "MainNavigator") is used for the primary
* navigation flows of your app.
* Generally speaking, it will contain an auth flow (registration, login, forgot password)
* and a "main" flow which the user will use once logged in.
*/
import {
DefaultTheme,
NavigationContainer,
NavigatorScreenParams,
useTheme
import {
createStaticNavigation,
DefaultTheme,
StaticParamList,
} from "@react-navigation/native"
import { createNativeStackNavigator } from "@react-navigation/native-stack"
import { StackScreenProps } from "@react-navigation/stack"
import { observer } from "mobx-react-lite"
import React from "react"
import Config from "../config"
@@ -19,101 +11,66 @@ import {
WelcomeScreen,
SeedRecoveryScreen,
MintsScreen,
RecoveryOptionsScreen,
RecoverWalletAddressScreen,
ImportBackupScreen
RecoveryOptionsScreen,
ImportBackupScreen,
RecoverWalletAddressScreen
} from "../screens"
import { useStores } from "../models"
import { TabsNavigator, TabsParamList } from "./TabsNavigator"
import { rootStoreInstance } from "../models"
import { TabsNavigator } from "./TabsNavigator"
import { navigationRef, useBackButtonHandler } from "./navigationUtilities"
import { colors, useThemeColor } from "../theme"
import { useThemeColor } from "../theme"
/**
* This type allows TypeScript to know what routes are defined in this navigator
* as well as what properties (if any) they might take when navigating to them.
*
* If no params are allowed, pass through `undefined`. Generally speaking, we
* recommend using your MobX-State-Tree store(s) to keep application state
* rather than passing state through navigation params.
*
* For more information, see this documentation:
* https://reactnavigation.org/docs/params/
* https://reactnavigation.org/docs/typescript#type-checking-the-navigator
* https://reactnavigation.org/docs/typescript/#organizing-types
*/
export type AppStackParamList = {
Welcome: undefined
RecoveryOptions: {fromScreen?: string}
SeedRecovery: undefined
ImportBackup: undefined
RecoverWalletAddress: undefined
Mints: {}
Tabs: NavigatorScreenParams<TabsParamList>
}
/**
* This is a list of all the route names that will exit the app if the back button
j * This is a list of all the route names that will exit the app if the back button
* is pressed while in that screen. Only affects Android.
*/
const exitRoutes = Config.exitRoutes
export type AppStackScreenProps<T extends keyof AppStackParamList> = StackScreenProps<
AppStackParamList,
T
>
const { userSettingsStore } = rootStoreInstance
// Documentation: https://reactnavigation.org/docs/stack-navigator/
const Stack = createNativeStackNavigator<AppStackParamList>()
const AppStack = observer(function AppStack() {
const bgColor = useThemeColor('background')
const { userSettingsStore } = useStores()
return (
<Stack.Navigator
screenOptions={{
headerShown: false, // managed with hook + custom component
contentStyle: {backgroundColor: bgColor}
}}
>
{userSettingsStore.isOnboarded && (
<Stack.Screen name="Tabs" component={TabsNavigator} />
)}
<Stack.Screen name="Welcome" component={WelcomeScreen} />
<Stack.Screen name="RecoveryOptions" component={RecoveryOptionsScreen} />
<Stack.Screen name="SeedRecovery" component={SeedRecoveryScreen} />
<Stack.Screen name="ImportBackup" component={ImportBackupScreen} />
<Stack.Screen name="RecoverWalletAddress" component={RecoverWalletAddressScreen} />
<Stack.Screen name="Mints" component={MintsScreen} />
{!userSettingsStore.isOnboarded && (
<Stack.Screen name="Tabs" component={TabsNavigator} />
)}
</Stack.Navigator>
)
const RootStack = createNativeStackNavigator({
initialRouteName: userSettingsStore.isOnboarded ? 'Tabs' : 'Welcome',
screenOptions: {
headerShown: false,
//contentStyle: {backgroundColor: bgColor}
},
screens: {
Welcome: WelcomeScreen,
RecoveryOptions: RecoveryOptionsScreen,
SeedRecovery: SeedRecoveryScreen,
ImportBackup: ImportBackupScreen,
RecoverWalletAddress: RecoverWalletAddressScreen,
Mints: MintsScreen,
Tabs: TabsNavigator,
}
})
interface NavigationProps extends Partial<React.ComponentProps<typeof NavigationContainer>> {}
type RootStackParamList = StaticParamList<typeof RootStack>
declare global {
namespace ReactNavigation {
interface RootParamList extends RootStackParamList {}
}
}
export const AppNavigator = observer(function AppNavigator(props: NavigationProps) {
const Navigation = createStaticNavigation(RootStack)
useBackButtonHandler((routeName) => exitRoutes.includes(routeName))
const bgColor = useThemeColor('background')
export const AppNavigator = observer(function AppNavigator() {
return (
<NavigationContainer
theme={{
dark: true,
colors: {
...DefaultTheme.colors,
background: bgColor as string,
},
}}
ref={navigationRef}
{...props}
>
<AppStack />
</NavigationContainer>
)
useBackButtonHandler((routeName) => exitRoutes.includes(routeName))
const bgColor = useThemeColor('background')
return (
<Navigation
ref={navigationRef}
theme={{
dark: true,
colors: {
...DefaultTheme.colors,
background: bgColor as string,
},
fonts: DefaultTheme.fonts
}}
/>
)
})
+145 -295
View File
@@ -1,11 +1,9 @@
import { BottomTabScreenProps, createBottomTabNavigator } from "@react-navigation/bottom-tabs"
import { CompositeScreenProps, NavigatorScreenParams } from "@react-navigation/native"
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"
import { StaticParamList } from "@react-navigation/native"
import { createNativeStackNavigator } from "@react-navigation/native-stack"
import { StackScreenProps } from "@react-navigation/stack"
import React from "react"
import { TextStyle, View, ViewStyle } from "react-native"
import { useSafeAreaInsets } from "react-native-safe-area-context"
import { Icon, Text } from "../components"
import { TextStyle, ViewStyle } from "react-native"
import { Icon } from "../components"
import { translate } from "../i18n"
import {
WalletScreen,
@@ -35,298 +33,11 @@ import {
TransferScreen,
TopupScreen,
OwnKeysScreen,
ReceiveOption,
SendOption,
TokenReceiveScreen,
NwcScreen,
} from "../screens"
import { Contact } from "../models/Contact"
import { colors, useThemeColor, spacing, typography } from "../theme"
import { AppStackParamList, AppStackScreenProps } from "./AppNavigator"
import { PaymentRequest } from "../models/PaymentRequest"
import { LNURLPayParams, LNURLWithdrawParams } from "js-lnurl"
import { MintUnit } from "../services/wallet/currency"
export type TabsParamList = {
WalletNavigator: NavigatorScreenParams<WalletStackParamList>
TransactionsNavigator: NavigatorScreenParams<TransactionsStackParamList>
ContactsNavigator: NavigatorScreenParams<ContactsStackParamList>
SettingsNavigator: NavigatorScreenParams<SettingsStackParamList>
}
/**
* Helper for automatically generating navigation prop types for each route.
*
* More info: https://reactnavigation.org/docs/typescript/#organizing-types
*/
export type TabScreenProps<T extends keyof TabsParamList> = CompositeScreenProps<
BottomTabScreenProps<TabsParamList, T>,
AppStackScreenProps<keyof AppStackParamList>
>
const Tab = createBottomTabNavigator<TabsParamList>()
export function TabsNavigator() {
const { bottom } = useSafeAreaInsets()
const bgColor = useThemeColor('menu')
const textColor = useThemeColor('text')
const activeColor = useThemeColor('tint')
return (
<Tab.Navigator
initialRouteName="WalletNavigator"
screenOptions={{
headerShown: false, // managed with hook + custom component
tabBarHideOnKeyboard: true,
tabBarStyle: [$tabBar, { height: bottom + 70, backgroundColor: bgColor }],
tabBarActiveTintColor: activeColor as string,
tabBarInactiveTintColor: textColor as string,
tabBarLabelStyle: [$tabBarLabel, {color: textColor}],
tabBarItemStyle: $tabBarItem,
}}
>
<Tab.Screen
name="WalletNavigator"
component={WalletNavigator}
options={{
tabBarLabel: translate("tabNavigator.walletLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faWallet" color={focused ? activeColor : textColor} size={spacing.large} />
}}
/>
<Tab.Screen
name="TransactionsNavigator"
component={TransactionsNavigator}
options={{
tabBarLabel: "Transactions",
tabBarIcon: ({ focused }) => <Icon icon="faListUl" color={focused ? activeColor : textColor} size={spacing.large} />,
}}
/>
<Tab.Screen
name="ContactsNavigator"
component={ContactsNavigator}
options={{
tabBarLabel: translate("tabNavigator.contactsLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faAddressBook" color={focused ? activeColor : textColor} size={spacing.large} />,
}}
/>
<Tab.Screen
name="SettingsNavigator"
component={SettingsNavigator}
options={{
tabBarLabel: translate("tabNavigator.settingsLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faGears" color={focused ? activeColor : textColor} size={spacing.large} />,
}}
/>
</Tab.Navigator>
)
}
export type WalletStackParamList = {
Wallet: {scannedMintUrl? : string}
TokenReceive: {
unit: MintUnit
mintUrl?: string,
}
Receive: {unit: MintUnit, encodedToken? : string}
Send: {
unit: MintUnit,
paymentOption?: SendOption,
encodedCashuPaymentRequest?: string,
contact?: Contact,
mintUrl?: string,
}
Scan: {
unit: MintUnit
mintUrl?: string,
},
LightningPay: {
unit: MintUnit
mintUrl?: string,
}
PaymentRequests: undefined
Transfer: {
unit: MintUnit,
encodedInvoice?: string,
paymentRequest?: PaymentRequest,
lnurlParams?: LNURLPayParams & {address?: string},
fixedAmount?: number,
comment?: string
paymentOption?: SendOption,
mintUrl?: string,
isDonation?: boolean,
donationForName?: string
}
Topup: {
unit: MintUnit,
paymentOption?: ReceiveOption,
contact?: Contact,
lnurlParams?: LNURLWithdrawParams,
mintUrl?: string,
}
// TranDetail: {id: number}
ContactsNavigator: {screen: string, params: any, initial?: boolean}
SettingsNavigator: {screen: string, params: any, initial?: boolean}
TransactionsNavigator: {screen: string, params: any, initial?: boolean}
}
export type WalletStackScreenProps<T extends keyof WalletStackParamList> = StackScreenProps<
WalletStackParamList,
T
>
const WalletStack = createNativeStackNavigator<WalletStackParamList>()
const WalletNavigator = function WalletNavigator() {
return (
<WalletStack.Navigator
screenOptions={{
// presentation: '', // prevents white glitch on scren change in dark mode
headerShown: false,
}}
>
<WalletStack.Screen name="Wallet" component={WalletScreen} />
<WalletStack.Screen name="TokenReceive" component={TokenReceiveScreen} />
<WalletStack.Screen name="Receive" component={ReceiveScreen} />
<WalletStack.Screen name="Send" component={SendScreen} />
<WalletStack.Screen name="Scan" component={ScanScreen} />
<WalletStack.Screen name="LightningPay" component={LightningPayScreen} />
<WalletStack.Screen name="PaymentRequests" component={PaymentRequestsScreen} />
<WalletStack.Screen name="Transfer" component={TransferScreen} />
<WalletStack.Screen name="Topup" component={TopupScreen} />
</WalletStack.Navigator>
)
}
export type TransactionsStackParamList = {
TranDetail: {id: number}
TranHistory: undefined
WalletNavigator: {screen: string, params: any}
ContactsNavigator: {screen: string, params: any}
SettingsNavigator: {screen: string, params: any}
}
export type TransactionsStackScreenProps<T extends keyof TransactionsStackParamList> = StackScreenProps<
TransactionsStackParamList,
T
>
const TransactionsStack = createNativeStackNavigator<TransactionsStackParamList>()
const TransactionsNavigator = function TransactionsNavigator() {
return (
<TransactionsStack.Navigator
screenOptions={{
// presentation: 'transparentModal', // prevents white glitch on scren change in dark mode
headerShown: false,
}}
>
<TransactionsStack.Screen name="TranHistory" component={TranHistoryScreen} />
<TransactionsStack.Screen name="TranDetail" component={TranDetailScreen}/>
</TransactionsStack.Navigator>
)
}
export type ContactsStackParamList = {
Contacts: {paymentOption?: ReceiveOption | SendOption}
Profile: undefined
Picture: undefined
WalletName: undefined
RandomName: {navigation: any}
OwnName: {navigation: any}
ContactDetail: {contact: Contact}
OwnKeys: undefined
WalletNavigator: {screen: string, params: any}
SettingsNavigator: {screen: string}
}
export type ContactsStackScreenProps<T extends keyof ContactsStackParamList> = StackScreenProps<
ContactsStackParamList,
T
>
const ContactsStack = createNativeStackNavigator<ContactsStackParamList>()
const ContactsNavigator = function ContactsNavigator() {
return (
<ContactsStack.Navigator
screenOptions={{
// presentation: 'transparentModal', // prevents white glitch on scren change in dark mode
headerShown: false,
}}
>
<ContactsStack.Screen name="Contacts" component={ContactsScreen} />
<ContactsStack.Screen name="Profile" component={ProfileScreen} />
<ContactsStack.Screen name="Picture" component={PictureScreen} />
<ContactsStack.Screen name="ContactDetail" component={ContactDetailScreen} />
<ContactsStack.Screen name="OwnKeys" component={OwnKeysScreen} />
<ContactsStack.Screen name="WalletName" component={WalletNameScreen} />
</ContactsStack.Navigator>
)
}
export type SettingsStackParamList = {
Settings: undefined
Mints: {scannedMintUrl? : string}
MintInfo: {mintUrl : string}
Security: undefined
Privacy: undefined
Update: {
isUpdateAvailable : boolean,
isNativeUpdateAvailable: boolean,
updateDescription: string,
updateSize: string,
}
BackupOptions: undefined
Mnemonic: undefined
ExportBackup: undefined
Developer: undefined
Relays: undefined
WalletNavigator: {screen: string}
ContactsNavigator: {screen: string}
Nwc: undefined
}
export type SettingsStackScreenProps<T extends keyof SettingsStackParamList> = StackScreenProps<
SettingsStackParamList,
T
>
const SettingsStack = createNativeStackNavigator<SettingsStackParamList>()
const SettingsNavigator = function SettingsNavigator() {
return (
<SettingsStack.Navigator
screenOptions={{
// presentation: 'transparentModal', // prevents white glitch on scren change in dark mode
headerShown: false,
}}
>
<SettingsStack.Screen name="Settings" component={SettingsScreen} />
<SettingsStack.Screen name="Mints" component={MintsScreen} />
<SettingsStack.Screen name="MintInfo" component={MintInfoScreen} />
<SettingsStack.Screen name="Security" component={SecurityScreen} />
<SettingsStack.Screen name="Privacy" component={PrivacyScreen} />
<SettingsStack.Screen name="Update" component={UpdateScreen} />
<SettingsStack.Screen name="BackupOptions" component={BackupOptionsScreen} />
<SettingsStack.Screen name="Mnemonic" component={MnemonicScreen} />
<SettingsStack.Screen name="ExportBackup" component={ExportBackupScreen} />
<SettingsStack.Screen name="Developer" component={DeveloperScreen} />
<SettingsStack.Screen name="Relays" component={RelaysScreen} />
<SettingsStack.Screen name="Nwc" component={NwcScreen} />
</SettingsStack.Navigator>
)
}
import { spacing, typography } from "../theme"
import { moderateVerticalScale } from "@gocodingnow/rn-size-matters"
const $tabBar: ViewStyle = {
borderTopColor: 'transparent',
@@ -344,3 +55,142 @@ const $tabBarLabel: TextStyle = {
lineHeight: 16,
flex: 1,
}
const WalletStack = createNativeStackNavigator({
screenOptions: {
headerShown: false,
},
screens: {
Wallet: WalletScreen,
TokenReceive: TokenReceiveScreen,
Receive: ReceiveScreen,
Send: SendScreen,
Scan: ScanScreen,
LightningPay: LightningPayScreen,
PaymentRequests: PaymentRequestsScreen,
Transfer: TransferScreen,
Topup: TopupScreen,
}
})
type WalletStackParamList = StaticParamList<typeof WalletStack>
declare global {
namespace ReactNavigation {
interface RootParamList extends WalletStackParamList {}
}
}
const TransactionsStack = createNativeStackNavigator({
screenOptions: {
headerShown: false,
},
screens: {
TranHistory: TranHistoryScreen,
TranDetail: TranDetailScreen,
}
})
type TransactionsStackParamList = StaticParamList<typeof TransactionsStack>
declare global {
namespace ReactNavigation {
interface RootParamList extends TransactionsStackParamList {}
}
}
const ContactsStack = createNativeStackNavigator({
screenOptions: {
headerShown: false,
},
screens: {
Contacts: ContactsScreen,
Profile: ProfileScreen,
Picture: PictureScreen,
ContactDetail: ContactDetailScreen,
OwnKeys: OwnKeysScreen,
WalletName: WalletNameScreen,
}
})
type ContactsStackParamList = StaticParamList<typeof ContactsStack>
declare global {
namespace ReactNavigation {
interface RootParamList extends ContactsStackParamList {}
}
}
const SettingsStack = createNativeStackNavigator({
screenOptions: {
headerShown: false,
},
screens: {
Settings: SettingsScreen,
Mints: MintsScreen,
MintInfo: MintInfoScreen,
Security: SecurityScreen,
Privacy: PrivacyScreen,
Update: UpdateScreen,
BackupOptions: BackupOptionsScreen,
Mnemonic: MnemonicScreen,
ExportBackup: ExportBackupScreen,
Developer: DeveloperScreen,
Relays: RelaysScreen,
Nwc: NwcScreen,
}
})
type SettingsStackParamList = StaticParamList<typeof SettingsStack>
declare global {
namespace ReactNavigation {
interface RootParamList extends SettingsStackParamList {}
}
}
export const TabsNavigator = createBottomTabNavigator({
initialRouteName: "WalletNavigator",
backBehavior: 'firstRoute',
screenOptions: {
headerShown: false,
tabBarHideOnKeyboard: true,
tabBarStyle: [$tabBar, { height: moderateVerticalScale(70), /*backgroundColor: bgColor*/ }],
/*tabBarActiveTintColor: activeColor as string,
tabBarInactiveTintColor: textColor as string,
tabBarLabelStyle: [$tabBarLabel, {color: textColor}],*/
tabBarItemStyle: $tabBarItem,
animation: 'shift',
},
screens: {
WalletNavigator: {
screen: WalletStack,
options: {
tabBarLabel: translate("tabNavigator.walletLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faWallet" /*color={focused ? activeColor : textColor}*/ size={spacing.large} />
}
},
TransactionsNavigator: {
screen: TransactionsStack,
options: {
tabBarLabel: translate("tabNavigator.transactionsLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faListUl" /*color={focused ? activeColor : textColor}*/ size={spacing.large} />,
}
},
ContactsNavigator: {
screen: ContactsStack,
options: {
tabBarLabel: translate("tabNavigator.contactsLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faAddressBook" /*color={focused ? activeColor : textColor}*/ size={spacing.large} />,
}
},
SettingsNavigator: {
screen: SettingsStack,
options: {
tabBarLabel: translate("tabNavigator.settingsLabel"),
tabBarIcon: ({ focused }) => <Icon icon="faGears" /*color={focused ? activeColor : textColor}*/ size={spacing.large} />,
}
},
}
})
-1
View File
@@ -1,4 +1,3 @@
export * from "./AppNavigator"
export * from "./TabsNavigator"
export * from "./navigationUtilities"
// export other navigators from here
+6 -5
View File
@@ -28,7 +28,7 @@ export const navigationRef = createNavigationContainerRef()
* Gets the current screen from any navigation state.
*/
export function getActiveRouteName(state: NavigationState | PartialState<NavigationState>) {
const route = state.routes[state.index]
const route = state.routes[state.index!]
// Found the active route -- return the name
if (!route.state) return route.name
@@ -80,10 +80,11 @@ export function useBackButtonHandler(canExit: (routeName: string) => boolean) {
}
// Subscribe when we come to life
BackHandler.addEventListener("hardwareBackPress", onBackPress)
const backHandlerEventSubscription = BackHandler.addEventListener('hardwareBackPress', onBackPress)
// Unsubscribe when we're done
return () => BackHandler.removeEventListener("hardwareBackPress", onBackPress)
return () => backHandlerEventSubscription.remove()
}, [])
}
@@ -112,7 +113,7 @@ export function useNavigationPersistence(storage: any, persistenceKey: string) {
const routeNameRef = useRef<string | undefined>()
const onNavigationStateChange = (state) => {
const onNavigationStateChange = (state: NavigationState) => {
const previousRouteName = routeNameRef.current
const currentRouteName = getActiveRouteName(state)
@@ -154,7 +155,7 @@ export function useNavigationPersistence(storage: any, persistenceKey: string) {
*/
export function navigate(name: any, params?: any) {
if (navigationRef.isReady()) {
navigationRef.navigate(name as never, params as never)
navigationRef.navigate(name, params as never)
}
}
+7 -7
View File
@@ -2,7 +2,6 @@ import {observer} from 'mobx-react-lite'
import React, {FC, useEffect, useState} from 'react'
import {TextStyle, View, ViewStyle} from 'react-native'
import {colors, spacing, useThemeColor} from '../theme'
import {SettingsStackScreenProps} from '../navigation'
import {
ListItem,
Screen,
@@ -15,15 +14,16 @@ import {
Header,
} from '../components'
import AppError from '../utils/AppError'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
type Props = StaticScreenProps<{}>
export const BackupOptionsScreen = observer(function BackupOptionsScreen() {
const navigation = useNavigation()
export const BackupOptionsScreen: FC<SettingsStackScreenProps<'BackupOptions'>> = observer(
function BackupOptionsScreen(_props) {
const {navigation} = _props
const [isLoading, setIsLoading] = useState(false)
const [error, setError] = useState<AppError | undefined>()
const [info, setInfo] = useState('')
const [info, setInfo] = useState('')
const gotoExportBackup = function () {
navigation.navigate('ExportBackup')
+17 -26
View File
@@ -2,13 +2,12 @@ import {observer} from 'mobx-react-lite'
import React, {FC, useRef, useState} from 'react'
import {Image, Share, TextInput, TextStyle, View, ViewStyle} from 'react-native'
import { colors, spacing, useThemeColor} from '../theme'
import {ContactsStackScreenProps} from '../navigation'
import {Icon, Screen, Text, Card, BottomModal, Button, InfoModal, ErrorModal, ListItem} from '../components'
import {useHeader} from '../utils/useHeader'
import {useStores} from '../models'
import AppError, { Err } from '../utils/AppError'
import Clipboard from '@react-native-clipboard/clipboard'
import { ContactType } from '../models/Contact'
import { Contact, ContactType } from '../models/Contact'
import { NostrClient, log } from '../services'
import { getImageSource } from '../utils/utils'
import { verticalScale } from '@gocodingnow/rn-size-matters'
@@ -16,12 +15,14 @@ import { ReceiveOption } from './ReceiveScreen'
import { SendOption } from './SendScreen'
import { IncomingDataType, IncomingParser } from '../services/incomingParser'
import { translate } from '../i18n'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
type Props = StaticScreenProps<{
contact: Contact
}>
interface ContactDetailScreenProps extends ContactsStackScreenProps<'ContactDetail'> {}
export const ContactDetailScreen: FC<ContactDetailScreenProps> = observer(
function ContactScreen({route, navigation}) {
export const ContactDetailScreen = observer(function ContactScreen({ route }: Props) {
const navigation = useNavigation()
const {contact} = route.params
const {contactsStore, userSettingsStore} = useStores()
const noteInputRef = useRef<TextInput>(null)
@@ -52,26 +53,19 @@ export const ContactDetailScreen: FC<ContactDetailScreenProps> = observer(
const gotoTopup = () => {
navigation.navigate('WalletNavigator', {
screen: 'Topup',
params: {
paymentOption: ReceiveOption.SEND_PAYMENT_REQUEST,
contact,
unit: userSettingsStore.preferredUnit
},
navigation.navigate('Topup', {
paymentOption: ReceiveOption.SEND_PAYMENT_REQUEST,
contact,
unit: userSettingsStore.preferredUnit
})
}
const gotoSend = () => {
log.trace('[gotoSend] start')
navigation.navigate('WalletNavigator', {
screen: 'Send',
params: {
paymentOption: SendOption.SEND_TOKEN,
contact,
unit: userSettingsStore.preferredUnit
},
const gotoSend = () => {
navigation.navigate('Send', {
paymentOption: SendOption.SEND_TOKEN,
contact,
unit: userSettingsStore.preferredUnit
})
}
@@ -81,10 +75,7 @@ export const ContactDetailScreen: FC<ContactDetailScreenProps> = observer(
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL_ADDRESS,
encoded: contact.lud16
},
navigation,
userSettingsStore.preferredUnit
)
}, userSettingsStore.preferredUnit)
return
} catch (e: any) {
+13 -15
View File
@@ -20,15 +20,16 @@ import { MintBalance } from '../../models/Mint'
import Clipboard from '@react-native-clipboard/clipboard'
import { roundUp } from '../../utils/number'
import { LnurlClient } from '../../services/lnurlService'
import { useNavigation } from '@react-navigation/native'
const DEFAULT_DONATION_AMOUNT = 500
const DONATION_LNURL_ADDRESS = 'minibits@minibits.cash'
export const OwnName = observer(function (props: {navigation: any, pubkey: string}) {
// const navigation = useNavigation()
export const OwnName = observer(function (props: {pubkey: string}) {
const navigation = useNavigation()
const ownNameInputRef = useRef<TextInput>(null)
const {proofsStore, walletProfileStore} = useStores()
const {pubkey, navigation} = props
const {pubkey} = props
const [ownName, setOwnName] = useState<string>('')
const [info, setInfo] = useState('')
@@ -191,18 +192,15 @@ export const OwnName = observer(function (props: {navigation: any, pubkey: strin
const addressParamsResult = await LnurlClient.getLnurlAddressParams(DONATION_LNURL_ADDRESS) // throws
return navigation.navigate('WalletNavigator', {
screen: 'Transfer',
params: {
lnurlParams: addressParamsResult.lnurlParams,
paymentOption: SendOption.LNURL_PAY,
fixedAmount: donationAmount,
unit: 'sat',
comment,
mintUrl: selectedBalance.mintUrl,
isDonation: true,
donationForName: ownName
},
return navigation.navigate('Transfer', {
lnurlParams: addressParamsResult.lnurlParams,
paymentOption: SendOption.LNURL_PAY,
fixedAmount: donationAmount,
unit: 'sat',
comment,
mintUrl: selectedBalance.mintUrl,
isDonation: true,
donationForName: ownName
})
} else {
const invoice = await MinibitsClient.createDonation(
+13 -18
View File
@@ -5,7 +5,6 @@ import {verticalScale} from '@gocodingnow/rn-size-matters'
import {colors, spacing, useThemeColor} from '../../theme'
import {BottomModal, Button, Card, ErrorModal, Icon, InfoModal, ListItem, Loading, Screen, Text} from '../../components'
import {useStores} from '../../models'
import {ContactsStackParamList} from '../../navigation'
import { MinibitsClient, NostrClient, NostrProfile } from '../../services'
import AppError, { Err } from '../../utils/AppError'
import {MINIBITS_NIP05_DOMAIN} from '@env'
@@ -18,16 +17,16 @@ import { SendOption } from '../SendScreen'
import { infoMessage, warningMessage } from '../../utils/utils'
import { IncomingDataType, IncomingParser } from '../../services/incomingParser'
import { translate } from '../../i18n'
import { RouteProp } from '@react-navigation/native'
import { RouteProp, useNavigation } from '@react-navigation/native'
export const PrivateContacts = observer(function (props: {
navigation: StackNavigationProp<ContactsStackParamList, "Contacts", undefined>,
export const PrivateContacts = observer(function (props: {
paymentOption: ReceiveOption | SendOption | undefined},
) {
const {contactsStore, relaysStore, userSettingsStore} = useStores()
const {navigation} = props
const navigation = useNavigation()
const contactNameInputRef = useRef<TextInput>(null)
const [info, setInfo] = useState('')
@@ -171,12 +170,10 @@ export const PrivateContacts = observer(function (props: {
}
// contactsStore.selectContact(contact)
navigation.navigate('WalletNavigator', {
screen: 'Topup',
params: {
paymentOption,
contact
},
navigation.navigate('Topup', {
paymentOption,
contact,
unit: userSettingsStore.preferredUnit
})
setIsLoading(false)
@@ -191,12 +188,10 @@ export const PrivateContacts = observer(function (props: {
await NostrClient.verifyNip05(contact.nip05 as string, contact.pubkey) // throws
}
navigation.navigate('WalletNavigator', {
screen: 'Send',
params: {
paymentOption,
contact
},
navigation.navigate('Send', {
paymentOption,
contact,
unit: userSettingsStore.preferredUnit
})
setIsLoading(false)
@@ -213,7 +208,7 @@ export const PrivateContacts = observer(function (props: {
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL_ADDRESS,
encoded: contact.lud16
}, navigation, userSettingsStore.preferredUnit)
}, userSettingsStore.preferredUnit)
//reset
navigation.setParams({
+16 -21
View File
@@ -11,13 +11,12 @@ import {NostrClient, NostrEvent, NostrFilter, NostrProfile} from '../../services
import AppError, { Err } from '../../utils/AppError'
import { log } from '../../services/logService'
import { Contact, ContactType } from '../../models/Contact'
import { StackNavigationProp } from '@react-navigation/stack'
import { ContactsStackParamList } from '../../navigation'
import { SendOption } from '../SendScreen'
import { ReceiveOption } from '../ReceiveScreen'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
import { IncomingDataType, IncomingParser } from '../../services/incomingParser'
import { translate } from '../../i18n'
import { useNavigation } from '@react-navigation/native'
// const defaultPublicNpub = 'npub14n7frsyufzqsxlvkx8vje22cjah3pcwnnyqncxkuj2243jvt9kmqsdgs52'
@@ -29,12 +28,12 @@ if (Platform.OS === 'android' &&
UIManager.setLayoutAnimationEnabledExperimental(true)
}
export const PublicContacts = observer(function (props: {
navigation: StackNavigationProp<ContactsStackParamList, "Contacts", undefined>,
export const PublicContacts = observer(function (props: {
paymentOption: ReceiveOption | SendOption |undefined}
) {
const {contactsStore, relaysStore, userSettingsStore} = useStores()
const {navigation} = props
const navigation = useNavigation()
const npubInputRef = useRef<TextInput>(null)
const relayInputRef = useRef<TextInput>(null)
@@ -357,27 +356,22 @@ export const PublicContacts = observer(function (props: {
}*/
if(paymentOption === ReceiveOption.SEND_PAYMENT_REQUEST) {
navigation.navigate('WalletNavigator', {
screen: 'Topup',
params: {
paymentOption,
contact
},
navigation.navigate('Topup', {
paymentOption,
contact,
unit: userSettingsStore.preferredUnit
})
}
return
return
}
}
if(paymentOption && paymentOption === SendOption.SEND_TOKEN) {
navigation.navigate('WalletNavigator', {
screen: 'Send',
params: {
if(paymentOption && paymentOption === SendOption.SEND_TOKEN) {
navigation.navigate('Send', {
paymentOption,
contact
},
contact,
unit: userSettingsStore.preferredUnit
})
return
@@ -397,7 +391,8 @@ export const PublicContacts = observer(function (props: {
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL_ADDRESS,
encoded: contact.lud16
}, navigation, userSettingsStore.preferredUnit)
}, userSettingsStore.preferredUnit)
setIsLoading(false)
//reset
+4 -7
View File
@@ -23,14 +23,11 @@ import {$sizeStyles} from '../../components/Text'
import {getRandomUsername} from '../../utils/usernames'
import {scale} from '@gocodingnow/rn-size-matters'
import {translate} from '../../i18n'
import { useNavigation } from '@react-navigation/native'
export const RandomName = observer(function (props: {
navigation: any
pubkey: string
}) {
// const navigation = useNavigation()
const {userSettingsStore, walletProfileStore} = useStores()
const {navigation} = props
export const RandomName = observer(function (props: {pubkey: string}) {
const navigation = useNavigation()
const {walletProfileStore} = useStores()
const [randomNames, setRandomNames] = useState<string[]>([])
const [selectedName, setSelectedName] = useState<string>('')
+9 -6
View File
@@ -5,7 +5,6 @@ import { TabBar, TabView, Route } from 'react-native-tab-view'
import {colors, spacing, typography, useThemeColor} from '../theme'
import {Header, Icon, Screen} from '../components'
import {useStores} from '../models'
import {ContactsStackScreenProps} from '../navigation'
import { PrivateContacts } from './Contacts/PrivateContacts'
import { PublicContacts } from './Contacts/PublicContacts'
import { log } from '../services/logService'
@@ -13,11 +12,15 @@ import { getImageSource } from '../utils/utils'
import { ReceiveOption } from './ReceiveScreen'
import { SendOption } from './SendScreen'
import { verticalScale } from '@gocodingnow/rn-size-matters'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
type Props = StaticScreenProps<{
paymentOption?: ReceiveOption | SendOption
}>
interface ContactsScreenProps extends ContactsStackScreenProps<'Contacts'> {}
export const ContactsScreen: FC<ContactsScreenProps> = observer(function ContactsScreen({route, navigation}) {
export const ContactsScreen = observer(function ContactsScreen({ route }: Props) {
const navigation = useNavigation()
const {walletProfileStore} = useStores()
let paymentOption: ReceiveOption | SendOption | undefined
@@ -29,9 +32,9 @@ export const ContactsScreen: FC<ContactsScreenProps> = observer(function Contact
const renderScene = ({route}: {route: Route}) => {
switch (route.key) {
case 'first':
return <PrivateContacts navigation={navigation} paymentOption={paymentOption} />
return <PrivateContacts paymentOption={paymentOption} />
case 'second':
return <PublicContacts navigation={navigation} paymentOption={paymentOption} />
return <PublicContacts paymentOption={paymentOption} />
default:
return null
}
+19 -14
View File
@@ -5,7 +5,6 @@ import {
TextStyle,
TextInput,
} from 'react-native'
import {WalletStackScreenProps} from '../navigation'
import {colors, spacing, useThemeColor} from '../theme'
import {log} from '../services/logService'
import { IncomingDataType, IncomingParser } from '../services/incomingParser'
@@ -22,9 +21,15 @@ import { MintHeader } from './Mints/MintHeader'
import { verticalScale } from '@gocodingnow/rn-size-matters'
import useIsInternetReachable from '../utils/useIsInternetReachable'
import { translate } from '../i18n'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
export const LightningPayScreen: FC<WalletStackScreenProps<'LightningPay'>> = function LightningPayScreen(_props) {
const {navigation, route} = _props
type Props = StaticScreenProps<{
unit: MintUnit
mintUrl?: string,
}>
export const LightningPayScreen = function LightningPayScreen({ route }: Props) {
const navigation = useNavigation()
const lightningInputRef = useRef<TextInput>(null)
const {mintsStore} = useStores()
const isInternetReachable = useIsInternetReachable()
@@ -93,14 +98,16 @@ export const LightningPayScreen: FC<WalletStackScreenProps<'LightningPay'>> = fu
const gotoScan = async function () {
lightningInputRef.current?.blur()
navigation.navigate('Scan', {mintUrl: mint?.mintUrl, unit})
navigation.navigate('Scan', {
mintUrl: mint?.mintUrl, unit
})
}
const gotoContacts = function () {
navigation.navigate('ContactsNavigator', {
screen: 'Contacts',
params: {paymentOption: SendOption.LNURL_ADDRESS}})
navigation.navigate('Contacts', {
paymentOption: SendOption.LNURL_ADDRESS
})
}
@@ -116,15 +123,15 @@ export const LightningPayScreen: FC<WalletStackScreenProps<'LightningPay'>> = fu
log.trace('[onConfirm]', {mintUrl: mint?.mintUrl, unit, resultType: result.type})
if(result.type === IncomingDataType.INVOICE) {
return IncomingParser.navigateWithIncomingData(result, navigation, unit, mint && mint.mintUrl)
return IncomingParser.navigateWithIncomingData(result, unit, mint && mint.mintUrl)
}
if(result.type === IncomingDataType.LNURL) {
await IncomingParser.navigateWithIncomingData(result, navigation, unit, mint && mint.mintUrl)
await IncomingParser.navigateWithIncomingData(result, unit, mint && mint.mintUrl)
}
if(result.type === IncomingDataType.LNURL_ADDRESS) {
await IncomingParser.navigateWithIncomingData(result, navigation, unit, mint && mint.mintUrl)
await IncomingParser.navigateWithIncomingData(result, unit, mint && mint.mintUrl)
}
} catch (e: any) {
@@ -153,15 +160,13 @@ export const LightningPayScreen: FC<WalletStackScreenProps<'LightningPay'>> = fu
const inputBg = useThemeColor('background')
const contactIcon = useThemeColor('headerTitle')
const headerBg = useThemeColor('header')
const headerTitle = useThemeColor('headerTitle')
const headerTitle = useThemeColor('headerTitle')
return (
<Screen preset="fixed" contentContainerStyle={$screen}>
<MintHeader
mint={mint}
unit={unit!}
navigation={navigation}
unit={unit}
/>
<View style={[$headerContainer, {backgroundColor: headerBg}]}>
<Text
+11 -5
View File
@@ -1,5 +1,5 @@
import React, { FC, useEffect, useMemo, useState } from 'react'
import { GetInfoResponse, SwapMethod } from '@cashu/cashu-ts'
import React, { useEffect, useMemo, useState } from 'react'
import { GetInfoResponse as CashuGetInfoResponse, SwapMethod } from '@cashu/cashu-ts'
import { isObj } from '@cashu/cashu-ts/src/utils'
import Clipboard from '@react-native-clipboard/clipboard'
import { observer } from 'mobx-react-lite'
@@ -25,7 +25,6 @@ import { CollapsibleText } from '../components/CollapsibleText'
import { translate } from '../i18n'
import { useStores } from '../models'
import { Mint, MintStatus } from '../models/Mint'
import { SettingsStackScreenProps } from '../navigation'
import { log } from '../services'
import { colors, spacing, typography, useThemeColor } from '../theme'
import useColorScheme from '../theme/useThemeColor'
@@ -35,6 +34,7 @@ import { CurrencySign } from './Wallet/CurrencySign'
import { SvgXml } from 'react-native-svg'
import { CurrencyCode, formatCurrency } from '../services/wallet/currency'
import { QRShareModal } from '../components/QRShareModal'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
@@ -51,6 +51,8 @@ interface MethodLimit {
max?: number,
}
type GetInfoResponse = CashuGetInfoResponse & {icon_url: string}
const iconMap: Partial<Record<keyof GetInfoResponse, IconTypes>> = {
'name': 'faTag',
'pubkey': 'faKey',
@@ -67,8 +69,12 @@ const contactIconMap: Record<string, IconTypes> = {
'nostr': 'faCircleNodes'
}
export const MintInfoScreen: FC<SettingsStackScreenProps<'MintInfo'>> = observer(function MintInfoScreen(_props) {
const { navigation, route } = _props
type Props = StaticScreenProps<{
mintUrl : string
}>
export const MintInfoScreen = observer(function MintInfoScreen({ route }: Props) {
const navigation = useNavigation()
useHeader({
leftIcon: 'faArrowLeft',
onLeftPress: () => {
+5 -5
View File
@@ -8,15 +8,15 @@ import { CurrencyAmount } from "../Wallet/CurrencyAmount"
import { observer } from "mobx-react-lite"
import { StackNavigationProp } from "@react-navigation/stack"
import { moderateScale } from "@gocodingnow/rn-size-matters"
import { useNavigation } from "@react-navigation/native"
export const MintHeader = observer(function(props: {
unit: MintUnit,
mint?: Mint,
navigation: StackNavigationProp<any>
}
mint?: Mint
}
) {
const {mint, unit, navigation} = props
const navigation = useNavigation()
const {mint, unit} = props
const getActiveUnitColor = () => {
/* switch (props.unit) {
@@ -15,7 +15,6 @@ import {
InfoModal,
Loading,
} from '../../components'
import {WalletStackParamList} from '../../navigation'
import {useStores} from '../../models'
import AppError from '../../utils/AppError'
import { PaymentRequest } from '../../models/PaymentRequest'
@@ -23,10 +22,7 @@ import { StackNavigationProp } from '@react-navigation/stack'
import { PaymentRequestListItem } from './PaymentRequestListItem'
export const IncomingRequests = observer(function (props: {
navigation: StackNavigationProp<WalletStackParamList, "PaymentRequests", undefined>,
}) {
const {navigation} = props
export const IncomingRequests = observer(function IncomingRequests() {
const {paymentRequestsStore} = useStores()
const [info, setInfo] = useState('')
@@ -46,11 +42,7 @@ export const IncomingRequests = observer(function (props: {
setError(e)
}
const headerBg = useThemeColor('header')
const iconColor = useThemeColor('textDim')
const hintColor = useThemeColor('textDim')
const activeIconColor = useThemeColor('button')
const hintColor = useThemeColor('textDim')
return (
<Screen contentContainerStyle={$screen}>
@@ -62,8 +54,7 @@ export const IncomingRequests = observer(function (props: {
return(
<PaymentRequestListItem
pr={item}
isFirst={index === 0}
navigation={navigation}
isFirst={index === 0}
/>
)
}}
@@ -22,19 +22,20 @@ import {getImageSource} from '../../utils/utils'
import {SendOption} from '../SendScreen'
import {translate} from '../../i18n'
import { CurrencyAmount } from '../Wallet/CurrencyAmount'
import { useNavigation } from '@react-navigation/native'
import { MintUnit } from '../../services/wallet/currency'
export interface PaymentRequestListProps {
pr: PaymentRequest
isFirst: boolean
navigation: any
isFirst: boolean
onShowQRModal?: any
}
export const PaymentRequestListItem = observer(function (
export const PaymentRequestListItem = observer(function PaymentRequestListItem(
props: PaymentRequestListProps,
) {
const {pr, isFirst, navigation, onShowQRModal} = props
const hintColor = useThemeColor('textDim')
const navigation = useNavigation()
const {pr, onShowQRModal} = props
const secToExpiry = differenceInSeconds(pr.expiresAt as Date, new Date())
const expiryBg =
secToExpiry < 0
@@ -44,24 +45,12 @@ export const PaymentRequestListItem = observer(function (
: colors.palette.success300
const separatorColor = useThemeColor('separator')
const onGotoContactDetail = function () {
log.trace(pr)
navigation.navigate('ContactsNavigator', {
screen: 'ContactDetail',
params: {
contact:
pr.type === PaymentRequestType.INCOMING
? pr.contactFrom
: pr.contactTo,
},
})
}
const onPressPaymentRequest = function () {
if (pr.type === PaymentRequestType.INCOMING) {
navigation.navigate('Transfer', {
paymentRequest: pr,
paymentOption: SendOption.PAY_PAYMENT_REQUEST,
unit: pr.invoicedUnit as MintUnit
})
} else {
if (onShowQRModal) {
+8 -6
View File
@@ -3,10 +3,8 @@ import React, {FC, useState, useEffect} from 'react'
import {TextStyle, View, ViewStyle} from 'react-native'
import notifee, { AndroidImportance } from '@notifee/react-native'
import {spacing, useThemeColor, colors} from '../theme'
import {AppStackScreenProps} from '../navigation'
import {
Button,
Icon,
Button,
Card,
Screen,
ListItem,
@@ -22,12 +20,16 @@ import { useStores } from '../models'
import { SYNC_STATE_WITH_ALL_MINTS_TASK, SyncStateTaskResult } from '../services/walletService'
import EventEmitter from '../utils/eventEmitter'
import { translate } from '../i18n'
import { NotificationService, TASK_QUEUE_CHANNEL_ID, TASK_QUEUE_CHANNEL_NAME } from '../services/notificationService'
import { TASK_QUEUE_CHANNEL_ID, TASK_QUEUE_CHANNEL_NAME } from '../services/notificationService'
import { minibitsPngIcon } from '../components/MinibitsIcon'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
type Props = StaticScreenProps<{
fromScreen?: string
}>
export const RecoveryOptionsScreen: FC<AppStackScreenProps<'RecoveryOptions'>> = observer(
function RecoveryOptionsScreen({route, navigation}) {
export const RecoveryOptionsScreen = observer(function RecoveryOptionsScreen({ route }: Props) {
const navigation = useNavigation()
useHeader({
leftIcon: 'faArrowLeft',
onLeftPress: () => navigation.goBack(),
+16 -12
View File
@@ -7,7 +7,6 @@ import {
View,
TextStyle,
} from 'react-native'
import {WalletStackScreenProps} from '../navigation'
import {Camera, CameraType} from 'react-native-camera-kit'
import { URDecoder } from '@gandlaf21/bc-ur'
import {spacing, typography, useThemeColor} from '../theme'
@@ -23,15 +22,20 @@ import { translate } from '../i18n'
import { MintUnit } from '../services/wallet/currency'
import { Mint } from '../models/Mint'
import { CashuUtils } from '../services/cashu/cashuUtils'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
const hasAndroidCameraPermission = async () => {
const cameraPermission = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA)
return cameraPermission !== PermissionsAndroid.RESULTS.BLOCKED && cameraPermission !== PermissionsAndroid.RESULTS.DENIED
return cameraPermission !== PermissionsAndroid.RESULTS.DENIED
}
type Props = StaticScreenProps<{
unit: MintUnit
mintUrl?: string,
}>
export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScreen(_props) {
const {navigation, route} = _props
export const ScanScreen = function ScanScreen({ route }: Props) {
const navigation = useNavigation()
const {mintsStore} = useStores()
const [shouldLoad, setShouldLoad] = useState<boolean>(false)
@@ -50,7 +54,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
const routes = navigation.getState()?.routes
let prevRoute: string = ''
if(routes.length >= 2) {
if(routes && routes.length >= 2) {
prevRoute = routes[routes.length - 2].name
log.trace('prevRouteName', prevRoute)
setPrevRouteName(prevRoute)
@@ -130,7 +134,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
log.trace('TokenReceive')
try {
const tokenResult = IncomingParser.findAndExtract(incoming, IncomingDataType.CASHU)
return IncomingParser.navigateWithIncomingData(tokenResult, navigation, unit, mint && mint.mintUrl)
return IncomingParser.navigateWithIncomingData(tokenResult, unit, mint && mint.mintUrl)
} catch (e: any) {
const maybeLnurl = LnurlUtils.findEncodedLnurl(incoming)
@@ -144,7 +148,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL,
encoded: encodedLnurl
}, navigation, unit, mint && mint.mintUrl)
}, unit, mint && mint.mintUrl)
}
return
} catch (e2: any) {
@@ -161,7 +165,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
case 'LightningPay':
try {
const invoiceResult = IncomingParser.findAndExtract(incoming, IncomingDataType.INVOICE)
return IncomingParser.navigateWithIncomingData(invoiceResult, navigation, unit, mint && mint.mintUrl)
return IncomingParser.navigateWithIncomingData(invoiceResult, unit, mint && mint.mintUrl)
} catch (e: any) {
const maybeLnurlAddress = LnurlUtils.findEncodedLnurlAddress(incoming)
@@ -175,7 +179,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL_ADDRESS,
encoded: validAddress
}, navigation, unit, mint && mint.mintUrl)
}, unit, mint && mint.mintUrl)
}
return
} catch (e3: any) {
@@ -195,7 +199,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.LNURL,
encoded: encodedLnurl
}, navigation, unit, mint && mint.mintUrl)
}, unit, mint && mint.mintUrl)
}
return
} catch (e2: any) {
@@ -215,7 +219,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
await IncomingParser.navigateWithIncomingData({
type: IncomingDataType.CASHU_PAYMENT_REQUEST,
encoded: encodedPr
}, navigation, unit, mint && mint.mintUrl)
}, unit, mint && mint.mintUrl)
}
return
} catch (e3: any) {
@@ -232,7 +236,7 @@ export const ScanScreen: FC<WalletStackScreenProps<'Scan'>> = function ScanScree
try {
// generic scan button on wallet screen
const incomingData = IncomingParser.findAndExtract(incoming)
return IncomingParser.navigateWithIncomingData(incomingData, navigation, unit, mint && mint.mintUrl)
return IncomingParser.navigateWithIncomingData(incomingData, unit, mint && mint.mintUrl)
} catch (e: any) {
e.name = Err.VALIDATION_ERROR
e.params = {caller: 'onIncomingData', clipboard: incoming.slice(0, 100)}
+16 -12
View File
@@ -8,7 +8,7 @@ import React, {
useRef,
useMemo,
} from 'react'
import {useFocusEffect} from '@react-navigation/native'
import {StaticScreenProps, useFocusEffect, useNavigation} from '@react-navigation/native'
import {
UIManager,
Platform,
@@ -23,7 +23,6 @@ import {
Image,
} from 'react-native'
import {spacing, typography, useThemeColor, colors} from '../theme'
import {WalletStackScreenProps} from '../navigation'
import {
Button,
Icon,
@@ -77,9 +76,17 @@ if (Platform.OS === 'android' &&
UIManager.setLayoutAnimationEnabledExperimental(true)
}
export const SendScreen: FC<WalletStackScreenProps<'Send'>> = observer(
function SendScreen({route, navigation}) {
type Props = StaticScreenProps<{
unit: MintUnit,
paymentOption?: SendOption,
encodedCashuPaymentRequest?: string,
contact?: Contact,
mintUrl?: string,
}>
export const SendScreen = observer(
function SendScreen({ route }: Props) {
const navigation = useNavigation()
const isInternetReachable = useIsInternetReachable()
const {
@@ -783,11 +790,9 @@ export const SendScreen: FC<WalletStackScreenProps<'Send'>> = observer(
const gotoContacts = function () {
navigation.navigate('ContactsNavigator', {
screen: 'Contacts',
params: {
paymentOption: SendOption.SEND_TOKEN
}})
navigation.navigate('Contacts', {
paymentOption: SendOption.SEND_TOKEN
})
}
@@ -805,7 +810,7 @@ export const SendScreen: FC<WalletStackScreenProps<'Send'>> = observer(
setIsProofSelectorModalVisible(false)
setIsLoading(false)
navigation.popToTop()
navigation.navigate('Tabs')
}
@@ -825,8 +830,7 @@ export const SendScreen: FC<WalletStackScreenProps<'Send'>> = observer(
<Screen preset="fixed" contentContainerStyle={$screen}>
<MintHeader
mint={mintBalanceToSendFrom ? mintsStore.findByUrl(mintBalanceToSendFrom?.mintUrl) : undefined}
unit={unitRef.current}
navigation={navigation}
unit={unitRef.current}
/>
<View style={[$headerContainer, {backgroundColor: headerBg}]}>
<View style={$amountContainer}>
+9 -6
View File
@@ -5,7 +5,6 @@ import {
TextStyle,
TextInput,
} from 'react-native'
import {WalletStackScreenProps} from '../navigation'
import {colors, spacing, useThemeColor} from '../theme'
import {log} from '../services/logService'
import { IncomingDataType, IncomingParser } from '../services/incomingParser'
@@ -20,10 +19,15 @@ import { MintHeader } from './Mints/MintHeader'
import { verticalScale } from '@gocodingnow/rn-size-matters'
import { translate } from '../i18n'
import { MintUnit } from '../services/wallet/currency'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
type Props = StaticScreenProps<{
unit: MintUnit
mintUrl?: string
}>
export const TokenReceiveScreen: FC<WalletStackScreenProps<'TokenReceive'>> = function TokenReceiveScreen(_props) {
const {navigation, route} = _props
export const TokenReceiveScreen = function TokenReceiveScreen({ route }: Props) {
const navigation = useNavigation()
const tokenInputRef = useRef<TextInput>(null)
const {mintsStore} = useStores()
@@ -105,7 +109,7 @@ export const TokenReceiveScreen: FC<WalletStackScreenProps<'TokenReceive'>> = fu
try {
const tokenResult = IncomingParser.findAndExtract(encodedToken, IncomingDataType.CASHU)
return IncomingParser.navigateWithIncomingData(tokenResult, navigation, unit, mint && mint.mintUrl)
return IncomingParser.navigateWithIncomingData(tokenResult, unit, mint && mint.mintUrl)
} catch (e: any) {
handleError(e)
@@ -137,8 +141,7 @@ export const TokenReceiveScreen: FC<WalletStackScreenProps<'TokenReceive'>> = fu
<Screen preset="fixed" contentContainerStyle={$screen}>
<MintHeader
mint={mint}
unit={unit!}
navigation={navigation}
unit={unit!}
/>
<View style={[$headerContainer, {backgroundColor: headerBg}]}>
<Text
+16 -12
View File
@@ -13,7 +13,6 @@ import {
ImageStyle,
} from 'react-native'
import {spacing, useThemeColor, colors, typography} from '../theme'
import {WalletStackScreenProps} from '../navigation'
import {
Button,
Icon,
@@ -41,7 +40,7 @@ import AppError, {Err} from '../utils/AppError'
import {Mint, MintBalance} from '../models/Mint'
import EventEmitter from '../utils/eventEmitter'
import {ResultModalInfo} from './Wallet/ResultModalInfo'
import {useFocusEffect} from '@react-navigation/native'
import {StaticScreenProps, useFocusEffect, useNavigation} from '@react-navigation/native'
import {Contact, ContactType} from '../models/Contact'
import {getImageSource, infoMessage} from '../utils/utils'
import {ReceiveOption} from './ReceiveScreen'
@@ -74,8 +73,17 @@ if (
UIManager.setLayoutAnimationEnabledExperimental(true)
}
export const TopupScreen: FC<WalletStackScreenProps<'Topup'>> = observer(
function TopupScreen({navigation, route}) {
type Props = StaticScreenProps<{
unit: MintUnit,
paymentOption?: ReceiveOption,
contact?: Contact,
lnurlParams?: LNURLWithdrawParams,
mintUrl?: string,
}>
export const TopupScreen = observer(
function TopupScreen({ route }: Props) {
const navigation = useNavigation()
const isInternetReachable = useIsInternetReachable()
const {
@@ -544,11 +552,8 @@ export const TopupScreen: FC<WalletStackScreenProps<'Topup'>> = observer(
}
const gotoContacts = function () {
navigation.navigate('ContactsNavigator', {
screen: 'Contacts',
params: {
paymentOption: ReceiveOption.SEND_PAYMENT_REQUEST,
},
navigation.navigate('Contacts', {
paymentOption: ReceiveOption.SEND_PAYMENT_REQUEST
})
}
@@ -615,7 +620,7 @@ export const TopupScreen: FC<WalletStackScreenProps<'Topup'>> = observer(
setIsWithdrawRequestSending(false)
setPaymentOption(ReceiveOption.SHOW_INVOICE)
navigation.popToTop()
navigation.navigate('Tabs')
}
const handleError = function (e: AppError): void {
@@ -650,8 +655,7 @@ export const TopupScreen: FC<WalletStackScreenProps<'Topup'>> = observer(
? mintsStore.findByUrl(mintBalanceToTopup?.mintUrl)
: undefined
}
unit={unit}
navigation={navigation}
unit={unit}
/>
<View style={[$headerContainer, {backgroundColor: headerBg}]}>
<View style={$amountContainer}>
+8 -5
View File
@@ -16,7 +16,6 @@ import {
import Clipboard from '@react-native-clipboard/clipboard'
import JSONTree from 'react-native-json-tree'
import {colors, spacing, typography, useThemeColor} from '../theme'
import {TransactionsStackScreenProps} from '../navigation'
import EventEmitter from '../utils/eventEmitter'
import {
Button,
@@ -53,7 +52,7 @@ import { CurrencySign } from './Wallet/CurrencySign'
import { MintUnit, formatCurrency, getCurrency } from "../services/wallet/currency"
import { PaymentRequest } from '../models/PaymentRequest'
import { pollerExists } from '../utils/poller'
import { useFocusEffect } from '@react-navigation/native'
import { StaticScreenProps, useFocusEffect, useNavigation } from '@react-navigation/native'
import { QRCodeBlock } from './Wallet/QRCode'
import { MintListItem } from './Mints/MintListItem'
import { Token, getDecodedToken } from '@cashu/cashu-ts'
@@ -71,9 +70,13 @@ type ProofsByStatus = {
isReceived: Proof[]
}
export const TranDetailScreen: FC<TransactionsStackScreenProps<'TranDetail'>> =
observer(function TranDetailScreen(_props) {
const {navigation, route} = _props
type Props = StaticScreenProps<{
id: number
}>
export const TranDetailScreen =
observer(function TranDetailScreen({ route }: Props) {
const navigation = useNavigation()
const {transactionsStore, userSettingsStore, mintsStore} = useStores()
const noteInputRef = useRef<TextInput>(null)
+3 -4
View File
@@ -24,16 +24,15 @@ import {
Loading,
BottomModal,
} from '../components'
import {TransactionsStackScreenProps} from '../navigation'
import {useHeader} from '../utils/useHeader'
import {useStores} from '../models'
import {Database, log} from '../services'
import AppError from '../utils/AppError'
import {TransactionListItem} from './Transactions/TransactionListItem'
import { Transaction, TransactionStatus } from '../models/Transaction'
import { height } from '@fortawesome/free-solid-svg-icons/faWallet'
import { translate } from '../i18n'
import { maxTransactionsInHistory } from '../models/TransactionsStore'
import { useNavigation } from '@react-navigation/native'
if (Platform.OS === 'android' &&
UIManager.setLayoutAnimationEnabledExperimental) {
@@ -42,8 +41,8 @@ if (Platform.OS === 'android' &&
// Number of transactions held in TransactionsStore model
const limit = maxTransactionsInHistory
export const TranHistoryScreen: FC<TransactionsStackScreenProps<'TranHistory'>> = observer(function TranHistoryScreen(_props) {
const {navigation} = _props
export const TranHistoryScreen = observer(function TranHistoryScreen() {
const navigation = useNavigation()
const {transactionsStore, mintsStore} = useStores()
useHeader({
leftIcon: 'faArrowLeft',
+22 -13
View File
@@ -1,6 +1,6 @@
import {observer} from 'mobx-react-lite'
import React, {FC, useEffect, useState, useCallback, useRef} from 'react'
import {useFocusEffect} from '@react-navigation/native'
import {StaticScreenProps, useFocusEffect, useNavigation} from '@react-navigation/native'
import {
UIManager,
Platform,
@@ -12,7 +12,6 @@ import {
Keyboard,
} from 'react-native'
import {spacing, useThemeColor, colors, typography} from '../theme'
import {WalletStackScreenProps} from '../navigation'
import {
Button,
Icon,
@@ -34,7 +33,7 @@ import AppError, {Err} from '../utils/AppError'
import {MintBalance} from '../models/Mint'
import {ResultModalInfo} from './Wallet/ResultModalInfo'
import {addSeconds} from 'date-fns'
import { PaymentRequestStatus } from '../models/PaymentRequest'
import { PaymentRequest, PaymentRequestStatus } from '../models/PaymentRequest'
import { DecodedLightningInvoice, LightningUtils } from '../services/lightning/lightningUtils'
import { SendOption } from './SendScreen'
import { round, roundDown, roundUp, toNumber } from '../utils/number'
@@ -51,6 +50,7 @@ import useIsInternetReachable from '../utils/useIsInternetReachable'
import { translate } from '../i18n'
import { MemoInputCard } from '../components/MemoInputCard'
import { TRANSFER_TASK } from '../services/wallet/transferTask'
import { LNURLWithdrawParams } from 'js-lnurl'
if (
@@ -60,9 +60,22 @@ if (
UIManager.setLayoutAnimationEnabledExperimental(true)
}
export const TransferScreen: FC<WalletStackScreenProps<'Transfer'>> = observer(
function TransferScreen({route, navigation}) {
type Props = StaticScreenProps<{
unit: MintUnit,
encodedInvoice?: string,
paymentRequest?: PaymentRequest,
lnurlParams?: LNURLPayParams & {address?: string},
fixedAmount?: number,
comment?: string
paymentOption?: SendOption,
mintUrl?: string,
isDonation?: boolean,
donationForName?: string
}>
export const TransferScreen = observer(
function TransferScreen({ route }: Props) {
const navigation = useNavigation()
const amountInputRef = useRef<TextInput>(null)
const lnurlCommentInputRef = useRef<TextInput>(null)
@@ -615,7 +628,7 @@ const onEncodedInvoice = async function (encoded: string, paymentRequestDesc: st
} catch (e: any) {
resetState()
handleError(e)
navigation.popToTop()
navigation.navigate('Tabs')
}
}
@@ -686,7 +699,7 @@ const retryAfterSpentCleaned = async function () {
const onClose = function () {
resetState()
navigation.popToTop()
navigation.navigate('Tabs')
}
@@ -708,8 +721,7 @@ const amountInputColor = useThemeColor('amountInput')
? mintsStore.findByUrl(mintBalanceToTransferFrom?.mintUrl)
: undefined
}
unit={unit}
navigation={navigation}
unit={unit}
/>
<View style={[$headerContainer, {backgroundColor: headerBg}]}>
<View style={$amountContainer}>
@@ -891,10 +903,7 @@ const amountInputColor = useThemeColor('amountInput')
tx={'common.close'}
onPress={() => {
if (isInvoiceDonation) {
navigation.navigate('ContactsNavigator', {
screen: 'Contacts',
params: {},
})
navigation.navigate('Contacts', {})
} else {
navigation.navigate('Wallet', {})
}
+10 -7
View File
@@ -8,7 +8,6 @@ import {
} from '@env'
import codePush from "react-native-code-push"
import {colors, spacing, useThemeColor} from '../theme'
import {SettingsStackScreenProps} from '../navigation' // @demo remove-current-line
import {
Icon,
ListItem,
@@ -25,23 +24,27 @@ import {useHeader} from '../utils/useHeader'
import AppError from '../utils/AppError'
import { log } from '../services'
import {Env} from '../utils/envtypes'
import { CommonActions, StackActions } from '@react-navigation/native'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
import { translate } from '../i18n'
const deploymentKey = APP_ENV === Env.PROD ? CODEPUSH_PRODUCTION_DEPLOYMENT_KEY : CODEPUSH_STAGING_DEPLOYMENT_KEY
type Props = StaticScreenProps<{
isNativeUpdateAvailable: boolean,
isUpdateAvailable: boolean,
updateDescription: string,
updateSize: string
}>
export const UpdateScreen: FC<SettingsStackScreenProps<'Update'>> = observer(function UpdateScreen(_props) {
const {navigation, route} = _props
export const UpdateScreen = observer(function UpdateScreen({ route }: Props) {
const navigation = useNavigation()
const {
isUpdateAvailable,
isNativeUpdateAvailable,
updateDescription,
updateSize
} = route.params
// const isUpdateAvailable = true
} = route.params
useHeader({
leftIcon: 'faArrowLeft',
+12 -6
View File
@@ -8,11 +8,17 @@ import {RandomName} from './Contacts/RandomName'
import {OwnName} from './Contacts/OwnName'
import {useStores} from '../models'
import {useHeader} from '../utils/useHeader'
import {ContactsStackScreenProps} from '../navigation'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
interface WalletNameScreenProps extends ContactsStackScreenProps<'WalletName'>{}
type Props = StaticScreenProps<{
isNativeUpdateAvailable: boolean,
isUpdateAvailable: boolean,
updateDescription: string,
updateSize: string
}>
export const WalletNameScreen: FC<WalletNameScreenProps> = observer(function WalletNameScreen({route, navigation}) {
export const WalletNameScreen = observer(function WalletNameScreen({ route }: Props) {
const navigation = useNavigation()
useHeader({
leftIcon: 'faArrowLeft',
onLeftPress: () => navigation.goBack(),
@@ -24,9 +30,9 @@ export const WalletNameScreen: FC<WalletNameScreenProps> = observer(function Wal
const renderScene = ({route}: {route: Route}) => {
switch (route.key) {
case 'first':
return <OwnName navigation={navigation} pubkey={pubkey as string} />
return <OwnName pubkey={pubkey as string} />
case 'second':
return <RandomName navigation={navigation} pubkey={pubkey as string} />
return <RandomName pubkey={pubkey as string} />
default:
return null
}
@@ -61,7 +67,7 @@ export const WalletNameScreen: FC<WalletNameScreenProps> = observer(function Wal
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={{ width: spacing.screenWidth}}
sceneContainerStyle={{flex: 1}}
pagerStyle={{flex: 1}}
style={{flex: 1}}
/>
</>
+17 -20
View File
@@ -1,6 +1,6 @@
import {observer} from 'mobx-react-lite'
import React, {FC, useState, useEffect, useCallback, useRef, ReactElement} from 'react'
import {useFocusEffect} from '@react-navigation/native'
import {StaticScreenProps, useFocusEffect, useNavigation} from '@react-navigation/native'
import {
TextStyle,
ViewStyle,
@@ -18,7 +18,7 @@ import {
import codePush, { RemotePackage } from 'react-native-code-push'
import {moderateScale, verticalScale} from '@gocodingnow/rn-size-matters'
import { SvgXml } from 'react-native-svg'
import { NavigationState, Route, TabBar, TabView } from 'react-native-tab-view'
import { NavigationState, Route, TabBar, TabBarItemProps, TabBarProps, TabView } from 'react-native-tab-view'
import {useThemeColor, spacing, colors, typography} from '../theme'
import {
Button,
@@ -37,7 +37,6 @@ import {
} from '../components'
import EventEmitter from '../utils/eventEmitter'
import {useStores} from '../models'
import {WalletStackScreenProps} from '../navigation'
import {Mint, UnitBalance} from '../models/Mint'
import {MintsByUnit} from '../models/MintsStore'
import {HANDLE_CLAIM_TASK, HANDLE_RECEIVED_EVENT_TASK, KeyChain, log, NostrClient, WalletTaskResult} from '../services'
@@ -66,10 +65,12 @@ import { getUnixTime } from 'date-fns/getUnixTime'
const deploymentKey = APP_ENV === Env.PROD ? CODEPUSH_PRODUCTION_DEPLOYMENT_KEY : CODEPUSH_STAGING_DEPLOYMENT_KEY
const MINT_CHECK_INTERVAL = 60
interface WalletScreenProps extends WalletStackScreenProps<'Wallet'> {}
type Props = StaticScreenProps<{
scannedMintUrl?: string
}>
export const WalletScreen: FC<WalletScreenProps> = observer(
function WalletScreen({route, navigation}) {
export const WalletScreen = observer(function WalletScreen({ route }: Props) {
const navigation = useNavigation()
const {
mintsStore,
proofsStore,
@@ -241,8 +242,7 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
const incomingData = IncomingParser.findAndExtract(url)
await IncomingParser.navigateWithIncomingData(
incomingData,
navigation,
incomingData,
currentUnit
)
@@ -258,12 +258,12 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
const gotoUpdate = function() {
navigation.navigate('SettingsNavigator', {screen: 'Update', params: {
navigation.navigate('Update', {
isNativeUpdateAvailable,
isUpdateAvailable,
updateDescription,
updateSize
}, initial: false})
})
}
@@ -379,9 +379,8 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
navigation.navigate('TokenReceive', {unit: currentUnit})
}
const gotoTranDetail = function (id: number) {
// navigation.navigate('TranDetail', {id})
navigation.navigate('TransactionsNavigator', {screen: 'TranDetail', params: {id}, initial: false})
const gotoTranDetail = function (id: number) {
navigation.navigate('TranDetail', {id})
}
const gotoPaymentRequests = function () {
@@ -389,15 +388,13 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
}
const gotoProfile = function () {
navigation.navigate('ContactsNavigator', {screen: 'Profile', params: {}, initial: false})
navigation.navigate('Profile')
}
const gotoMintInfo = function (mintUrl: string) {
setIsMintsModalVisible(false)
navigation.navigate('SettingsNavigator', {
screen: 'MintInfo',
params: {mintUrl},
initial: false
navigation.navigate('MintInfo', {
mintUrl
})
}
@@ -537,11 +534,11 @@ export const WalletScreen: FC<WalletScreenProps> = observer(
<TabBar
{...props}
tabStyle={{width: tabWidth}}
renderLabel={({ route, focused, color }) => (
renderTabBarItem={({ route }) => (
<CurrencySign
mintUnit={route.key as MintUnit}
textStyle={{color: 'white'}}
containerStyle={focused ? {} : {opacity: 0.5}}
// containerStyle={focused ? {} : {opacity: 0.5}}
/>
)}
indicatorStyle={{backgroundColor: getActiveTabColor(props.navigationState)}}
+10 -13
View File
@@ -15,10 +15,8 @@ import {
} from 'react-native-animated-pagination-dots'
// import { isRTL } from "../i18n"
import {useStores} from '../models'
import {AppStackScreenProps} from '../navigation'
import {spacing, colors, useThemeColor} from '../theme'
import {useHeader} from '../utils/useHeader'
import {useSafeAreaInsetsStyle} from '../utils/useSafeAreaInsetsStyle'
import {
Button,
ErrorModal,
@@ -32,10 +30,9 @@ import {TxKeyPath, translate} from '../i18n'
import AppError from '../utils/AppError'
import { MINIBITS_MINT_URL } from '@env'
import useIsInternetReachable from '../utils/useIsInternetReachable'
import { KeyChain, NostrClient, WalletKeys } from '../services'
import { KeyChain } from '../services'
import { delay } from '../utils/utils'
import { getRandomUsername } from '../utils/usernames'
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
const AnimatedPagerView = Animated.createAnimatedComponent(PagerView)
@@ -73,13 +70,12 @@ const PAGES = [
],
final: 'welcomeScreen.page3.final'
}
]
]
// const welcomeLogo = require("../../assets/images/logo.png")
type Props = StaticScreenProps<{}>
export const WelcomeScreen: FC<AppStackScreenProps<'Welcome'>> =
function WelcomeScreen(_props) {
const {navigation} = _props
export const WelcomeScreen = function () {
const navigation = useNavigation()
const headerBg = useThemeColor('header')
useHeader({
@@ -134,7 +130,8 @@ export const WelcomeScreen: FC<AppStackScreenProps<'Welcome'>> =
relaysStore.addDefaultRelays()
userSettingsStore.setIsOnboarded(true)
navigation.navigate('Tabs', {screen: 'WalletNavigator', params: {screen: 'Wallet', params: {}}})
navigation.navigate('Tabs')
await delay(1000)
setStatusMessage('')
setIsLoading(false)
@@ -146,7 +143,7 @@ export const WelcomeScreen: FC<AppStackScreenProps<'Welcome'>> =
const gotoRecovery = async function () {
try {
navigation.navigate('RecoveryOptions', {})
navigation.navigate('RecoveryOptions', {fromScreen: 'Welcome'})
} catch (e: any) {
handleError(e)
}
@@ -286,7 +283,7 @@ export const WelcomeScreen: FC<AppStackScreenProps<'Welcome'>> =
{isLoading && <Loading statusMessage={statusMessage} style={{backgroundColor: headerBg, opacity: 1}} textStyle={{color: 'white'}}/>}
</Screen>
)
}
}
const $dotsContainer: ViewStyle ={
height: 50,
+3 -2
View File
@@ -7,6 +7,7 @@ import { LightningUtils } from './lightning/lightningUtils'
import { LnurlUtils } from './lnurl/lnurlUtils'
import { LnurlClient } from './lnurlService'
import { MintUnit } from './wallet/currency'
import { RootNavigation } from '../navigation'
export enum IncomingDataType {
CASHU = 'CASHU',
@@ -156,11 +157,11 @@ const navigateWithIncomingData = async function (
incoming: {
type: IncomingDataType,
encoded: any
},
navigation: StackNavigationProp<any>,
},
unit: MintUnit,
mintUrl?: string
) {
const navigation = RootNavigation
switch (incoming.type) {
case IncomingDataType.CASHU:
+48 -46
View File
@@ -2607,65 +2607,67 @@
invariant "^2.2.4"
nullthrows "^1.1.1"
"@react-navigation/bottom-tabs@^6.6.1":
version "6.6.1"
resolved "https://registry.yarnpkg.com/@react-navigation/bottom-tabs/-/bottom-tabs-6.6.1.tgz#589edc9c8fbf652c485b3c37d344faafe3cd4cc4"
integrity sha512-9oD4cypEBjPuaMiu9tevWGiQ4w/d6l3HNhcJ1IjXZ24xvYDSs0mqjUcdt8SWUolCvRrYc/DmNBLlT83bk0bHTw==
"@react-navigation/bottom-tabs@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@react-navigation/bottom-tabs/-/bottom-tabs-7.2.0.tgz#5b336b823226647a263b4fe743655462796b6aaf"
integrity sha512-1LxjgnbPyFINyf9Qr5d1YE0pYhuJayg5TCIIFQmbcX4PRhX7FKUXV7cX8OzrKXEdZi/UE/VNXugtozPAR9zgvA==
dependencies:
"@react-navigation/elements" "^1.3.31"
"@react-navigation/elements" "^2.2.5"
color "^4.2.3"
warn-once "^0.1.0"
"@react-navigation/core@^6.4.17":
version "6.4.17"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-6.4.17.tgz#f277a196b578c8a456efcc563d1c9bd87eb4ab04"
integrity sha512-Nd76EpomzChWAosGqWOYE3ItayhDzIEzzZsT7PfGcRFDgW5miHV2t4MZcq9YIK4tzxZjVVpYbIynOOQQd1e0Cg==
"@react-navigation/core@^7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-7.3.1.tgz#c6d4857fa2dd321d12ca87e200478c38c420f157"
integrity sha512-S3KCGvNsoqVk8ErAtQI2EAhg9185lahF5OY01ofrrD4Ij/uk3QEHHjoGQhR5l5DXSCSKr1JbMQA7MEKMsBiWZA==
dependencies:
"@react-navigation/routers" "^6.1.9"
"@react-navigation/routers" "^7.1.2"
escape-string-regexp "^4.0.0"
nanoid "^3.1.23"
nanoid "3.3.8"
query-string "^7.1.3"
react-is "^16.13.0"
react-is "^18.2.0"
use-latest-callback "^0.2.1"
use-sync-external-store "^1.2.2"
"@react-navigation/elements@^1.3.31":
version "1.3.31"
resolved "https://registry.yarnpkg.com/@react-navigation/elements/-/elements-1.3.31.tgz#28dd802a0787bb03fc0e5be296daf1804dbebbcf"
integrity sha512-bUzP4Awlljx5RKEExw8WYtif8EuQni2glDaieYROKTnaxsu9kEIA515sXQgUDZU4Ob12VoL7+z70uO3qrlfXcQ==
"@react-navigation/native-stack@^6.11.0":
version "6.11.0"
resolved "https://registry.yarnpkg.com/@react-navigation/native-stack/-/native-stack-6.11.0.tgz#a33f92cbd55dfe28fb0ba67df99aaa95240eb87c"
integrity sha512-U5EcUB9Q2NQspCFwYGGNJm0h6wBCOv7T30QjndmvlawLkNt7S7KWbpWyxS9XBHSIKF57RgWjfxuJNTgTstpXxw==
"@react-navigation/elements@^2.2.5":
version "2.2.5"
resolved "https://registry.yarnpkg.com/@react-navigation/elements/-/elements-2.2.5.tgz#0e2ca76e2003e96b417a3d7c2829bf1afd69193f"
integrity sha512-sDhE+W14P7MNWLMxXg1MEVXwkLUpMZJGflE6nQNzLmolJQIHgcia0Mrm8uRa3bQovhxYu1UzEojLZ+caoZt7Fg==
dependencies:
"@react-navigation/elements" "^1.3.31"
warn-once "^0.1.0"
color "^4.2.3"
"@react-navigation/native@^6.1.18":
version "6.1.18"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-6.1.18.tgz#338fa9afa2c89feec1d3eac41c963840d8d6f106"
integrity sha512-mIT9MiL/vMm4eirLcmw2h6h/Nm5FICtnYSdohq4vTLA2FF/6PNhByM7s8ffqoVfE5L0uAa6Xda1B7oddolUiGg==
"@react-navigation/native-stack@^7.2.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@react-navigation/native-stack/-/native-stack-7.2.0.tgz#8aa489f88d662b3543a931b9cb934bb2e09a4893"
integrity sha512-mw7Nq9qQrGsmJmCTwIIWB7yY/3tWYXvQswx+HJScGAadIjemvytJXm1fcl3+YZ9T9Ym0aERcVe5kDs+ny3X4vA==
dependencies:
"@react-navigation/core" "^6.4.17"
"@react-navigation/elements" "^2.2.5"
warn-once "^0.1.1"
"@react-navigation/native@^7.0.14":
version "7.0.14"
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-7.0.14.tgz#b3ee2879038dcf0523d26516af88d3adc549ce5e"
integrity sha512-Gi6lLw4VOGSWAhmUdJOMauOKGK51/YA1CprjXm91sNfgERWvznqEMw8QmUQx9SEqYfi0LfZhbzpMst09SJ00lw==
dependencies:
"@react-navigation/core" "^7.3.1"
escape-string-regexp "^4.0.0"
fast-deep-equal "^3.1.3"
nanoid "^3.1.23"
nanoid "3.3.8"
use-latest-callback "^0.2.1"
"@react-navigation/routers@^6.1.9":
version "6.1.9"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-6.1.9.tgz#73f5481a15a38e36592a0afa13c3c064b9f90bed"
integrity sha512-lTM8gSFHSfkJvQkxacGM6VJtBt61ip2XO54aNfswD+KMw6eeZ4oehl7m0me3CR9hnDE4+60iAZR8sAhvCiI3NA==
"@react-navigation/routers@^7.1.2":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@react-navigation/routers/-/routers-7.1.2.tgz#647a63e383673de0c4fc10c64a17f551d5da0a17"
integrity sha512-emdEjpVDK8zbiu2GChC8oYIAub9i/OpNuQJekVsbyFCBz4/TzaBzms38Q53YaNhdIFNmiYLfHv/Y1Ub7KYfm3w==
dependencies:
nanoid "^3.1.23"
nanoid "3.3.8"
"@react-navigation/stack@^6.4.1":
version "6.4.1"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-6.4.1.tgz#a158350637f5298292202ce854e5c5c9688f23f9"
integrity sha512-upMEHOKMtuMu4c9gmoPlO/JqI6mDlSqwXg1aXKOTQLXAF8H5koOLRfrmi7AkdiE9A7lDXWUAZoGuD9O88cYvDQ==
"@react-navigation/stack@^7.1.1":
version "7.1.1"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-7.1.1.tgz#0ae8902c5d72573a3c178b3fd19a65cc1971ad16"
integrity sha512-CBTKQlIkELp05zRiTAv5Pa7OMuCpKyBXcdB3PGMN2Mm55/5MkDsA1IaZorp/6TsVCdllITD6aTbGX/HA/88A6w==
dependencies:
"@react-navigation/elements" "^1.3.31"
"@react-navigation/elements" "^2.2.5"
color "^4.2.3"
warn-once "^0.1.0"
"@scure/base@1.1.1":
version "1.1.1"
@@ -7133,7 +7135,7 @@ mz@^2.4.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"
nanoid@^3.1.23:
nanoid@3.3.8:
version "3.3.8"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf"
integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==
@@ -7822,12 +7824,12 @@ react-freeze@^1.0.0:
resolved "https://registry.yarnpkg.com/react-freeze/-/react-freeze-1.0.4.tgz#cbbea2762b0368b05cbe407ddc9d518c57c6f3ad"
integrity sha512-r4F0Sec0BLxWicc7HEyo2x3/2icUTrRmDjaaRyzzn+7aDyFZliszMDOgLVwSnQnYENOlL1o569Ze2HZefk8clA==
"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.3.1:
"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0, react-is@^18.3.1:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==
react-is@^16.13.0, react-is@^16.13.1, react-is@^16.7.0:
react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
@@ -9246,7 +9248,7 @@ use-latest-callback@^0.2.1:
resolved "https://registry.yarnpkg.com/use-latest-callback/-/use-latest-callback-0.2.3.tgz#2d644d3063040b9bc2d4c55bb525a13ae3de9e16"
integrity sha512-7vI3fBuyRcP91pazVboc4qu+6ZqM8izPWX9k7cRnT8hbD5svslcknsh3S9BUhaK11OmgTV4oWZZVSeQAiV53SQ==
use-sync-external-store@^1.4.0:
use-sync-external-store@^1.2.2, use-sync-external-store@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz#adbc795d8eeb47029963016cefdf89dc799fcebc"
integrity sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==
@@ -9308,7 +9310,7 @@ walker@^1.0.7, walker@^1.0.8:
dependencies:
makeerror "1.0.12"
warn-once@0.1.1, warn-once@^0.1.0:
warn-once@0.1.1, warn-once@^0.1.0, warn-once@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/warn-once/-/warn-once-0.1.1.tgz#952088f4fb56896e73fd4e6a3767272a3fccce43"
integrity sha512-VkQZJbO8zVImzYFteBXvBOZEl1qL175WH8VmZcxF2fZAoudNhNDvHi+doCaAEdU2l2vtcIwa2zn0QK5+I1HQ3Q==