ferns-ui 0.2.4 → 0.3.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/Form.d.ts +1 -1
- package/dist/Hyperlink.d.ts +43 -0
- package/dist/Hyperlink.js +135 -0
- package/dist/Hyperlink.js.map +1 -0
- package/dist/SelectList.d.ts +1 -1
- package/dist/SelectList.js.map +1 -1
- package/dist/Text.js +2 -6
- package/dist/Text.js.map +1 -1
- package/dist/Unifier.js +4 -2
- package/dist/Unifier.js.map +1 -1
- package/package.json +5 -5
- package/src/Form.tsx +1 -1
- package/src/Hyperlink.tsx +181 -0
- package/src/SelectList.tsx +2 -1
- package/src/Text.tsx +4 -5
- package/src/Unifier.ts +4 -2
package/dist/Form.d.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @providesModule Hyperlink
|
|
3
|
+
*
|
|
4
|
+
* Forked from https://github.com/obipawan/react-native-hyperlink
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* MIT License
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2019 Pawan
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
* in the Software without restriction, including without limitation the rights
|
|
14
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
* furnished to do so, subject to the following conditions:
|
|
17
|
+
*
|
|
18
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
* copies or substantial portions of the Software.
|
|
20
|
+
*
|
|
21
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
* SOFTWARE.
|
|
28
|
+
* */
|
|
29
|
+
import React from "react";
|
|
30
|
+
import { StyleProp } from "react-native";
|
|
31
|
+
interface Props {
|
|
32
|
+
linkDefault?: boolean;
|
|
33
|
+
linkify?: any;
|
|
34
|
+
linkStyle?: StyleProp<any>;
|
|
35
|
+
linkText?: string | ((url: string) => string);
|
|
36
|
+
onPress?: (url: string) => void;
|
|
37
|
+
onLongPress?: (url: string, text: string) => void;
|
|
38
|
+
injectViewProps?: (url: string) => any;
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
style?: StyleProp<any>;
|
|
41
|
+
}
|
|
42
|
+
export declare function Hyperlink(props: Props): JSX.Element;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @providesModule Hyperlink
|
|
3
|
+
*
|
|
4
|
+
* Forked from https://github.com/obipawan/react-native-hyperlink
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* MIT License
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2019 Pawan
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
* in the Software without restriction, including without limitation the rights
|
|
14
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
* furnished to do so, subject to the following conditions:
|
|
17
|
+
*
|
|
18
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
* copies or substantial portions of the Software.
|
|
20
|
+
*
|
|
21
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
* SOFTWARE.
|
|
28
|
+
* */
|
|
29
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
30
|
+
var t = {};
|
|
31
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
+
t[p] = s[p];
|
|
33
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
+
t[p[i]] = s[p[i]];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
};
|
|
40
|
+
import mdurl from "mdurl";
|
|
41
|
+
import React from "react";
|
|
42
|
+
import { Linking, Platform, Text, View } from "react-native";
|
|
43
|
+
const linkifyLib = require("linkify-it")();
|
|
44
|
+
const { OS } = Platform;
|
|
45
|
+
// Leaving this as a class component because it was easier to handle the `pasrse(this)` in `render()`
|
|
46
|
+
class HyperlinkComponent extends React.Component {
|
|
47
|
+
constructor() {
|
|
48
|
+
super(...arguments);
|
|
49
|
+
this.isTextNested = (component) => {
|
|
50
|
+
if (!React.isValidElement(component))
|
|
51
|
+
throw new Error("Invalid component");
|
|
52
|
+
const { type: { displayName } = {} } = component;
|
|
53
|
+
if (displayName !== "Text")
|
|
54
|
+
throw new Error("Not a Text component");
|
|
55
|
+
return typeof component.props.children !== "string";
|
|
56
|
+
};
|
|
57
|
+
this.linkify = (component) => {
|
|
58
|
+
const linkifyIt = this.props.linkify || linkifyLib;
|
|
59
|
+
if (!linkifyIt.pretest(component.props.children) || !linkifyIt.test(component.props.children))
|
|
60
|
+
return component;
|
|
61
|
+
const elements = [];
|
|
62
|
+
let _lastIndex = 0;
|
|
63
|
+
const componentProps = Object.assign(Object.assign({}, component.props), { ref: undefined, key: undefined });
|
|
64
|
+
try {
|
|
65
|
+
linkifyIt.match(component.props.children).forEach(({ index, lastIndex, text, url }) => {
|
|
66
|
+
const nonLinkedText = component.props.children.substring(_lastIndex, index);
|
|
67
|
+
nonLinkedText && elements.push(nonLinkedText);
|
|
68
|
+
_lastIndex = lastIndex;
|
|
69
|
+
if (this.props.linkText)
|
|
70
|
+
text =
|
|
71
|
+
typeof this.props.linkText === "function"
|
|
72
|
+
? this.props.linkText(url)
|
|
73
|
+
: this.props.linkText;
|
|
74
|
+
const clickHandlerProps = {};
|
|
75
|
+
if (OS !== "web") {
|
|
76
|
+
if (this.props.onLongPress) {
|
|
77
|
+
clickHandlerProps.onLongPress = () => this.props.onLongPress(url, text);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (this.props.onPress) {
|
|
81
|
+
clickHandlerProps.onPress = () => this.props.onPress(url, text);
|
|
82
|
+
}
|
|
83
|
+
let injected = {};
|
|
84
|
+
if (this.props.injectViewProps) {
|
|
85
|
+
injected = this.props.injectViewProps(url);
|
|
86
|
+
}
|
|
87
|
+
elements.push(React.createElement(Text, Object.assign({}, componentProps, clickHandlerProps, { key: url + index, style: [component.props.style, this.props.linkStyle] }, injected), text));
|
|
88
|
+
});
|
|
89
|
+
elements.push(component.props.children.substring(_lastIndex, component.props.children.length));
|
|
90
|
+
return React.cloneElement(component, componentProps, elements);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
return component;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
this.parse = (component) => {
|
|
97
|
+
const { props: { children } = {} } = component || {};
|
|
98
|
+
if (!children)
|
|
99
|
+
return component;
|
|
100
|
+
const componentProps = Object.assign(Object.assign({}, component.props), { ref: undefined, key: undefined });
|
|
101
|
+
const linkifyIt = this.props.linkify || linkifyLib;
|
|
102
|
+
return React.cloneElement(component, componentProps, React.Children.map(children, (child) => {
|
|
103
|
+
const { type: { displayName } = {} } = child || {};
|
|
104
|
+
if (typeof child === "string" && linkifyIt.pretest(child))
|
|
105
|
+
return this.linkify(React.createElement(Text, Object.assign({}, componentProps, { style: component.props.style }), child));
|
|
106
|
+
if (displayName === "Text" && !this.isTextNested(child))
|
|
107
|
+
return this.linkify(child);
|
|
108
|
+
return this.parse(child);
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
const viewProps = __rest(this.props, []);
|
|
114
|
+
delete viewProps.onPress;
|
|
115
|
+
delete viewProps.linkDefault;
|
|
116
|
+
delete viewProps.onLongPress;
|
|
117
|
+
delete viewProps.linkStyle;
|
|
118
|
+
return (React.createElement(View, Object.assign({}, viewProps, { style: this.props.style }), !this.props.onPress && !this.props.onLongPress && !this.props.linkStyle
|
|
119
|
+
? this.props.children
|
|
120
|
+
: this.parse(this).props.children));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export function Hyperlink(props) {
|
|
124
|
+
const handleLink = (url) => {
|
|
125
|
+
const urlObject = mdurl.parse(url);
|
|
126
|
+
urlObject.protocol = urlObject.protocol.toLowerCase();
|
|
127
|
+
const normalizedURL = mdurl.format(urlObject);
|
|
128
|
+
Linking.canOpenURL(normalizedURL).then((supported) => supported && Linking.openURL(normalizedURL));
|
|
129
|
+
};
|
|
130
|
+
const onPress = handleLink || props.onPress;
|
|
131
|
+
if (props.linkDefault)
|
|
132
|
+
return React.createElement(HyperlinkComponent, Object.assign({}, props, { onPress: onPress }));
|
|
133
|
+
return React.createElement(HyperlinkComponent, Object.assign({}, props));
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=Hyperlink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hyperlink.js","sourceRoot":"","sources":["../src/Hyperlink.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BK;;;;;;;;;;;;AAEL,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAa,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAEtE,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;AAE3C,MAAM,EAAC,EAAE,EAAC,GAAG,QAAQ,CAAC;AActB,qGAAqG;AACrG,MAAM,kBAAmB,SAAQ,KAAK,CAAC,SAAgB;IAAvD;;QACE,iBAAY,GAAG,CAAC,SAAc,EAAE,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC3E,MAAM,EAAC,IAAI,EAAE,EAAC,WAAW,EAAC,GAAG,EAAS,EAAC,GAAG,SAAS,CAAC;YACpD,IAAI,WAAW,KAAK,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YACpE,OAAO,OAAQ,SAAS,CAAC,KAAa,CAAC,QAAQ,KAAK,QAAQ,CAAC;QAC/D,CAAC,CAAC;QAEF,YAAO,GAAG,CAAC,SAAc,EAAE,EAAE;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OA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AC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ;YACrB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAC9B,CACR,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CAAC,KAAY;IACpC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;QACjC,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACtD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAE9C,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,IAAI,CACpC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAC3D,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC;IAC5C,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,oBAAC,kBAAkB,oBAAK,KAAK,IAAE,OAAO,EAAE,OAAO,IAAI,CAAC;IAClF,OAAO,oBAAC,kBAAkB,oBAAK,KAAK,EAAI,CAAC;AAC3C,CAAC"}
|
package/dist/SelectList.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { FieldWithLabelsProps } from "./Common";
|
|
3
3
|
export declare type SelectListOptions = {
|
|
4
4
|
label: string;
|
|
5
|
-
value: string | number
|
|
5
|
+
value: string | number;
|
|
6
6
|
}[];
|
|
7
7
|
export interface SelectListProps extends FieldWithLabelsProps {
|
|
8
8
|
id?: string;
|
package/dist/SelectList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectList.js","sourceRoot":"","sources":["../src/SelectList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectList.js","sourceRoot":"","sources":["../src/SelectList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAelC,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAA8B;IAApE;;QACE,UAAK,GAAG,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC;IA4B3B,CAAC;IA1BC,MAAM;QACJ,OAAO,CACL,oBAAC,cAAc,IACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EACzB,WAAW,EAAE,EAAE,EACf,KAAK,EAAE;gBACL,aAAa,EAAE;oBACb,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,QAAQ;oBACxB,UAAU,EAAE,QAAQ;oBACpB,SAAS,EAAE,EAAE;oBACb,KAAK,EAAE,MAAM;oBACb,oDAAoD;oBACpD,iBAAiB,EAAE,CAAC;oBACpB,eAAe,EAAE,CAAC;oBAClB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;oBAC/B,WAAW,EAAE,CAAC;oBACd,YAAY,EAAE,CAAC;oBACf,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;iBACrC;aACF,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAClC,CACH,CAAC;IACJ,CAAC;CACF"}
|
package/dist/Text.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text as NativeText } from "react-native";
|
|
3
|
-
import Hyperlink from "
|
|
3
|
+
import { Hyperlink } from "./Hyperlink";
|
|
4
4
|
import { Unifier } from "./Unifier";
|
|
5
5
|
export class Text extends React.Component {
|
|
6
6
|
constructor() {
|
|
@@ -74,11 +74,7 @@ export class Text extends React.Component {
|
|
|
74
74
|
return inner;
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
return (
|
|
78
|
-
// <Hyperlink linkDefault={true} linkStyle={{textDecorationLine: "underline"}}>
|
|
79
|
-
// {inner}
|
|
80
|
-
// </Hyperlink>
|
|
81
|
-
React.createElement(Hyperlink, { linkDefault: true }, inner));
|
|
77
|
+
return (React.createElement(Hyperlink, { linkDefault: true, linkStyle: { textDecorationLine: "underline" } }, inner));
|
|
82
78
|
}
|
|
83
79
|
}
|
|
84
80
|
}
|
package/dist/Text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,OAAO,IAAK,SAAQ,KAAK,CAAC,SAAwB;IAAxD;;QACE,cAAS,GAAG;YACV,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;YACN,EAAE,EAAE,EAAE;SACP,CAAC;IA8EJ,CAAC;IA5EC,YAAY;QACV,MAAM,KAAK,GAAQ,EAAE,CAAC;QAEtB,IAAI,IAAI,GAQU,aAAa,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,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CAAC;SAC/C;aAAM;YACL,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;SACtC;QACD,gDAAgD;QAChD,8DAA8D;QAC9D,6BAA6B;QAC7B,IAAI;QACJ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM;QACJ,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YAC5B,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;SAClC;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC5B,KAAK,GAAG,CAAC,CAAC;SACX;QACD,MAAM,KAAK,GAAG,CACZ,oBAAC,UAAU,IAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,IACzD,IAAI,CAAC,KAAK,CAAC,QAAQ,CACT,CACd,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC1B,OAAO,KAAK,CAAC;SACd;aAAM;YACL,OAAO,CACL,oBAAC,SAAS,IAAC,WAAW,QAAC,SAAS,EAAE,EAAC,kBAAkB,EAAE,WAAW,EAAC,IAChE,KAAK,CACI,CACb,CAAC;SACH;IACH,CAAC;CACF"}
|
package/dist/Unifier.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
3
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4
|
-
import { Clipboard, Dimensions, Keyboard, Linking, Vibration } from "react-native";
|
|
4
|
+
import { Clipboard, Dimensions, Keyboard, Linking, Platform, Vibration } from "react-native";
|
|
5
5
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
6
|
import { requestPermissions } from "./Permissions";
|
|
7
7
|
const DEFAULT_FONT = "Cochin";
|
|
@@ -121,7 +121,9 @@ class UnifierClass {
|
|
|
121
121
|
enableVibrateFallback: true,
|
|
122
122
|
ignoreAndroidSystemSettings: false,
|
|
123
123
|
};
|
|
124
|
-
|
|
124
|
+
if (Platform.OS !== "web") {
|
|
125
|
+
ReactNativeHapticFeedback.trigger("impactLight", options);
|
|
126
|
+
}
|
|
125
127
|
},
|
|
126
128
|
openUrl: async (url) => {
|
|
127
129
|
return Linking.openURL(url);
|
package/dist/Unifier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unifier.js","sourceRoot":"","sources":["../src/Unifier.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AAEzD,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Unifier.js","sourceRoot":"","sources":["../src/Unifier.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AAEzD,OAAO,YAAY,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAC3F,OAAO,yBAAyB,MAAM,8BAA8B,CAAC;AAGrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC,MAAM,YAAY,GAAiB;IACjC,iBAAiB;IACjB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,MAAM;IAChB,mBAAmB;IACnB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB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o/vector-icons": "^13.0.0",
|
|
123
123
|
"@react-native-async-storage/async-storage": "^1.17.4",
|
|
124
124
|
"@react-native-community/blur": "^3.6.0",
|
|
125
|
-
"@react-native-community/datetimepicker": "^
|
|
125
|
+
"@react-native-community/datetimepicker": "^5.1.0",
|
|
126
126
|
"@react-native-picker/picker": "^2.2.1",
|
|
127
127
|
"@sentry/browser": "^6.19.7",
|
|
128
128
|
"@sentry/react": "^6.19.7",
|
|
129
129
|
"@sentry/react-native": "^3.4.2",
|
|
130
130
|
"@types/lodash": "^4.14.182",
|
|
131
|
+
"@types/mdurl": "^1.0.2",
|
|
131
132
|
"@types/react-native": "^0.67.7",
|
|
132
133
|
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
|
133
134
|
"@typescript-eslint/parser": "^5.23.0",
|
|
134
135
|
"eslint": "^8.15.0",
|
|
135
|
-
"eslint-config-ferns": "^0.3.
|
|
136
|
+
"eslint-config-ferns": "^0.3.2",
|
|
136
137
|
"eslint-config-prettier": "^8.5.0",
|
|
137
138
|
"eslint-plugin-import": "^2.26.0",
|
|
138
139
|
"eslint-plugin-lodash": "^7.1.0",
|
|
139
140
|
"eslint-plugin-prettier": "^4.0.0",
|
|
140
141
|
"eslint-plugin-react": "^7.29.4",
|
|
142
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
141
143
|
"eslint-plugin-react-native": "^4.0.0",
|
|
142
144
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
143
145
|
"expo-font": "^10.1.0",
|
|
@@ -153,7 +155,6 @@
|
|
|
153
155
|
"react-native": "^0.64.3",
|
|
154
156
|
"react-native-gesture-handler": "^1.6.1",
|
|
155
157
|
"react-native-haptic-feedback": "^1.10.0",
|
|
156
|
-
"react-native-hyperlink": "^0.0.19",
|
|
157
158
|
"react-native-modalize": "^2.0.12",
|
|
158
159
|
"react-native-navigation": "^6.12.0",
|
|
159
160
|
"react-native-permissions": "^3.1.0",
|
|
@@ -185,7 +186,6 @@
|
|
|
185
186
|
"react-native": "^0.64.3",
|
|
186
187
|
"react-native-gesture-handler": "^1.6.1",
|
|
187
188
|
"react-native-haptic-feedback": "^1.10.0",
|
|
188
|
-
"react-native-hyperlink": "^0.0.19",
|
|
189
189
|
"react-native-modalize": "^2.0.12",
|
|
190
190
|
"react-native-navigation": "^6.12.0",
|
|
191
191
|
"react-native-permissions": "^3.1.0",
|
package/src/Form.tsx
CHANGED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @providesModule Hyperlink
|
|
3
|
+
*
|
|
4
|
+
* Forked from https://github.com/obipawan/react-native-hyperlink
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* MIT License
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2019 Pawan
|
|
10
|
+
*
|
|
11
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
* in the Software without restriction, including without limitation the rights
|
|
14
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
* furnished to do so, subject to the following conditions:
|
|
17
|
+
*
|
|
18
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
* copies or substantial portions of the Software.
|
|
20
|
+
*
|
|
21
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
* SOFTWARE.
|
|
28
|
+
* */
|
|
29
|
+
|
|
30
|
+
import mdurl from "mdurl";
|
|
31
|
+
import React from "react";
|
|
32
|
+
import {Linking, Platform, StyleProp, Text, View} from "react-native";
|
|
33
|
+
|
|
34
|
+
const linkifyLib = require("linkify-it")();
|
|
35
|
+
|
|
36
|
+
const {OS} = Platform;
|
|
37
|
+
|
|
38
|
+
interface Props {
|
|
39
|
+
linkDefault?: boolean;
|
|
40
|
+
linkify?: any;
|
|
41
|
+
linkStyle?: StyleProp<any>;
|
|
42
|
+
linkText?: string | ((url: string) => string);
|
|
43
|
+
onPress?: (url: string) => void;
|
|
44
|
+
onLongPress?: (url: string, text: string) => void;
|
|
45
|
+
injectViewProps?: (url: string) => any;
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
style?: StyleProp<any>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Leaving this as a class component because it was easier to handle the `pasrse(this)` in `render()`
|
|
51
|
+
class HyperlinkComponent extends React.Component<Props> {
|
|
52
|
+
isTextNested = (component: any) => {
|
|
53
|
+
if (!React.isValidElement(component)) throw new Error("Invalid component");
|
|
54
|
+
const {type: {displayName} = {} as any} = component;
|
|
55
|
+
if (displayName !== "Text") throw new Error("Not a Text component");
|
|
56
|
+
return typeof (component.props as any).children !== "string";
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
linkify = (component: any) => {
|
|
60
|
+
const linkifyIt = this.props.linkify || linkifyLib;
|
|
61
|
+
|
|
62
|
+
if (!linkifyIt.pretest(component.props.children) || !linkifyIt.test(component.props.children))
|
|
63
|
+
return component;
|
|
64
|
+
|
|
65
|
+
const elements = [];
|
|
66
|
+
let _lastIndex = 0;
|
|
67
|
+
|
|
68
|
+
const componentProps = {
|
|
69
|
+
...component.props,
|
|
70
|
+
ref: undefined,
|
|
71
|
+
key: undefined,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
linkifyIt.match(component.props.children).forEach(({index, lastIndex, text, url}: any) => {
|
|
76
|
+
const nonLinkedText = component.props.children.substring(_lastIndex, index);
|
|
77
|
+
nonLinkedText && elements.push(nonLinkedText);
|
|
78
|
+
_lastIndex = lastIndex;
|
|
79
|
+
if (this.props.linkText)
|
|
80
|
+
text =
|
|
81
|
+
typeof this.props.linkText === "function"
|
|
82
|
+
? this.props.linkText(url)
|
|
83
|
+
: this.props.linkText;
|
|
84
|
+
|
|
85
|
+
const clickHandlerProps: any = {};
|
|
86
|
+
if (OS !== "web") {
|
|
87
|
+
if (this.props.onLongPress) {
|
|
88
|
+
clickHandlerProps.onLongPress = () => (this.props as any).onLongPress(url, text);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (this.props.onPress) {
|
|
92
|
+
clickHandlerProps.onPress = () => (this.props as any).onPress(url, text);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let injected: any = {};
|
|
96
|
+
if (this.props.injectViewProps) {
|
|
97
|
+
injected = this.props.injectViewProps(url);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
elements.push(
|
|
101
|
+
<Text
|
|
102
|
+
{...componentProps}
|
|
103
|
+
{...clickHandlerProps}
|
|
104
|
+
key={url + index}
|
|
105
|
+
style={[component.props.style, this.props.linkStyle]}
|
|
106
|
+
{...injected}
|
|
107
|
+
>
|
|
108
|
+
{text}
|
|
109
|
+
</Text>
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
elements.push(
|
|
113
|
+
component.props.children.substring(_lastIndex, component.props.children.length)
|
|
114
|
+
);
|
|
115
|
+
return React.cloneElement(component, componentProps, elements);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
return component;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
parse = (component: any): React.ReactElement => {
|
|
122
|
+
const {props: {children} = {} as any} = component || {};
|
|
123
|
+
if (!children) return component;
|
|
124
|
+
|
|
125
|
+
const componentProps = {
|
|
126
|
+
...component.props,
|
|
127
|
+
ref: undefined,
|
|
128
|
+
key: undefined,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const linkifyIt = this.props.linkify || linkifyLib;
|
|
132
|
+
|
|
133
|
+
return React.cloneElement(
|
|
134
|
+
component,
|
|
135
|
+
componentProps,
|
|
136
|
+
React.Children.map(children, (child) => {
|
|
137
|
+
const {type: {displayName} = {} as any} = child || {};
|
|
138
|
+
if (typeof child === "string" && linkifyIt.pretest(child))
|
|
139
|
+
return this.linkify(
|
|
140
|
+
<Text {...componentProps} style={component.props.style}>
|
|
141
|
+
{child}
|
|
142
|
+
</Text>
|
|
143
|
+
);
|
|
144
|
+
if (displayName === "Text" && !this.isTextNested(child)) return this.linkify(child);
|
|
145
|
+
return this.parse(child);
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
render() {
|
|
151
|
+
const {...viewProps} = this.props;
|
|
152
|
+
delete viewProps.onPress;
|
|
153
|
+
delete viewProps.linkDefault;
|
|
154
|
+
delete viewProps.onLongPress;
|
|
155
|
+
delete viewProps.linkStyle;
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<View {...viewProps} style={this.props.style}>
|
|
159
|
+
{!this.props.onPress && !this.props.onLongPress && !this.props.linkStyle
|
|
160
|
+
? this.props.children
|
|
161
|
+
: this.parse(this).props.children}
|
|
162
|
+
</View>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function Hyperlink(props: Props) {
|
|
168
|
+
const handleLink = (url: string) => {
|
|
169
|
+
const urlObject = mdurl.parse(url);
|
|
170
|
+
urlObject.protocol = urlObject.protocol.toLowerCase();
|
|
171
|
+
const normalizedURL = mdurl.format(urlObject);
|
|
172
|
+
|
|
173
|
+
Linking.canOpenURL(normalizedURL).then(
|
|
174
|
+
(supported) => supported && Linking.openURL(normalizedURL)
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const onPress = handleLink || props.onPress;
|
|
179
|
+
if (props.linkDefault) return <HyperlinkComponent {...props} onPress={onPress} />;
|
|
180
|
+
return <HyperlinkComponent {...props} />;
|
|
181
|
+
}
|
package/src/SelectList.tsx
CHANGED
|
@@ -4,7 +4,8 @@ import {FieldWithLabelsProps} from "./Common";
|
|
|
4
4
|
import RNPickerSelect from "./PickerSelect";
|
|
5
5
|
import {Unifier} from "./Unifier";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// Use "" if you want to have an "unset" value.
|
|
8
|
+
export type SelectListOptions = {label: string; value: string | number}[];
|
|
8
9
|
export interface SelectListProps extends FieldWithLabelsProps {
|
|
9
10
|
id?: string;
|
|
10
11
|
name?: string;
|
package/src/Text.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Text as NativeText} from "react-native";
|
|
3
|
-
import Hyperlink from "react-native-hyperlink";
|
|
4
3
|
|
|
5
4
|
import {TextProps} from "./Common";
|
|
5
|
+
import {Hyperlink} from "./Hyperlink";
|
|
6
6
|
import {Unifier} from "./Unifier";
|
|
7
7
|
|
|
8
8
|
export class Text extends React.Component<TextProps, {}> {
|
|
@@ -82,10 +82,9 @@ export class Text extends React.Component<TextProps, {}> {
|
|
|
82
82
|
return inner;
|
|
83
83
|
} else {
|
|
84
84
|
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<Hyperlink linkDefault>{inner}</Hyperlink>
|
|
85
|
+
<Hyperlink linkDefault linkStyle={{textDecorationLine: "underline"}}>
|
|
86
|
+
{inner}
|
|
87
|
+
</Hyperlink>
|
|
89
88
|
);
|
|
90
89
|
}
|
|
91
90
|
}
|
package/src/Unifier.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
3
3
|
|
|
4
4
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
5
|
-
import {Clipboard, Dimensions, Keyboard, Linking, Vibration} from "react-native";
|
|
5
|
+
import {Clipboard, Dimensions, Keyboard, Linking, Platform, Vibration} from "react-native";
|
|
6
6
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
7
7
|
|
|
8
8
|
import {PermissionKind, UnifiedTheme} from "./Common";
|
|
@@ -206,7 +206,9 @@ class UnifierClass {
|
|
|
206
206
|
enableVibrateFallback: true,
|
|
207
207
|
ignoreAndroidSystemSettings: false,
|
|
208
208
|
};
|
|
209
|
-
|
|
209
|
+
if (Platform.OS !== "web") {
|
|
210
|
+
ReactNativeHapticFeedback.trigger("impactLight", options);
|
|
211
|
+
}
|
|
210
212
|
},
|
|
211
213
|
openUrl: async (url: string) => {
|
|
212
214
|
return Linking.openURL(url);
|