@jobber/components-native 0.45.0 → 0.45.1
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.
- package/dist/package.json +2 -2
- package/dist/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.js +3 -3
- package/dist/src/AutoLink/utils.js +14 -3
- package/dist/src/hooks/useAtlantisI18n/locales/en.json +4 -0
- package/dist/src/hooks/useAtlantisI18n/locales/es.json +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/AutoLink/utils.d.ts +2 -2
- package/dist/types/src/hooks/useAtlantisI18n/useAtlantisI18n.d.ts +2 -1
- package/package.json +2 -2
- package/src/AutoLink/AutoLink.test.tsx +3 -4
- package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +3 -3
- package/src/AutoLink/utils.ts +16 -5
- package/src/hooks/useAtlantisI18n/locales/en.json +4 -0
- package/src/hooks/useAtlantisI18n/locales/es.json +4 -0
- package/src/hooks/useAtlantisI18n/useAtlantisI18n.ts +3 -4
- package/dist/src/AutoLink/messages.js +0 -18
- package/dist/types/src/AutoLink/messages.d.ts +0 -17
- package/src/AutoLink/messages.ts +0 -19
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-native-reanimated": "^2.17.0",
|
|
85
85
|
"react-native-safe-area-context": "^4.5.2"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "8764198c93cfc2812f504b6f6509595ad6b3195c"
|
|
88
88
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
2
|
import { Platform } from "react-native";
|
|
4
3
|
import { onLongPressLink, onPressLink } from "../../utils";
|
|
5
4
|
import { Link } from "../Link/Link";
|
|
6
5
|
import { Text } from "../../../Text";
|
|
6
|
+
import { useAtlantisI18n } from "../../../hooks/useAtlantisI18n";
|
|
7
7
|
export function ComposeTextWithLinks({ part, index, match, bottomTabsVisible, selectable = true, }) {
|
|
8
|
-
const {
|
|
8
|
+
const { t } = useAtlantisI18n();
|
|
9
9
|
const isLink = match === null || match === void 0 ? void 0 : match.getType();
|
|
10
10
|
if (isLink) {
|
|
11
11
|
return (React.createElement(Link, { key: index, onPress: () => onPressLink(match), onLongPress: () => {
|
|
12
12
|
if (selectable && Platform.OS === "android") {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
onLongPressLink(match, bottomTabsVisible,
|
|
15
|
+
onLongPressLink(match, bottomTabsVisible, t);
|
|
16
16
|
} }, match.getAnchorText()));
|
|
17
17
|
}
|
|
18
18
|
return React.createElement(Text, { key: index }, part);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Linking } from "react-native";
|
|
2
|
-
import { messages } from "./messages";
|
|
3
2
|
import { copyTextToClipboard } from "./clipboard";
|
|
4
3
|
function hasPrefix(text, prefixes) {
|
|
5
4
|
return prefixes.some(prefix => text.includes(prefix));
|
|
@@ -31,10 +30,10 @@ export function getUrl(match, immediateOpen = true) {
|
|
|
31
30
|
return match.getAnchorHref();
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
|
-
export function onLongPressLink(match, bottomTabsVisible,
|
|
33
|
+
export function onLongPressLink(match, bottomTabsVisible, t) {
|
|
35
34
|
const linkUrl = getUrl(match, false);
|
|
36
35
|
const toastConfig = {
|
|
37
|
-
message:
|
|
36
|
+
message: t(getMessageKey(match)),
|
|
38
37
|
bottomTabsVisible,
|
|
39
38
|
};
|
|
40
39
|
copyTextToClipboard(linkUrl, toastConfig);
|
|
@@ -43,3 +42,15 @@ export function onPressLink(match) {
|
|
|
43
42
|
const linkUrl = getUrl(match);
|
|
44
43
|
Linking.openURL(linkUrl);
|
|
45
44
|
}
|
|
45
|
+
function getMessageKey(match) {
|
|
46
|
+
switch (match.getType()) {
|
|
47
|
+
case "email":
|
|
48
|
+
return "AutoLink.emailCopied";
|
|
49
|
+
case "phone":
|
|
50
|
+
return "AutoLink.phoneCopied";
|
|
51
|
+
case "url":
|
|
52
|
+
return "AutoLink.urlCopied";
|
|
53
|
+
default:
|
|
54
|
+
return "copied";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"AutoLink.emailCopied": "Correo electrónico copiado",
|
|
3
|
+
"AutoLink.phoneCopied": "Número de teléfono copiado",
|
|
4
|
+
"AutoLink.urlCopied": "URL copiada",
|
|
2
5
|
"cancel": "Cancelar",
|
|
3
6
|
"confirm": "Confirmar",
|
|
7
|
+
"copied": "Copiado",
|
|
4
8
|
"date": "Fecha",
|
|
5
9
|
"dismiss": "Descartar",
|
|
6
10
|
"done": "Listo",
|