registry.tsx 930 B

123456789101112131415161718192021222324252627
  1. import React from "react";
  2. import Ionicons from "@expo/vector-icons/Ionicons";
  3. import { defineRegistry, type Components } from "@json-render/react-native";
  4. import { catalog } from "./catalog";
  5. // =============================================================================
  6. // Registry
  7. // =============================================================================
  8. /**
  9. * Custom component registry using defineRegistry.
  10. *
  11. * Only custom components need to be defined here — standard React Native
  12. * components (Container, Row, Column, Button, etc.) are included automatically
  13. * by the Renderer via `includeStandard`.
  14. */
  15. export const { registry } = defineRegistry(catalog, {
  16. components: {
  17. Icon: ({ props }) => (
  18. <Ionicons
  19. name={props.name as keyof typeof Ionicons.glyphMap}
  20. size={props.size ?? 24}
  21. color={props.color ?? "#111827"}
  22. />
  23. ),
  24. } as Components<typeof catalog>,
  25. });