@gaozh1024/rn-kit 0.3.0 → 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/README.md +1 -0
- package/dist/index.js +131 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -1569,7 +1569,8 @@ function Card({
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
// src/ui/display/Icon.tsx
|
|
1572
|
-
import
|
|
1572
|
+
import { Text as Text2 } from "react-native";
|
|
1573
|
+
import { MaterialIcons } from "@expo/vector-icons";
|
|
1573
1574
|
import { jsx as jsx16 } from "nativewind/jsx-runtime";
|
|
1574
1575
|
var sizeMap2 = {
|
|
1575
1576
|
xs: 16,
|
|
@@ -1578,6 +1579,12 @@ var sizeMap2 = {
|
|
|
1578
1579
|
lg: 32,
|
|
1579
1580
|
xl: 48
|
|
1580
1581
|
};
|
|
1582
|
+
function isComponentLike(value) {
|
|
1583
|
+
if (typeof value === "function") return true;
|
|
1584
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1585
|
+
return "$$typeof" in value;
|
|
1586
|
+
}
|
|
1587
|
+
var MaterialIconComponent = isComponentLike(MaterialIcons) ? MaterialIcons : void 0;
|
|
1581
1588
|
function resolveSize(size = "md") {
|
|
1582
1589
|
if (typeof size === "number") return size;
|
|
1583
1590
|
return sizeMap2[size] || 24;
|
|
@@ -1586,11 +1593,29 @@ function Icon({ name, size = "md", color = "gray-600", style, onPress, testID })
|
|
|
1586
1593
|
const { theme, isDark } = useOptionalTheme();
|
|
1587
1594
|
const resolvedSize = resolveSize(size);
|
|
1588
1595
|
const resolvedColor = resolveNamedColor(color, theme, isDark) ?? color;
|
|
1596
|
+
const fallback = /* @__PURE__ */ jsx16(
|
|
1597
|
+
Text2,
|
|
1598
|
+
{
|
|
1599
|
+
style: [
|
|
1600
|
+
{
|
|
1601
|
+
color: resolvedColor,
|
|
1602
|
+
fontSize: resolvedSize,
|
|
1603
|
+
lineHeight: resolvedSize
|
|
1604
|
+
},
|
|
1605
|
+
style
|
|
1606
|
+
],
|
|
1607
|
+
testID,
|
|
1608
|
+
children: "\u25A1"
|
|
1609
|
+
}
|
|
1610
|
+
);
|
|
1611
|
+
if (!MaterialIconComponent) {
|
|
1612
|
+
return onPress ? /* @__PURE__ */ jsx16(AppPressable, { onPress, children: fallback }) : fallback;
|
|
1613
|
+
}
|
|
1589
1614
|
if (onPress) {
|
|
1590
|
-
return /* @__PURE__ */ jsx16(AppPressable, { onPress, testID, children: /* @__PURE__ */ jsx16(
|
|
1615
|
+
return /* @__PURE__ */ jsx16(AppPressable, { onPress, testID, children: /* @__PURE__ */ jsx16(MaterialIconComponent, { name, size: resolvedSize, color: resolvedColor, style }) });
|
|
1591
1616
|
}
|
|
1592
1617
|
return /* @__PURE__ */ jsx16(
|
|
1593
|
-
|
|
1618
|
+
MaterialIconComponent,
|
|
1594
1619
|
{
|
|
1595
1620
|
name,
|
|
1596
1621
|
size: resolvedSize,
|