MCPcopy
hub / github.com/BlueWallet/BlueWallet / AddressInputScanButton

Function AddressInputScanButton

components/AddressInputScanButton.tsx:22–158  ·  view source on GitHub ↗
({
  isLoading,
  onChangeText,
  type = 'default',
  testID = 'BlueAddressInputScanQrButton',
  beforePress,
}: AddressInputScanButtonProps)

Source from the content-addressed store, hash-verified

20}
21
22export const AddressInputScanButton = ({
23 isLoading,
24 onChangeText,
25 type = 'default',
26 testID = 'BlueAddressInputScanQrButton',
27 beforePress,
28}: AddressInputScanButtonProps) => {
29 const { colors } = useTheme();
30 const { isClipboardGetContentEnabled } = useSettings();
31
32 const stylesHook = StyleSheet.create({
33 scan: {
34 backgroundColor: colors.scanLabel,
35 },
36 scanText: {
37 color: colors.inverseForegroundColor,
38 },
39 });
40
41 const toolTipOnPress = useCallback(async () => {
42 if (beforePress) {
43 await beforePress();
44 }
45 Keyboard.dismiss();
46 scanQrHelper().then(onChangeText);
47 }, [beforePress, onChangeText]);
48
49 const actions = useMemo(() => {
50 const availableActions = [
51 CommonToolTipActions.ChoosePhoto,
52 CommonToolTipActions.ImportFile,
53 {
54 ...CommonToolTipActions.PasteFromClipboard,
55 hidden: !isClipboardGetContentEnabled,
56 },
57 ];
58
59 return availableActions;
60 }, [isClipboardGetContentEnabled]);
61
62 const onMenuItemPressed = useCallback(
63 async (action: string) => {
64 switch (action) {
65 case CommonToolTipActions.PasteFromClipboard.id:
66 try {
67 let getImage: string | null = null;
68 let hasImage = false;
69 if (Platform.OS === 'android') {
70 hasImage = true;
71 } else {
72 hasImage = await Clipboard.hasImage();
73 }
74
75 if (hasImage) {
76 getImage = await Clipboard.getImage();
77 }
78
79 if (getImage) {

Callers

nothing calls this directly

Calls 7

useThemeFunction · 0.90
useSettingsFunction · 0.90
scanQrHelperFunction · 0.90
onChangeTextFunction · 0.85
getImageMethod · 0.80

Tested by

no test coverage detected