Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/components/PageContainer/PageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ export const PageContainer = ({
keyboardShouldPersistTaps="handled"
noVerticalPadding={noVerticalPadding}
>
{!header || headerHeight ? children : null}
{footerButton && <S.PageFooterGap />}
{bottom > 0 && !noBottomMargin && !noVerticalPadding && (
<View style={{ height: bottom }} />
)}
<View>
{!header || headerHeight ? children : null}
{footerButton && <S.PageFooterGap />}
{bottom > 0 && !noBottomMargin && !noVerticalPadding && (
<View style={{ height: bottom }} />
)}
</View>
</S.StyledPageContainer>
{footerButton && (
<S.PageFooterButton
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useAnimateAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type StringPart = {
text: string;
add?: boolean;
remove?: boolean;
width?: number;
};

const VISIBLE_STYLE = {
Expand Down
3 changes: 3 additions & 0 deletions src/screens/PayoutConfigScreen/PayoutConfigScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Loader, PageContainer, PayoutConfig } from "@components";
import { useNavigate } from "@components/Router";
import { faArrowLeft } from "@fortawesome/free-solid-svg-icons";
import { useCallback, useEffect, useMemo, useState } from "react";
import { View } from "react-native";
import { useAccountConfig } from "@hooks";
import { apiRootUrl, currencyToCountry } from "@config";
import { isApiError } from "@utils";
Expand Down Expand Up @@ -171,6 +172,7 @@ export const PayoutConfigScreen = () => {
onPress: handleSubmit(onSubmit)
}}
>
<View>
<PayoutConfig
control={control}
watch={watch}
Expand All @@ -181,6 +183,7 @@ export const PayoutConfigScreen = () => {
getFieldState={getFieldState}
currency={currency}
/>
</View>
</PageContainer>
);
};
29 changes: 16 additions & 13 deletions src/screens/Pos/Pos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
useRef,
useState
} from "react";
import { View } from "react-native";
import {
getFormattedUnit,
AsyncStorage,
Expand Down Expand Up @@ -134,7 +135,7 @@ export const Pos = () => {
const { unitDecimals, unitDecimalPower } = useMemo(() => {
const _unitDecimals =
currencies.find((c) => c.value === unit)?.decimals ?? DEFAULT_DECIMALS;
const _unitDecimalPower = getUnitDecimalPower(unit);
const _unitDecimalPower = getUnitDecimalPower(unit || "USD");
return { unitDecimals: _unitDecimals, unitDecimalPower: _unitDecimalPower };
}, [unit]);

Expand All @@ -159,7 +160,7 @@ export const Pos = () => {
const requestInvoice = useCallback(async () => {
await postInvoice({
amount: decimalFiat,
unit,
unit: unit || "USD",
description,
deviceName,
deviceType
Expand Down Expand Up @@ -212,20 +213,20 @@ export const Pos = () => {
const [decimalCount, setDecimalCount] = useState(0);

const [parts, springs, animateAmount] = useAnimateAmount({
unit,
unit: unit || "USD",
initialParts: initialValue,
decimalCount
});

const [plusParts, plusSprings, animatePlusAmount, setPlusParts] =
useAnimateAmount({
unit,
unit: unit || "USD",
mode: AnimationMode.Plus,
animationDelay: PLUS_ANIMATION_DELAY
});

const [totalParts, totalSprings, animateTotalAmount] = useAnimateAmount({
unit,
unit: unit || "USD",
mode: AnimationMode.Plus
});

Expand Down Expand Up @@ -368,12 +369,12 @@ export const Pos = () => {
unitDecimals
]);

const [symbolsProps, symbolsApi] = useSymbolApi();

const [movingPlusProps, movingPlusApi] = useSpring(() => ({
from: { top: 0, scale: 1, color: colors.white, opacity: 1 }
}));

const [symbolsProps, symbolsApi] = useSymbolApi();

const onPlus = useCallback(async () => {
const newPlusParts = parts.filter((p) => !p.remove);
const currentParts = newPlusParts.map((e) => e.text).join("");
Expand All @@ -388,7 +389,7 @@ export const Pos = () => {
},
delay: springAnimationDelay,
config: PLUS_ANIMATION_CONFIG
}));
}) as any);

if (plusFiatAmount > 0) {
await movingPlusApi.start(() => ({
Expand Down Expand Up @@ -464,9 +465,9 @@ export const Pos = () => {
}, [handleKeyPress]);

const registerRef = useCallback(
(index: number) => (ref: TouchableOpacity) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
(inputRef.current[index] = ref),
(index: number) => (ref: any) => {
inputRef.current[index] = ref;
},
[]
);

Expand Down Expand Up @@ -567,6 +568,7 @@ export const Pos = () => {
noPadding
noBottomMargin
>
<View>
{deviceNameModal}
<S.InfosContainer isSmallHeight={isSmallHeight}>
{isAtm && (
Expand Down Expand Up @@ -620,7 +622,7 @@ export const Pos = () => {
{totalPartsComponents}
</S.PlusTextsContainer>
</S.AmountsContainer>
<S.FiatAmountDropdownIcon icon={faAngleDown} color={colors.grey} />
<S.FiatAmountDropdownIcon icon={faAngleDown} color={colors.grey} size={16} />
<S.FiatUnitPicker
value={unit}
items={currencies}
Expand Down Expand Up @@ -663,7 +665,7 @@ export const Pos = () => {
{rowValue.map((columnValue, columnIndex) => (
<NumberInput
key={columnIndex}
value={columnValue?.toString()}
value={columnValue?.toString() || ""}
{...(typeof columnValue === "number"
? {
ref: registerRef(columnValue),
Expand Down Expand Up @@ -725,6 +727,7 @@ export const Pos = () => {
/>
</S.PadLine>
</S.PadContainer>
</View>
</PageContainer>
) : (
<Loader />
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Pos/components/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type NumberInputProps = {
paddingBottom?: number;
};

export const NumberInput = forwardRef<TouchableOpacity, NumberInputProps>(
export const NumberInput = forwardRef<typeof TouchableOpacity, NumberInputProps>(
(
{
value,
Expand Down
3 changes: 3 additions & 0 deletions src/screens/QRScanner/QRScanner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useMemo, useState } from "react";
import { View } from "react-native";
import { useWindowDimensions } from "react-native";
import { useLocation, useNavigate } from "@components/Router";
import { Image, Loader, PageContainer } from "@components";
Expand Down Expand Up @@ -99,6 +100,7 @@ export const QRScanner = () => {
/>
)}
<PageContainer noHorizontalPadding isStrictTopMargin>
<View>
{!isCameraLoading && !isLoading ? (
<>
<S.VerticialPart>
Expand Down Expand Up @@ -132,6 +134,7 @@ export const QRScanner = () => {
) : (
<Loader />
)}
</View>
</PageContainer>
</>
);
Expand Down
3 changes: 3 additions & 0 deletions src/screens/Settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
import { View } from "react-native";
import {
SBPContext,
apiRootUrl,
Expand Down Expand Up @@ -272,6 +273,7 @@ export const Settings = () => {
left: { icon: faArrowLeft, onPress: -1 }
}}
>
<View>
<S.FlexComponentStack>
{accountConfig ? (
!accountConfig.isAtm &&
Expand Down Expand Up @@ -459,6 +461,7 @@ export const Settings = () => {
<S.VersionText>{versionTag}</S.VersionText>
</S.PressableVersion>
</S.FlexComponentStack>
</View>
</PageContainer>
);
};
14 changes: 12 additions & 2 deletions src/screens/SignatureLogin/SignatureLogin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useContext, useRef, useState } from "react";
import { View } from "react-native";
import { useTranslation } from "react-i18next";
import { SBPContext, apiRootUrl, platform } from "@config";
import { Controller, SubmitHandler, useForm } from "react-hook-form";
Expand Down Expand Up @@ -216,7 +217,13 @@ export const SignatureLogin = () => {
signature,
zPub,
words: words.join(" "),
walletType: "local"
walletType: "local",
walletConfig: {
account: "local",
label: "Local Wallet",
type: "local",
zpub: zPub
}
});
} catch (e) {
if (isApiError(e)) {
Expand Down Expand Up @@ -296,7 +303,8 @@ export const SignatureLogin = () => {
signature: data.signature,
zPub: data.zPub,
words: data.words,
walletType: data.walletType
walletType: data.walletType,
walletConfig: data.walletConfig
});
}
},
Expand Down Expand Up @@ -347,6 +355,7 @@ export const SignatureLogin = () => {
title: tRoot("common.login")
}}
>
<View>
<ConnectWalletModal
isOpen={!!customWalletFunction}
onClose={onConnectWalletModalClose}
Expand Down Expand Up @@ -446,6 +455,7 @@ export const SignatureLogin = () => {
</ComponentStack>
</LoginView>
</ComponentStack>
</View>
</S.StyledPageContainer>
);
};
3 changes: 3 additions & 0 deletions src/screens/Signup/Signup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
import { View } from "react-native";
import {
faArrowLeft,
faAt,
Expand Down Expand Up @@ -490,6 +491,7 @@ export const Signup = () => {
onPress: handleSubmit(onSubmit)
}}
>
<View>
<ComponentStack gapSize={32}>
<FieldContainer icon={faShop} title={t("yourAccountName")}>
<Controller
Expand Down Expand Up @@ -593,6 +595,7 @@ export const Signup = () => {
/>
</S.TermsText>
</ComponentStack>
</View>
</PageContainer>
);
};
7 changes: 6 additions & 1 deletion src/screens/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { View } from "react-native";
import { useTranslation } from "react-i18next";
import {
Button,
Expand Down Expand Up @@ -214,7 +215,9 @@ export const Wallet = () => {
onClose={onSendModalClose}
zPub={zPub}
currentBalance={balance / 100000000}
/>
>
<></>
</SendModal>
)}
<PageContainer
header={{ left: { onPress: -1, icon: faArrowLeft }, title: t("title") }}
Expand All @@ -230,6 +233,7 @@ export const Wallet = () => {
}
: {})}
>
<View>
<ComponentStack>
<S.BalanceComponentStack gapSize={6}>
<S.BalanceTitle h4 weight={500}>
Expand Down Expand Up @@ -311,6 +315,7 @@ export const Wallet = () => {
})}
/>
</ComponentStack>
</View>
</PageContainer>
</>
);
Expand Down
Loading
Loading