@json-render/react-native 0.5.0 → 0.5.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/README.md +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -639,7 +639,7 @@ function rewriteRepeatTokens(value, basePath, index) {
|
|
|
639
639
|
}
|
|
640
640
|
|
|
641
641
|
// src/renderer.tsx
|
|
642
|
-
import {
|
|
642
|
+
import React6, {
|
|
643
643
|
useCallback as useCallback4,
|
|
644
644
|
useMemo as useMemo5
|
|
645
645
|
} from "react";
|
|
@@ -1475,6 +1475,28 @@ var modalStyles = StyleSheet2.create({
|
|
|
1475
1475
|
|
|
1476
1476
|
// src/renderer.tsx
|
|
1477
1477
|
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1478
|
+
var ElementErrorBoundary = class extends React6.Component {
|
|
1479
|
+
constructor(props) {
|
|
1480
|
+
super(props);
|
|
1481
|
+
this.state = { hasError: false };
|
|
1482
|
+
}
|
|
1483
|
+
static getDerivedStateFromError() {
|
|
1484
|
+
return { hasError: true };
|
|
1485
|
+
}
|
|
1486
|
+
componentDidCatch(error, info) {
|
|
1487
|
+
console.error(
|
|
1488
|
+
`[json-render] Rendering error in <${this.props.elementType}>:`,
|
|
1489
|
+
error,
|
|
1490
|
+
info.componentStack
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
render() {
|
|
1494
|
+
if (this.state.hasError) {
|
|
1495
|
+
return null;
|
|
1496
|
+
}
|
|
1497
|
+
return this.props.children;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1478
1500
|
function ElementRenderer({
|
|
1479
1501
|
element,
|
|
1480
1502
|
spec,
|
|
@@ -1568,7 +1590,7 @@ function ElementRenderer({
|
|
|
1568
1590
|
childKey
|
|
1569
1591
|
);
|
|
1570
1592
|
});
|
|
1571
|
-
return /* @__PURE__ */ jsx7(Component, { element: resolvedElement, emit, loading, children });
|
|
1593
|
+
return /* @__PURE__ */ jsx7(ElementErrorBoundary, { elementType: resolvedElement.type, children: /* @__PURE__ */ jsx7(Component, { element: resolvedElement, emit, loading, children }) });
|
|
1572
1594
|
}
|
|
1573
1595
|
function RepeatChildren({
|
|
1574
1596
|
element,
|