ferns-ui 0.6.3 → 0.6.4
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/ErrorBoundary.js +0 -2
- package/dist/ErrorBoundary.js.map +1 -1
- package/dist/ErrorPage.js +1 -1
- package/dist/ErrorPage.js.map +1 -1
- package/dist/Spinner.d.ts +2 -20
- package/dist/Spinner.js +14 -56
- package/dist/Spinner.js.map +1 -1
- package/package.json +1 -7
- package/src/ErrorBoundary.tsx +0 -2
- package/src/ErrorPage.tsx +2 -2
- package/src/Spinner.tsx +13 -62
package/dist/ErrorBoundary.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/react-native";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { ErrorPage } from "./ErrorPage";
|
|
4
3
|
export class ErrorBoundary extends React.Component {
|
|
@@ -15,7 +14,6 @@ export class ErrorBoundary extends React.Component {
|
|
|
15
14
|
}
|
|
16
15
|
componentDidCatch(error, info) {
|
|
17
16
|
console.warn("[ErrorBoundary] Caught error", error);
|
|
18
|
-
Sentry.captureException(error);
|
|
19
17
|
if (this.props.onError) {
|
|
20
18
|
this.props.onError(error, info.componentStack);
|
|
21
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../src/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../src/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAMtC,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAoC;IAA7E;;QACE,UAAK,GAAG,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC;QAe3B,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,CAAC,QAAQ,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC;QACpC,CAAC,CAAC;IASJ,CAAC;IAxBC,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,EAAC,KAAK,EAAC,CAAC;IACjB,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,IAA8B;QAC5D,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SAChD;IACH,CAAC;IAMD,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC/B,IAAI,KAAK,EAAE;YACT,OAAO,oBAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,GAAI,CAAC;SACjE;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/ErrorPage.js
CHANGED
|
@@ -11,7 +11,7 @@ export class ErrorPage extends React.Component {
|
|
|
11
11
|
return (React.createElement(Box, { alignItems: "center", direction: "column", display: "flex", height: "100%", justifyContent: "center", padding: 6, width: "100%" },
|
|
12
12
|
React.createElement(Text, { align: "center", color: "red", size: "lg", weight: "bold" }, "Oops!"),
|
|
13
13
|
React.createElement(Box, { paddingY: 3 },
|
|
14
|
-
React.createElement(Text, { align: "center" }, "There's an error. Sorry!
|
|
14
|
+
React.createElement(Text, { align: "center" }, "There's an error. Sorry! Our team just got a notification about the error so they can fix it as soon as possible!")),
|
|
15
15
|
React.createElement(Box, { paddingY: 3 },
|
|
16
16
|
React.createElement(Text, null, this.props.error.toString())),
|
|
17
17
|
React.createElement(Button, { color: "blue", text: "Try again", onClick: this.props.resetError })));
|
package/dist/ErrorPage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../src/ErrorPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAM5B,MAAM,OAAO,SAAU,SAAQ,KAAK,CAAC,SAA6B;IAChE,YAAY,KAAqB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,oBAAC,GAAG,IACF,UAAU,EAAC,QAAQ,EACnB,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAC,MAAM,EACd,MAAM,EAAC,MAAM,EACb,cAAc,EAAC,QAAQ,EACvB,OAAO,EAAE,CAAC,EACV,KAAK,EAAC,MAAM;YAEZ,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,YAEjD;YACP,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;gBACd,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"ErrorPage.js","sourceRoot":"","sources":["../src/ErrorPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAM5B,MAAM,OAAO,SAAU,SAAQ,KAAK,CAAC,SAA6B;IAChE,YAAY,KAAqB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,oBAAC,GAAG,IACF,UAAU,EAAC,QAAQ,EACnB,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAC,MAAM,EACd,MAAM,EAAC,MAAM,EACb,cAAc,EAAC,QAAQ,EACvB,OAAO,EAAE,CAAC,EACV,KAAK,EAAC,MAAM;YAEZ,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,YAEjD;YACP,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;gBACd,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,wHAGb,CACH;YACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;gBACd,oBAAC,IAAI,QAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAQ,CACtC;YACN,oBAAC,MAAM,IAAC,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GAAI,CACpE,CACP,CAAC;IACJ,CAAC;CACF"}
|
package/dist/Spinner.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
2
|
import { SpinnerProps } from "./Common";
|
|
3
|
-
export declare
|
|
4
|
-
componentId?: string;
|
|
5
|
-
showHide(): Promise<void>;
|
|
6
|
-
componentDidMount(): void;
|
|
7
|
-
componentDidUpdate(): void;
|
|
8
|
-
componentWillUnmount(): void;
|
|
9
|
-
render(): JSX.Element;
|
|
10
|
-
}
|
|
11
|
-
interface SpinnerState {
|
|
12
|
-
show: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare class Spinner extends React.Component<SpinnerProps, SpinnerState> {
|
|
15
|
-
state: {
|
|
16
|
-
show: boolean;
|
|
17
|
-
};
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
render(): JSX.Element | null;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
3
|
+
export declare function Spinner({ size, color }: SpinnerProps): ReactElement | null;
|
package/dist/Spinner.js
CHANGED
|
@@ -1,58 +1,16 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ActivityIndicator
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
console.debug(`[spinner] could not dismiss spinner overlay`, e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
componentDidMount() {
|
|
20
|
-
this.showHide();
|
|
21
|
-
}
|
|
22
|
-
componentDidUpdate() {
|
|
23
|
-
this.showHide();
|
|
24
|
-
}
|
|
25
|
-
componentWillUnmount() {
|
|
26
|
-
this.showHide();
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
return (React.createElement(View, { style: {
|
|
30
|
-
width: "100%",
|
|
31
|
-
height: "100%",
|
|
32
|
-
flex: 1,
|
|
33
|
-
justifyContent: "center",
|
|
34
|
-
alignItems: "center",
|
|
35
|
-
backgroundColor: Unifier.theme.white,
|
|
36
|
-
opacity: 0.5,
|
|
37
|
-
} },
|
|
38
|
-
React.createElement(Spinner, null)));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export class Spinner extends React.Component {
|
|
42
|
-
constructor() {
|
|
43
|
-
super(...arguments);
|
|
44
|
-
this.state = { show: false };
|
|
45
|
-
}
|
|
46
|
-
// The delay is for perceived performance so you should rarely need to remove it.
|
|
47
|
-
componentDidMount() {
|
|
48
|
-
setTimeout(() => this.setState({ show: true }), 300);
|
|
49
|
-
}
|
|
50
|
-
render() {
|
|
51
|
-
if (!this.state.show) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
const size = this.props.size === "sm" ? "small" : "large";
|
|
55
|
-
return React.createElement(ActivityIndicator, { color: this.props.color || "darkGray", size: size });
|
|
56
|
-
}
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { ActivityIndicator } from "react-native";
|
|
3
|
+
export function Spinner({ size, color }) {
|
|
4
|
+
const [show, setShow] = useState(false);
|
|
5
|
+
// The delay is for perceived performance. You don't want to show a spinner when you're doing a quick action.
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const timer = setTimeout(() => setShow(true), 300);
|
|
8
|
+
return () => clearTimeout(timer);
|
|
9
|
+
}, []);
|
|
10
|
+
if (!show) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const spinnerSize = size === "sm" ? "small" : "large";
|
|
14
|
+
return React.createElement(ActivityIndicator, { color: color || "darkGray", size: spinnerSize });
|
|
57
15
|
}
|
|
58
16
|
//# sourceMappingURL=Spinner.js.map
|
package/dist/Spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../src/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAe,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAI/C,MAAM,UAAU,OAAO,CAAC,EAAC,IAAI,EAAE,KAAK,EAAe;IACjD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,6GAA6G;IAC7G,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IACD,MAAM,WAAW,GAAsB,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACzE,OAAO,oBAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,IAAI,EAAE,WAAW,GAAI,CAAC;AAC9E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferns-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
@@ -125,9 +125,6 @@
|
|
|
125
125
|
"@react-native-community/blur": "^3.6.0",
|
|
126
126
|
"@react-native-community/datetimepicker": "^6.2.0",
|
|
127
127
|
"@react-native-picker/picker": "2.4.2",
|
|
128
|
-
"@sentry/browser": "^7.3.1",
|
|
129
|
-
"@sentry/react": "^7.3.1",
|
|
130
|
-
"@sentry/react-native": "^4.1.0",
|
|
131
128
|
"@types/lodash": "^4.14.182",
|
|
132
129
|
"@types/mdurl": "^1.0.2",
|
|
133
130
|
"@types/react-native": "^0.69.1",
|
|
@@ -172,9 +169,6 @@
|
|
|
172
169
|
"@react-native-community/blur": "^3.6.0",
|
|
173
170
|
"@react-native-community/datetimepicker": "^6.2.0",
|
|
174
171
|
"@react-native-picker/picker": "2.4.2",
|
|
175
|
-
"@sentry/browser": "^7.3.1",
|
|
176
|
-
"@sentry/react": "^7.3.1",
|
|
177
|
-
"@sentry/react-native": "^4.1.0",
|
|
178
172
|
"expo-font": "^10.0.5",
|
|
179
173
|
"expo-haptics": "~11.2.0",
|
|
180
174
|
"lodash": "^4.17.21",
|
package/src/ErrorBoundary.tsx
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/react-native";
|
|
2
1
|
import React from "react";
|
|
3
2
|
|
|
4
3
|
import {ErrorBoundaryProps} from "./Common";
|
|
@@ -18,7 +17,6 @@ export class ErrorBoundary extends React.Component<ErrorBoundaryProps, State> {
|
|
|
18
17
|
|
|
19
18
|
componentDidCatch(error: Error, info: {componentStack: string}) {
|
|
20
19
|
console.warn("[ErrorBoundary] Caught error", error);
|
|
21
|
-
Sentry.captureException(error);
|
|
22
20
|
|
|
23
21
|
if (this.props.onError) {
|
|
24
22
|
this.props.onError(error, info.componentStack);
|
package/src/ErrorPage.tsx
CHANGED
|
@@ -30,8 +30,8 @@ export class ErrorPage extends React.Component<ErrorPageProps, {}> {
|
|
|
30
30
|
</Text>
|
|
31
31
|
<Box paddingY={3}>
|
|
32
32
|
<Text align="center">
|
|
33
|
-
There's an error. Sorry!
|
|
34
|
-
it as soon as possible!
|
|
33
|
+
There's an error. Sorry! Our team just got a notification about the error so they
|
|
34
|
+
can fix it as soon as possible!
|
|
35
35
|
</Text>
|
|
36
36
|
</Box>
|
|
37
37
|
<Box paddingY={3}>
|
package/src/Spinner.tsx
CHANGED
|
@@ -1,69 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {ActivityIndicator
|
|
1
|
+
import React, {ReactElement, useEffect, useState} from "react";
|
|
2
|
+
import {ActivityIndicator} from "react-native";
|
|
3
3
|
|
|
4
4
|
import {SpinnerProps} from "./Common";
|
|
5
|
-
import {Unifier} from "./Unifier";
|
|
6
5
|
|
|
7
|
-
export
|
|
8
|
-
|
|
6
|
+
export function Spinner({size, color}: SpinnerProps): ReactElement | null {
|
|
7
|
+
const [show, setShow] = useState(false);
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
console.debug(`[spinner] could not dismiss spinner overlay`, e);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
componentDidMount() {
|
|
21
|
-
this.showHide();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentDidUpdate() {
|
|
25
|
-
this.showHide();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
componentWillUnmount() {
|
|
29
|
-
this.showHide();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
return (
|
|
34
|
-
<View
|
|
35
|
-
style={{
|
|
36
|
-
width: "100%",
|
|
37
|
-
height: "100%",
|
|
38
|
-
flex: 1,
|
|
39
|
-
justifyContent: "center",
|
|
40
|
-
alignItems: "center",
|
|
41
|
-
backgroundColor: Unifier.theme.white,
|
|
42
|
-
opacity: 0.5,
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
<Spinner />
|
|
46
|
-
</View>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface SpinnerState {
|
|
52
|
-
show: boolean;
|
|
53
|
-
}
|
|
54
|
-
export class Spinner extends React.Component<SpinnerProps, SpinnerState> {
|
|
55
|
-
state = {show: false};
|
|
56
|
-
|
|
57
|
-
// The delay is for perceived performance so you should rarely need to remove it.
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
setTimeout(() => this.setState({show: true}), 300);
|
|
60
|
-
}
|
|
9
|
+
// The delay is for perceived performance. You don't want to show a spinner when you're doing a quick action.
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const timer = setTimeout(() => setShow(true), 300);
|
|
12
|
+
return () => clearTimeout(timer);
|
|
13
|
+
}, []);
|
|
61
14
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const size: "small" | "large" = this.props.size === "sm" ? "small" : "large";
|
|
67
|
-
return <ActivityIndicator color={this.props.color || "darkGray"} size={size} />;
|
|
15
|
+
if (!show) {
|
|
16
|
+
return null;
|
|
68
17
|
}
|
|
18
|
+
const spinnerSize: "small" | "large" = size === "sm" ? "small" : "large";
|
|
19
|
+
return <ActivityIndicator color={color || "darkGray"} size={spinnerSize} />;
|
|
69
20
|
}
|