Skip to content

Strongly type name property #32

@rdjpalmer

Description

@rdjpalmer

Description

Comparing the FontAwesome icon set which ships with Expo to this project, we lose all typing on the name property for the icon component. It would be particularly helpful during development to ensure the names are correct without having to look them up.

From what I can tell, it could be as simple as the following change, but I'd to confirm before making a PR:

diff --git a/index.d.ts b/index.d.ts
index 7bb654d..7a3b969 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,8 +1,9 @@
+import { IconName } from "@fortawesome/fontawesome-svg-core";
 import { ViewStyle, ViewProps } from "react-native";
 import { SvgProps } from "react-native-svg";
 
 export interface IconProps extends ViewProps {
-  name?: string;
+  name?: IconName;
   size?: number;
   color?: string;
   type?: "regular" | "light" | "solid" | "brands";

Environment

  • What react-native-fontawesome-pro version are you using? Latest
  • What react-native version are you using? N/A
  • Does the issue occur on IOS, Android or Both? N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions