Files
lucide/packages/lucide-react-native/__mocks__/react-native-svg/index.ts
T
Eric Fennisandcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> f06ac67e33 chore(typchecking): More typecheck jobs for all packages (#4885)
* Add typecheck jobs

* update lockfile

* Fix types

* Fix lucide solid types

* Fix type lucide-react-native

* fix: align react-native svg mock children typing

* fix: format build font spec

* fix: restore shared workflow and RN class context

* fix: restore lucide-react build typecheck

* fix: keep react build generating icons

* fix: preserve builder color prop types

* test: cover RN provider class merge

* Revert 711255b

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-09-22 13:49:09 +02:00

68 lines
1.8 KiB
TypeScript

// https://github.com/FormidableLabs/react-native-svg-mock
import React from 'react';
import type { LucideProps } from '../../src/types';
export type { SvgProps } from 'react-native-svg';
const createComponent = function (name: string) {
// React Native identifies elements by `testID`, the DOM equivalent is `data-testid`
const component = ({ testID, children, ...props }: LucideProps) => {
return React.createElement(name, { ...props, children, 'data-testid': testID });
};
component.displayName = name;
return component;
};
// Mock all react-native-svg exports
// from https://github.com/magicismight/react-native-svg/blob/master/index.js
const Svg = createComponent('svg');
const Circle = createComponent('circle');
const Ellipse = createComponent('ellipse');
const G = createComponent('g');
const Text = createComponent('text');
const TextPath = createComponent('textPath');
const TSpan = createComponent('tSpan');
const Path = createComponent('path');
const Polygon = createComponent('polygon');
const Polyline = createComponent('polyline');
const Line = createComponent('line');
const Rect = createComponent('rect');
const Use = createComponent('use');
const Image = createComponent('image');
const Symbol = createComponent('symbol');
const Defs = createComponent('defs');
const LinearGradient = createComponent('linearGradient');
const RadialGradient = createComponent('radialGradient');
const Stop = createComponent('stop');
const ClipPath = createComponent('clipPath');
const Pattern = createComponent('pattern');
const Mask = createComponent('mask');
export {
Svg,
Circle,
Ellipse,
G,
Text,
TextPath,
TSpan,
Path,
Polygon,
Polyline,
Line,
Rect,
Use,
Image,
Symbol,
Defs,
LinearGradient,
RadialGradient,
Stop,
ClipPath,
Pattern,
Mask,
};
export default Svg;