diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx
index e7535cf..b3198e1 100644
--- a/src/components/Icon.tsx
+++ b/src/components/Icon.tsx
@@ -7,10 +7,13 @@ import { getIconType } from '../helpers/getIconType'
import type { Props } from '../types/Props'
-export const Icon = ({ type, ...props }: Props & IconProps) => {
- const contextFontType = useContext(NativeIconsContext)
+// TODO? type for name optional when has context provided
+export const Icon = ({ type, name, ...props }: Props & IconProps) => {
+ const iconsContext = useContext(NativeIconsContext)
- const IconComponent = getIconType(type || contextFontType)
+ // TODO
+ const IconComponent = getIconType(type || iconsContext.type)
- return
+ // TODO
+ return
}
diff --git a/src/context.tsx b/src/context.tsx
index 64019cc..60be406 100644
--- a/src/context.tsx
+++ b/src/context.tsx
@@ -1,19 +1,30 @@
import React from 'react'
+import { IconProps } from 'react-native-vector-icons/Icon'
import type { FontType } from './types/FontType'
import type { Props } from './types/Props'
-export const NativeIconsContext = React.createContext(
- undefined
-)
+// TODO refactor
+export const NativeIconsContext = React.createContext<{
+ readonly type?: FontType
+ readonly fallbackIcon?: IconProps['name']
+}>({
+ type: undefined,
+ fallbackIcon: undefined,
+})
NativeIconsContext.displayName = 'NativeIconsContext'
export const NativeIconsProvider = ({
children,
type,
-}: Props & { readonly children: React.ReactNode }) => (
-
+ fallbackIcon,
+}: Props & {
+ // TODO refactor
+ readonly children: React.ReactNode
+ readonly fallbackIcon?: IconProps['name']
+}) => (
+
{children}
)
diff --git a/src/types/FontType.ts b/src/types/FontType.ts
index bf316df..60cb389 100644
--- a/src/types/FontType.ts
+++ b/src/types/FontType.ts
@@ -13,3 +13,4 @@ export type FontType =
| 'octicons'
| 'zocial'
| 'simple-line-icons'
+// | string // TODO