From d8aed375922df750aa42e9b35749640a5c54eb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Bl=C3=A1zquez?= Date: Sat, 26 Aug 2023 21:37:39 +0200 Subject: [PATCH] copy to clipboard --- ios/Podfile.lock | 6 ++++ package.json | 1 + src/arena-mobile-ui/colors/index.js | 4 +++ .../Attributes/Coordinate/Preview/index.js | 4 +++ .../Attributes/common/Base/Preview/index.js | 14 ++++++++- .../Attributes/common/Base/Preview/styles.js | 3 +- .../common/CopyToClipboard/component.js | 31 +++++++++++++++++++ .../common/CopyToClipboard/index.js | 1 + .../common/CopyToClipboard/styles.js | 13 ++++++++ yarn.lock | 5 +++ 10 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/form/Attributes/common/CopyToClipboard/component.js create mode 100644 src/form/Attributes/common/CopyToClipboard/index.js create mode 100644 src/form/Attributes/common/CopyToClipboard/styles.js diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 0f86e87d..d840224d 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -380,6 +380,8 @@ PODS: - React-perflogger (= 0.69.9) - RNCAsyncStorage (1.18.2): - React-Core + - RNCClipboard (1.11.2): + - React-Core - RNCMaskedView (0.1.11): - React - RNCPicker (2.4.10): @@ -512,6 +514,7 @@ DEPENDENCIES: - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" + - "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)" - "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)" - "RNCPicker (from `../node_modules/@react-native-picker/picker`)" - RNDeviceInfo (from `../node_modules/react-native-device-info`) @@ -628,6 +631,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon" RNCAsyncStorage: :path: "../node_modules/@react-native-async-storage/async-storage" + RNCClipboard: + :path: "../node_modules/@react-native-clipboard/clipboard" RNCMaskedView: :path: "../node_modules/@react-native-community/masked-view" RNCPicker: @@ -710,6 +715,7 @@ SPEC CHECKSUMS: React-runtimeexecutor: df1518d092e8c74cafddc56690d1ac386ec24d7a ReactCommon: fac40473e2c4117522384027ab33ad0cb6717dc5 RNCAsyncStorage: ddc4ee162bfd41b0d2c68bf2d95acd81dd7f1f93 + RNCClipboard: 3f0451a8100393908bea5c5c5b16f96d45f30bfc RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489 RNCPicker: 0bc2f0a29abcca7b7ed44a2d036aac9ab6d25700 RNDeviceInfo: 475a4c447168d0ad4c807e48ef5e0963a0f4eb1b diff --git a/package.json b/package.json index 28d5ed30..682057a3 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@miblanchard/react-native-slider": "^2.3.1", "@openforis/arena-core": "0.0.162", "@react-native-async-storage/async-storage": "^1.18.2", + "@react-native-clipboard/clipboard": "^1.11.2", "@react-native-community/hooks": "^3.0.0", "@react-native-community/masked-view": "^0.1.11", "@react-native-picker/picker": "^2.4.10", diff --git a/src/arena-mobile-ui/colors/index.js b/src/arena-mobile-ui/colors/index.js index 209b93c9..4db96d14 100644 --- a/src/arena-mobile-ui/colors/index.js +++ b/src/arena-mobile-ui/colors/index.js @@ -126,10 +126,12 @@ export const primaryContrastTextLight = grey50; export const white = grey0; export const black = grey900; export const backgroundDarker = neutralDarker; +export const backgroundDark = neutralDark; export const background = neutralLightest; export const backgroundLight = white; export const backgroundLighter = neutralLighter; export const activeBackground = secondaryLightest; +export const disabledBackground = neutralDark; export const borderColor = neutralLight; export const borderColorContrast = neutralLightest; @@ -152,11 +154,13 @@ const DarkTheme = { // -- backgrounds backgroundDarker: neutralLighter, + backgroundDark: neutralLight, background: black, backgroundLight: neutralDark, backgroundLighter: neutralDarker, activeBackground: secondary, neutralLightest: neutralDarkest, + disabledBackground: neutralLight, borderColorContrast: neutralLighter, borderColor: neutralDarker, diff --git a/src/form/Attributes/Coordinate/Preview/index.js b/src/form/Attributes/Coordinate/Preview/index.js index 1b3ceb16..4f13ff99 100644 --- a/src/form/Attributes/Coordinate/Preview/index.js +++ b/src/form/Attributes/Coordinate/Preview/index.js @@ -26,6 +26,10 @@ const OpenInMap = ({nodeDef}) => { }); }; + if (!nodes[0]?.value?.x || !nodes[0]?.value?.y) { + return null; + } + return (