react-native-fpay 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/lib/module/FountainPayProvider.js +108 -18
  2. package/lib/module/FountainPayProvider.js.map +1 -1
  3. package/lib/module/core/api/client.js +13 -1
  4. package/lib/module/core/api/client.js.map +1 -1
  5. package/lib/module/core/api/index.js +66 -24
  6. package/lib/module/core/api/index.js.map +1 -1
  7. package/lib/module/engine/BLEReceiverService.js.map +1 -1
  8. package/lib/module/engine/BLESenderService.js.map +1 -1
  9. package/lib/module/engine/FPEngine.js +164 -43
  10. package/lib/module/engine/FPEngine.js.map +1 -1
  11. package/lib/module/engine/NearbyUsersService.js +1 -1
  12. package/lib/module/engine/NearbyUsersService.js.map +1 -1
  13. package/lib/module/index.js +1 -0
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/store/FPStore.js +155 -0
  16. package/lib/module/store/FPStore.js.map +1 -0
  17. package/lib/module/ui/components/AnimatedDots.js +3 -3
  18. package/lib/module/ui/components/AnimatedDots.js.map +1 -1
  19. package/lib/module/ui/components/ConfirmScreen.js +137 -123
  20. package/lib/module/ui/components/ConfirmScreen.js.map +1 -1
  21. package/lib/module/ui/components/FPButton.js.map +1 -1
  22. package/lib/module/ui/components/LoadingAnimation/InLoading.js +3 -3
  23. package/lib/module/ui/components/LoadingAnimation/InLoading.js.map +1 -1
  24. package/lib/module/ui/components/LoadingAnimation/index.js +3 -3
  25. package/lib/module/ui/components/LoadingAnimation/index.js.map +1 -1
  26. package/lib/module/ui/components/OtpInput/OTPInputView.js +11 -11
  27. package/lib/module/ui/components/OtpInput/OTPInputView.js.map +1 -1
  28. package/lib/module/ui/components/OtpInput/Styles.js +1 -1
  29. package/lib/module/ui/components/OtpInput/helpers/codeToArray.js +1 -1
  30. package/lib/module/ui/components/OtpInput/helpers/device.js.map +1 -1
  31. package/lib/module/ui/components/OtpInput/helpers/styles.js.map +1 -1
  32. package/lib/module/ui/components/OtpInput/index.js +3 -1
  33. package/lib/module/ui/components/OtpInput/index.js.map +1 -1
  34. package/lib/module/ui/components/PulseAnimation.js +2 -2
  35. package/lib/module/ui/components/PulseAnimation.js.map +1 -1
  36. package/lib/module/ui/modals/FPPaymentRequestModal.js +8 -7
  37. package/lib/module/ui/modals/FPPaymentRequestModal.js.map +1 -1
  38. package/lib/module/ui/modals/FPShell.js +2 -0
  39. package/lib/module/ui/modals/FPShell.js.map +1 -1
  40. package/lib/module/ui/screens/ReceiveScreen.js +8 -9
  41. package/lib/module/ui/screens/ReceiveScreen.js.map +1 -1
  42. package/lib/module/ui/screens/SendScreen.js +43 -94
  43. package/lib/module/ui/screens/SendScreen.js.map +1 -1
  44. package/lib/module/ui/screens/styles.js +15 -3
  45. package/lib/module/ui/screens/styles.js.map +1 -1
  46. package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js +4 -4
  47. package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js.map +1 -1
  48. package/lib/module/ui/screens/sub/receivePayment/Qr/index.js +5 -5
  49. package/lib/module/ui/screens/sub/receivePayment/Qr/index.js.map +1 -1
  50. package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js +10 -11
  51. package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js.map +1 -1
  52. package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js +31 -8
  53. package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js.map +1 -1
  54. package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js +12 -8
  55. package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js.map +1 -1
  56. package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js +17 -5
  57. package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js.map +1 -1
  58. package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js +67 -35
  59. package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -1
  60. package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +110 -34
  61. package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -1
  62. package/lib/module/ui/theme/index.js.map +1 -1
  63. package/lib/typescript/src/FountainPayProvider.d.ts +1 -1
  64. package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
  65. package/lib/typescript/src/core/api/client.d.ts.map +1 -1
  66. package/lib/typescript/src/core/api/index.d.ts +42 -26
  67. package/lib/typescript/src/core/api/index.d.ts.map +1 -1
  68. package/lib/typescript/src/core/types/index.d.ts +53 -28
  69. package/lib/typescript/src/core/types/index.d.ts.map +1 -1
  70. package/lib/typescript/src/engine/BLEReceiverService.d.ts +2 -0
  71. package/lib/typescript/src/engine/BLEReceiverService.d.ts.map +1 -1
  72. package/lib/typescript/src/engine/BLESenderService.d.ts.map +1 -1
  73. package/lib/typescript/src/engine/FPEngine.d.ts +5 -3
  74. package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
  75. package/lib/typescript/src/engine/useIsForeground.d.ts.map +1 -1
  76. package/lib/typescript/src/index.d.ts +2 -1
  77. package/lib/typescript/src/index.d.ts.map +1 -1
  78. package/lib/typescript/src/store/FPStore.d.ts +60 -0
  79. package/lib/typescript/src/store/FPStore.d.ts.map +1 -0
  80. package/lib/typescript/src/ui/components/AnimatedDots.d.ts.map +1 -1
  81. package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +5 -5
  82. package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -1
  83. package/lib/typescript/src/ui/components/FPButton.d.ts +1 -1
  84. package/lib/typescript/src/ui/components/FPButton.d.ts.map +1 -1
  85. package/lib/typescript/src/ui/components/LoadingAnimation/InLoading.d.ts.map +1 -1
  86. package/lib/typescript/src/ui/components/LoadingAnimation/index.d.ts.map +1 -1
  87. package/lib/typescript/src/ui/components/OtpInput/OTPInputView.d.ts.map +1 -1
  88. package/lib/typescript/src/ui/components/OtpInput/helpers/codeToArray.d.ts.map +1 -1
  89. package/lib/typescript/src/ui/components/OtpInput/helpers/device.d.ts.map +1 -1
  90. package/lib/typescript/src/ui/components/OtpInput/helpers/styles.d.ts.map +1 -1
  91. package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts +1 -2
  92. package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts.map +1 -1
  93. package/lib/typescript/src/ui/components/OtpInput/index.d.ts +3 -1
  94. package/lib/typescript/src/ui/components/OtpInput/index.d.ts.map +1 -1
  95. package/lib/typescript/src/ui/components/PulseAnimation.d.ts.map +1 -1
  96. package/lib/typescript/src/ui/modals/FPPaymentRequestModal.d.ts.map +1 -1
  97. package/lib/typescript/src/ui/modals/FPShell.d.ts.map +1 -1
  98. package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts +1 -1
  99. package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts.map +1 -1
  100. package/lib/typescript/src/ui/screens/SendScreen.d.ts +1 -1
  101. package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
  102. package/lib/typescript/src/ui/screens/styles.d.ts +197 -0
  103. package/lib/typescript/src/ui/screens/styles.d.ts.map +1 -1
  104. package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts.map +1 -1
  105. package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts.map +1 -1
  106. package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts.map +1 -1
  107. package/lib/typescript/src/ui/screens/sub/sendPayment/BluetoothSubScreen.d.ts.map +1 -1
  108. package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts +1 -1
  109. package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts.map +1 -1
  110. package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts +1 -1
  111. package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts.map +1 -1
  112. package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts +1 -1
  113. package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts.map +1 -1
  114. package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts +1 -1
  115. package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -1
  116. package/lib/typescript/src/ui/theme/index.d.ts.map +1 -1
  117. package/package.json +4 -4
  118. package/src/FountainPayProvider.tsx +163 -24
  119. package/src/core/api/client.ts +26 -4
  120. package/src/core/api/index.ts +170 -49
  121. package/src/core/types/index.ts +81 -48
  122. package/src/engine/BLEReceiverService.ts +86 -28
  123. package/src/engine/BLESenderService.ts +133 -69
  124. package/src/engine/FPEngine.ts +316 -97
  125. package/src/engine/NearbyUsersService.ts +6 -6
  126. package/src/engine/useIsForeground.ts +12 -12
  127. package/src/index.ts +10 -4
  128. package/src/store/FPStore.ts +216 -0
  129. package/src/ui/components/AnimatedDots.tsx +4 -5
  130. package/src/ui/components/ConfirmScreen.tsx +182 -169
  131. package/src/ui/components/FPButton.tsx +50 -9
  132. package/src/ui/components/LoadingAnimation/InLoading.tsx +23 -27
  133. package/src/ui/components/LoadingAnimation/index.tsx +3 -7
  134. package/src/ui/components/OtpInput/OTPInputView.tsx +254 -205
  135. package/src/ui/components/OtpInput/Styles.ts +1 -1
  136. package/src/ui/components/OtpInput/helpers/codeToArray.ts +2 -2
  137. package/src/ui/components/OtpInput/helpers/device.ts +4 -3
  138. package/src/ui/components/OtpInput/helpers/styles.ts +13 -14
  139. package/src/ui/components/OtpInput/helpers/types.ts +83 -79
  140. package/src/ui/components/OtpInput/index.tsx +18 -15
  141. package/src/ui/components/PulseAnimation.tsx +3 -5
  142. package/src/ui/modals/FPPaymentRequestModal.tsx +111 -28
  143. package/src/ui/modals/FPShell.tsx +60 -34
  144. package/src/ui/screens/ReceiveScreen.tsx +245 -84
  145. package/src/ui/screens/SendScreen.tsx +419 -167
  146. package/src/ui/screens/styles.ts +17 -5
  147. package/src/ui/screens/sub/receivePayment/Nfc/index.tsx +17 -25
  148. package/src/ui/screens/sub/receivePayment/Qr/index.tsx +21 -20
  149. package/src/ui/screens/sub/receivePayment/Transfer/index.tsx +34 -28
  150. package/src/ui/screens/sub/sendPayment/BluetoothSubScreen.tsx +135 -67
  151. package/src/ui/screens/sub/sendPayment/NFCSubScreen.tsx +188 -112
  152. package/src/ui/screens/sub/sendPayment/NQRSubScreen.tsx +102 -69
  153. package/src/ui/screens/sub/sendPayment/ProximitySubScreen.tsx +225 -99
  154. package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +209 -89
  155. package/src/ui/theme/index.ts +14 -2
@@ -1,88 +1,92 @@
1
- import * as React from 'react'
1
+ import * as React from 'react';
2
2
  import type { TextStyle, ViewStyle } from 'react-native';
3
3
 
4
- type KeyboardType = 'default' | 'email-address' | 'number-pad' | 'phone-pad';
4
+ export type KeyboardType =
5
+ | 'default'
6
+ | 'email-address'
7
+ | 'number-pad'
8
+ | 'phone-pad';
5
9
 
6
10
  export interface InputProps {
7
- /**
8
- * Digits of pins in the OTP
9
- */
10
- pinCount: number;
11
- /**
12
- * Style of the input fields
13
- */
14
- codeInputFieldStyle?: TextStyle;
15
- /**
16
- * Style of highlighted status for input fields
17
- */
18
- codeInputHighlightStyle?: TextStyle;
19
- /**
20
- * Callback function
21
- * Trigger when all fields of the OTP has been filled
22
- *
23
- * @param code The verification code
24
- */
25
- onCodeFilled?: (code: string) => void;
26
- /**
27
- * Callback function
28
- * Trigger when a field of the OTP is changed
29
- *
30
- * @param code The verification code
31
- */
32
- onCodeChanged?: (code: string) => void;
33
- /**
34
- * If keyboard is automatically brought up when OTP is loaded.
35
- */
36
- autoFocusOnLoad?: boolean;
37
- /**
38
- * Initial pin code
39
- */
40
- code?: string;
41
- /**
42
- * Secure input text
43
- */
44
- secureTextEntry?: boolean;
45
- /**
46
- * Set editable for inputs
47
- */
48
- editable?: boolean;
49
- /**
50
- * Type of the keyboard
51
- */
52
- keyboardType?: KeyboardType;
53
- /**
54
- * Placeholder character to fill all inputs when the OTP is empty
55
- */
56
- placeholderCharacter?: string;
57
- /**
58
- * Placeholder text color of inputs
59
- */
60
- placeholderTextColor?: string;
61
- /**
62
- * Style of the OTP container view
63
- */
64
- style?: ViewStyle;
65
- /**
66
- * The highlight (and cursor on iOS) color of the text input.
67
- */
68
- selectionColor?: string;
69
- /**
70
- * If inputs are automatically cleared.
71
- */
72
- clearInputs?: boolean;
11
+ /**
12
+ * Digits of pins in the OTP
13
+ */
14
+ pinCount: number;
15
+ /**
16
+ * Style of the input fields
17
+ */
18
+ codeInputFieldStyle?: TextStyle;
19
+ /**
20
+ * Style of highlighted status for input fields
21
+ */
22
+ codeInputHighlightStyle?: TextStyle;
23
+ /**
24
+ * Callback function
25
+ * Trigger when all fields of the OTP has been filled
26
+ *
27
+ * @param code The verification code
28
+ */
29
+ onCodeFilled?: (code: string) => void;
30
+ /**
31
+ * Callback function
32
+ * Trigger when a field of the OTP is changed
33
+ *
34
+ * @param code The verification code
35
+ */
36
+ onCodeChanged?: (code: string) => void;
37
+ /**
38
+ * If keyboard is automatically brought up when OTP is loaded.
39
+ */
40
+ autoFocusOnLoad?: boolean;
41
+ /**
42
+ * Initial pin code
43
+ */
44
+ code?: string;
45
+ /**
46
+ * Secure input text
47
+ */
48
+ secureTextEntry?: boolean;
49
+ /**
50
+ * Set editable for inputs
51
+ */
52
+ editable?: boolean;
53
+ /**
54
+ * Type of the keyboard
55
+ */
56
+ keyboardType?: KeyboardType;
57
+ /**
58
+ * Placeholder character to fill all inputs when the OTP is empty
59
+ */
60
+ placeholderCharacter?: string;
61
+ /**
62
+ * Placeholder text color of inputs
63
+ */
64
+ placeholderTextColor?: string;
65
+ /**
66
+ * Style of the OTP container view
67
+ */
68
+ style?: ViewStyle;
69
+ /**
70
+ * The highlight (and cursor on iOS) color of the text input.
71
+ */
72
+ selectionColor?: string;
73
+ /**
74
+ * If inputs are automatically cleared.
75
+ */
76
+ clearInputs?: boolean;
73
77
 
74
- /**
75
- * Keyboard appearance. The value can be 'default', 'dark' or 'light'.
76
- */
77
- keyboardAppearance?: 'default' | 'dark' | 'light';
78
+ /**
79
+ * Keyboard appearance. The value can be 'default', 'dark' or 'light'.
80
+ */
81
+ keyboardAppearance?: 'default' | 'dark' | 'light';
78
82
 
79
- /**
80
- * Keyboard auto-appear on focus. The value can be 'false' or 'true'.
81
- */
82
- showSoftInputOnFocus?: boolean,
83
+ /**
84
+ * Keyboard auto-appear on focus. The value can be 'false' or 'true'.
85
+ */
86
+ showSoftInputOnFocus?: boolean;
83
87
  }
84
88
 
85
89
  export interface OTPInputViewState {
86
- digits: string[];
87
- selectedIndex: number;
88
- }
90
+ digits: string[];
91
+ selectedIndex: number;
92
+ }
@@ -1,13 +1,15 @@
1
- import {View, StyleSheet} from 'react-native';
1
+ import { View, StyleSheet } from 'react-native';
2
2
  // import { NumPad } from "frontatish";
3
3
  import React from 'react';
4
4
  import OTPInputView from './OTPInputView';
5
+ import type { KeyboardType } from './helpers/types';
5
6
 
6
7
  type PropT = {
7
8
  callBack: Function;
8
9
  pinvalue?: any;
9
10
  isSecure?: boolean;
10
11
  count?: number;
12
+ keyboardType?: KeyboardType;
11
13
  };
12
14
 
13
15
  export default function OTPInputs({
@@ -15,26 +17,27 @@ export default function OTPInputs({
15
17
  pinvalue = '',
16
18
  isSecure = true,
17
19
  count = 4,
20
+ keyboardType = 'number-pad',
18
21
  }: PropT) {
19
-
20
22
  return (
21
- <OTPInputView
22
- style={{width: '100%', backgroundColor: 'transparent'}}
23
- codeInputFieldStyle={styles.underlineStyleBase}
24
- codeInputHighlightStyle={styles.underlineStyleHighLighted}
25
- secureTextEntry={isSecure}
26
- pinCount={count}
27
- autoFocusOnLoad
28
- placeholderCharacter={''}
29
- onCodeFilled={code => {
30
- callBack(code);
31
- }}
32
- />
23
+ <OTPInputView
24
+ style={{ width: '100%', backgroundColor: 'transparent' }}
25
+ codeInputFieldStyle={styles.underlineStyleBase}
26
+ codeInputHighlightStyle={styles.underlineStyleHighLighted}
27
+ secureTextEntry={isSecure}
28
+ keyboardType={keyboardType}
29
+ pinCount={count}
30
+ autoFocusOnLoad
31
+ placeholderCharacter={''}
32
+ onCodeFilled={(code) => {
33
+ callBack(code);
34
+ }}
35
+ />
33
36
  );
34
37
  }
35
38
 
36
39
  const styles = StyleSheet.create({
37
- underlineStyleBase: {
40
+ underlineStyleBase: {
38
41
  width: 60,
39
42
  height: 60,
40
43
  borderWidth: 1,
@@ -1,8 +1,7 @@
1
- import { useEffect, useRef } from "react";
2
- import { Animated, Easing } from "react-native";
1
+ import { useEffect, useRef } from 'react';
2
+ import { Animated, Easing } from 'react-native';
3
3
  import styled from 'styled-components/native';
4
4
 
5
-
6
5
  const PulseRing = styled(Animated.View)<{ delay?: number }>`
7
6
  position: absolute;
8
7
  width: 200px;
@@ -19,7 +18,6 @@ export const PulseAnimation: React.FC = () => {
19
18
  const pulse3 = useRef(new Animated.Value(0)).current;
20
19
  const AnimatedPulseRing = Animated.createAnimatedComponent(PulseRing);
21
20
 
22
-
23
21
  useEffect(() => {
24
22
  const createPulse = (value: Animated.Value, delay: number) => {
25
23
  return Animated.loop(
@@ -75,4 +73,4 @@ export const PulseAnimation: React.FC = () => {
75
73
  <AnimatedPulseRing style={pulseStyle(pulse3)} />
76
74
  </>
77
75
  );
78
- };
76
+ };
@@ -1,27 +1,55 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { View, Text, Modal, StyleSheet, Animated, TouchableOpacity } from 'react-native';
2
+ import {
3
+ View,
4
+ Text,
5
+ Modal,
6
+ StyleSheet,
7
+ Animated,
8
+ TouchableOpacity,
9
+ } from 'react-native';
3
10
  import { FPEngine, _onEvent } from '../../engine/FPEngine';
4
11
  import { FPButton } from '../components/FPButton';
5
12
  import { C, R, S, F, shadow } from '../theme';
6
- import type { FPBluetoothPaymentRequest, FPTransferRecipient, FPUserInfo } from '../../core/types';
13
+ import type {
14
+ FPBluetoothPaymentRequest,
15
+ FPTransferRecipient,
16
+ FPUserInfo,
17
+ } from '../../core/types';
7
18
 
8
19
  export function FPPaymentRequestModal() {
9
- const [request, setRequest] = useState<FPBluetoothPaymentRequest | null>(null);
20
+ const [request, setRequest] = useState<FPBluetoothPaymentRequest | null>(
21
+ null
22
+ );
10
23
  const [loading, setLoading] = useState(false);
11
24
  const scale = React.useRef(new Animated.Value(0.85)).current;
12
25
 
13
26
  const recipient: FPUserInfo | null = FPEngine.getUser() ?? null;
14
- const recipientAccount: FPTransferRecipient | null = FPEngine.getAccount() ?? null;
27
+ const recipientAccount: FPTransferRecipient | null =
28
+ FPEngine.getAccount() ?? null;
15
29
 
16
30
  useEffect(() => {
17
31
  const unsub = _onEvent('incoming_payment_request', (req: unknown) => {
18
32
  setRequest(req as FPBluetoothPaymentRequest);
19
- Animated.spring(scale, { toValue: 1, useNativeDriver: true, tension: 80, friction: 10 }).start();
33
+ Animated.spring(scale, {
34
+ toValue: 1,
35
+ useNativeDriver: true,
36
+ tension: 80,
37
+ friction: 10,
38
+ }).start();
20
39
  });
21
40
  return unsub;
22
41
  }, []);
23
42
 
24
- const dismiss = () => { scale.setValue(0.85); setRequest(null); setLoading(false); };
43
+ const dismiss = () => {
44
+ scale.setValue(0.85);
45
+ setRequest(null);
46
+ setLoading(false);
47
+ };
48
+
49
+ const fullName = (): string => {
50
+ if (!request) return '';
51
+ return `${request.sender.firstName} ${request.sender.lastName}`;
52
+ };
25
53
 
26
54
  const handleAccept = async () => {
27
55
  if (!request) return;
@@ -39,10 +67,13 @@ export function FPPaymentRequestModal() {
39
67
 
40
68
  if (!request) return null;
41
69
 
42
-
43
70
  return (
44
71
  <Modal
45
- visible transparent animationType="slide" statusBarTranslucent onRequestClose={handleDecline}
72
+ visible
73
+ transparent
74
+ animationType="slide"
75
+ statusBarTranslucent
76
+ onRequestClose={handleDecline}
46
77
  >
47
78
  <View
48
79
  style={{
@@ -52,20 +83,18 @@ export function FPPaymentRequestModal() {
52
83
  alignItems: 'center',
53
84
  }}
54
85
  >
55
-
56
86
  <View
57
87
  style={{
58
- backgroundColor: '#fff',
59
88
  borderRadius: 20,
60
89
  padding: 30,
61
- width: '80%',
62
- maxWidth: 400,
63
90
  }}
64
91
  >
65
92
  <Animated.View style={[st.card, { transform: [{ scale }] }]}>
66
93
  <View style={st.avatar}>
67
94
  <Text style={st.avatarText}>
68
- {(request?.sender.name ?? request?.sender.deviceName ?? '?').charAt(0).toUpperCase()}
95
+ {(fullName() ?? request?.sender.deviceName ?? '?')
96
+ .charAt(0)
97
+ .toUpperCase()}
69
98
  </Text>
70
99
  </View>
71
100
  <Text style={st.headline}>Payment Request</Text>
@@ -89,10 +118,10 @@ export function FPPaymentRequestModal() {
89
118
  marginBottom: 20,
90
119
  }}
91
120
  >
92
- {request.sender.name ?? request.sender.deviceName ?? 'Someone'}
121
+ {fullName() ?? request.sender.deviceName ?? 'Someone'}
93
122
  </Text>
94
123
  <Text style={st.sub}>wants to send you</Text>
95
- {request.amount &&(
124
+ {request.amount && (
96
125
  <View
97
126
  style={{
98
127
  backgroundColor: '#f5f5f5',
@@ -101,7 +130,9 @@ export function FPPaymentRequestModal() {
101
130
  alignItems: 'center',
102
131
  }}
103
132
  >
104
- <Text style={{ fontSize: 16, color: '#666', marginBottom: 5 }}>
133
+ <Text
134
+ style={{ fontSize: 16, color: '#666', marginBottom: 5 }}
135
+ >
105
136
  Amount
106
137
  </Text>
107
138
  <Text
@@ -111,9 +142,10 @@ export function FPPaymentRequestModal() {
111
142
  color: '#4CAF50',
112
143
  }}
113
144
  >
114
- {request.currency}{request.amount.toFixed(2)}
145
+ {request.currency}
146
+ {request.amount.toFixed(2)}
115
147
  </Text>
116
- </View>
148
+ </View>
117
149
  )}
118
150
 
119
151
  {request.narration ? (
@@ -124,16 +156,28 @@ export function FPPaymentRequestModal() {
124
156
  ) : null}
125
157
  <Text style={st.disclaimer}>
126
158
  Accepting will receive into{'\n'}
127
- <Text style={{ fontWeight: '700' }}>{recipientAccount?.accountName}</Text> ({recipientAccount?.accountNumber})
159
+ <Text style={{ fontWeight: '700' }}>
160
+ {recipientAccount?.accountName}
161
+ </Text>{' '}
162
+ ({recipientAccount?.accountNumber})
128
163
  </Text>
129
164
  </View>
130
165
 
131
166
  <View style={st.btnRow}>
132
- <FPButton label="Decline" onPress={handleDecline} variant="outline" style={st.declineBtn} />
133
- <FPButton label="Accept" onPress={handleAccept} loading={loading} style={st.acceptBtn} />
167
+ <FPButton
168
+ label="Decline"
169
+ onPress={handleDecline}
170
+ variant="outline"
171
+ style={st.declineBtn}
172
+ />
173
+ <FPButton
174
+ label="Accept"
175
+ onPress={handleAccept}
176
+ loading={loading}
177
+ style={st.acceptBtn}
178
+ />
134
179
  </View>
135
180
  </Animated.View>
136
-
137
181
  </View>
138
182
  </View>
139
183
  </Modal>
@@ -141,18 +185,57 @@ export function FPPaymentRequestModal() {
141
185
  }
142
186
 
143
187
  const st = StyleSheet.create({
144
- scrim: { flex: 1, backgroundColor: 'rgba(11,29,53,0.6)', justifyContent: 'flex-end', padding: S.lg, paddingBottom: 48 },
145
- card: { backgroundColor: C.white, borderRadius: 28, padding: S.xl, alignItems: 'center', ...shadow.lg },
146
- avatar: { width: 72, height: 72, borderRadius: 36, backgroundColor: C.brandLight, justifyContent: 'center', alignItems: 'center', marginBottom: S.md },
188
+ scrim: {
189
+ flex: 1,
190
+ backgroundColor: 'rgba(11,29,53,0.6)',
191
+ justifyContent: 'flex-end',
192
+ padding: S.lg,
193
+ paddingBottom: 48,
194
+ },
195
+ card: {
196
+ backgroundColor: C.white,
197
+ borderRadius: 28,
198
+ padding: S.xl,
199
+ alignItems: 'center',
200
+ ...shadow.lg,
201
+ },
202
+ avatar: {
203
+ width: 72,
204
+ height: 72,
205
+ borderRadius: 36,
206
+ backgroundColor: C.brandLight,
207
+ justifyContent: 'center',
208
+ alignItems: 'center',
209
+ marginBottom: S.md,
210
+ },
147
211
  avatarText: { fontSize: 28, fontWeight: '800', color: C.brand },
148
- headline: { fontSize: F.sm, fontWeight: '700', color: C.muted, letterSpacing: 0.8, textTransform: 'uppercase', marginBottom: 4 },
212
+ headline: {
213
+ fontSize: F.sm,
214
+ fontWeight: '700',
215
+ color: C.muted,
216
+ letterSpacing: 0.8,
217
+ textTransform: 'uppercase',
218
+ marginBottom: 4,
219
+ },
149
220
  sender: { fontSize: F.xl, fontWeight: '800', color: C.ink },
150
221
  sub: { fontSize: F.md, color: C.muted, marginBottom: S.sm },
151
222
  amount: { fontSize: 40, fontWeight: '800', color: C.ink, marginBottom: S.md },
152
- noteBox: { backgroundColor: C.surface, borderRadius: R.md, padding: S.md, width: '100%', marginBottom: S.md },
223
+ noteBox: {
224
+ backgroundColor: C.surface,
225
+ borderRadius: R.md,
226
+ padding: S.md,
227
+ width: '100%',
228
+ marginBottom: S.md,
229
+ },
153
230
  noteLabel: { fontSize: F.xs, color: C.muted, marginBottom: 2 },
154
231
  note: { fontSize: F.md, color: C.ink },
155
- disclaimer: { fontSize: F.sm, color: C.muted, textAlign: 'center', lineHeight: 20, marginBottom: S.lg },
232
+ disclaimer: {
233
+ fontSize: F.sm,
234
+ color: C.muted,
235
+ textAlign: 'center',
236
+ lineHeight: 20,
237
+ marginBottom: S.lg,
238
+ },
156
239
  btnRow: { flexDirection: 'row', gap: S.sm, width: '100%' },
157
240
  declineBtn: { flex: 1 },
158
241
  acceptBtn: { flex: 1 },
@@ -5,7 +5,18 @@
5
5
  // renders the appropriate full-screen sheet.
6
6
  // ─────────────────────────────────────────────
7
7
  import React, { useEffect, useState, useRef } from 'react';
8
- import { Modal, View, Text, TouchableOpacity, StyleSheet, Animated, Dimensions, SafeAreaView, StatusBar, Platform } from 'react-native';
8
+ import {
9
+ Modal,
10
+ View,
11
+ Text,
12
+ TouchableOpacity,
13
+ StyleSheet,
14
+ Animated,
15
+ Dimensions,
16
+ SafeAreaView,
17
+ StatusBar,
18
+ Platform,
19
+ } from 'react-native';
9
20
  import { _onEvent } from '../../engine/FPEngine';
10
21
  import SendScreen from '../screens/SendScreen';
11
22
  import ReceiveScreen from '../screens/ReceiveScreen';
@@ -55,13 +66,28 @@ export function FPShell() {
55
66
  useEffect(() => {
56
67
  const unsubSend = _onEvent('show_send', (d: unknown) => {
57
68
  const data = d as any;
58
- open({ mode: 'send', user: data?.user, amount: data?.amount, currency: data?.currency });
69
+ open({
70
+ mode: 'send',
71
+ user: data?.user,
72
+ amount: data?.amount,
73
+ currency: data?.currency,
74
+ });
59
75
  });
60
76
  const unsubReceive = _onEvent('show_receive', (d: unknown) => {
61
77
  const data = d as any;
62
- open({ mode: 'receive', user: data?.user, amount: data?.amount, currency: data?.currency });
78
+ open({
79
+ mode: 'receive',
80
+ user: data?.user,
81
+ amount: data?.amount,
82
+ currency: data?.currency,
83
+ });
63
84
  });
64
- return () => { unsubSend(); unsubReceive(); };
85
+ const unsubClose = _onEvent('close_send', () => close());
86
+ return () => {
87
+ unsubSend();
88
+ unsubReceive();
89
+ unsubClose();
90
+ };
65
91
  }, []);
66
92
 
67
93
  return (
@@ -73,33 +99,33 @@ export function FPShell() {
73
99
  <Animated.View
74
100
  style={[st.fullscreen, { transform: [{ translateY: slide }] }]}
75
101
  >
76
- <View style={st.content}>
77
- {sheet.mode === 'send' && (
78
- <SendScreen
79
- user={FPEngine.getUser() ?? null}
80
- account={FPEngine.getAccount() ?? null}
81
- amount={sheet.amount ?? 0}
82
- currency={sheet.currency ?? 'NGN'}
83
- onClose={close}
84
- onPaymentSent={(tx) => {
85
- FPEngine.getCallbacks().onPaymentSent?.(tx);
86
- close();
87
- }}
88
- onError={FPEngine.getCallbacks().onError}
89
- />
90
- )}
91
- {sheet.mode === 'receive' && (
92
- <ReceiveScreen
93
- amount={sheet.amount}
94
- currency={sheet.currency}
95
- user={FPEngine.getUser() ?? null}
96
- account={FPEngine.getAccount() ?? null}
97
- onClose={close}
98
- onPaymentReceived={FPEngine.getCallbacks().onPaymentReceived}
99
- onError={FPEngine.getCallbacks().onError}
100
- />
101
- )}
102
- </View>
102
+ <View style={st.content}>
103
+ {sheet.mode === 'send' && (
104
+ <SendScreen
105
+ user={FPEngine.getUser() ?? null}
106
+ account={FPEngine.getAccount() ?? null}
107
+ amount={sheet.amount ?? 0}
108
+ currency={sheet.currency ?? 'NGN'}
109
+ onClose={close}
110
+ onPaymentSent={(tx) => {
111
+ FPEngine.getCallbacks().onPaymentSent?.(tx);
112
+ close();
113
+ }}
114
+ onError={FPEngine.getCallbacks().onError}
115
+ />
116
+ )}
117
+ {sheet.mode === 'receive' && (
118
+ <ReceiveScreen
119
+ amount={sheet.amount}
120
+ currency={sheet.currency}
121
+ user={FPEngine.getUser() ?? null}
122
+ account={FPEngine.getAccount() ?? null}
123
+ onClose={close}
124
+ onPaymentReceived={FPEngine.getCallbacks().onPaymentReceived}
125
+ onError={FPEngine.getCallbacks().onError}
126
+ />
127
+ )}
128
+ </View>
103
129
  </Animated.View>
104
130
  )}
105
131
  </>
@@ -126,7 +152,8 @@ const st = StyleSheet.create({
126
152
  alignItems: 'center',
127
153
  justifyContent: 'space-between',
128
154
  paddingHorizontal: S.lg,
129
- paddingTop: Platform.OS === 'android' ? (StatusBar.currentHeight ?? 0) + S.sm : S.md,
155
+ paddingTop:
156
+ Platform.OS === 'android' ? (StatusBar.currentHeight ?? 0) + S.sm : S.md,
130
157
  paddingBottom: S.md,
131
158
  backgroundColor: C.white,
132
159
  },
@@ -164,7 +191,7 @@ const st = StyleSheet.create({
164
191
  width: 8,
165
192
  height: 8,
166
193
  borderRadius: 4,
167
- marginRight: 14, // visually balances the close button width
194
+ marginRight: 14, // visually balances the close button width
168
195
  },
169
196
  divider: {
170
197
  height: 1,
@@ -176,4 +203,3 @@ const st = StyleSheet.create({
176
203
  backgroundColor: C.surface,
177
204
  },
178
205
  });
179
-