diff --git a/packages/mobile/src/harmony-native/icons.ts b/packages/mobile/src/harmony-native/icons.ts index de5e4bc2547..af20f6a8087 100644 --- a/packages/mobile/src/harmony-native/icons.ts +++ b/packages/mobile/src/harmony-native/icons.ts @@ -1,8 +1,11 @@ +import type { ComponentType } from 'react' + import type { IconProps as HarmonyIconProps } from '@audius/harmony' +import type { AnimateProps } from 'react-native-reanimated' import type { SvgProps } from 'react-native-svg' export * from '@audius/harmony/src/icons' export type IconProps = SvgProps & HarmonyIconProps & { fillSecondary?: string } -export type Icon = React.FC +export type Icon = ComponentType | IconProps> diff --git a/packages/mobile/src/types/declarations.d.ts b/packages/mobile/src/types/declarations.d.ts index 49f38e975a8..6f1ed845db2 100644 --- a/packages/mobile/src/types/declarations.d.ts +++ b/packages/mobile/src/types/declarations.d.ts @@ -6,8 +6,8 @@ declare module 'fxa-common-password-list' declare module 'react-native-static-server' declare module '*.svg' { - import type { Icon } from '@audius/harmony-native' - const content: Icon + import type { IconProps } from '@audius/harmony-native' + const content: ComponentType export default content } diff --git a/svgr-template.js b/svgr-template.js index 02d05f3fee3..d06b7af91e2 100644 --- a/svgr-template.js +++ b/svgr-template.js @@ -2,10 +2,11 @@ const template = (variables, { tpl }) => { return tpl` ${variables.imports}; import {useTheme} from '@emotion/react' +import {forwardRef} from 'react' ${variables.interfaces}; -const ${variables.componentName} = (${variables.props}) => { +const ${variables.componentName} = forwardRef((${variables.props}, ref) => { const theme = useTheme() let { color, @@ -29,10 +30,10 @@ const ${variables.componentName} = (${variables.props}) => { const fillColor = other.fill ?? theme.color.icon[color] ?? 'red' - props = {...other, fillColor} + props = {...other, ref, fillColor} return (${variables.jsx}) -}; +}); ${variables.exports}; `