1.1.3 • Published 7 months ago

@itcase/icons v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

How to Integrate and Use Icons in React Native Project

1. Install Dependencies

npm install @itcase/icons @itcase/react-native-ui
  • Сonfigure metro configuration to support packages with different exports (take configuration from other projects).

2. Using the Icon Component

  • MyIcon.tsx
import { icon20 } from '@itcase/icons/default'
import { Icon } from '@itcase/react-native-ui'
import { ISvgComponent } from '../interfaces/app.interfaces'

const MyIcon = () => {
  return (
    <Icon
      SVGIcon={icon20.Dot as unknown as ISvgComponent}
    />
  );
}

The SVG icon is a string (file path or inline SVG), the react-native-svg library converts it to a component, so we cast it to type ISvgComponent.

3. Project Structure

src/
 ├── components/
 │  	└── MyIcon.tsx
 ├── interfaces/
 │  	└── app.interfaces.ts
 ├── types/
 │  	└── types.d.ts
 └── App.tsx

4. Defining Custom SVG Component Type

  • app.interfaces.ts
import React from 'react'

import { SvgProps } from 'react-native-svg'

export interface ISvgComponent extends React.FC<SvgProps> {}
  • types.d.ts
declare module '*.svg' {
  import React from 'react'
  import { SvgProps } from 'react-native-svg'

  const content: React.FC<SvgProps>
  export default content
}
1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.29

9 months ago

1.0.28

9 months ago

1.0.27

9 months ago

1.0.26

9 months ago

1.0.25

9 months ago

1.0.23

10 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.19

11 months ago

1.0.18

12 months ago

1.0.17

12 months ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago