flowkey / react-native-home-indicator

A <PrefersHomeIndicatorAutoHidden /> component for react-native
MIT License
80 stars 24 forks source link

Could not find a declaration file for module 'react-native-home-indicator'. '....../node_modules/react-native-home-indicator/index.js' implicitly has an 'any' type. #41

Closed IlanZ93 closed 2 years ago

IlanZ93 commented 2 years ago

Hey,

136217281-678ea873-c082-4bc2-8091-bd50b8751d57

My project is using TypeScript so I have this issue and can't be solve, can you maybe publish new declaration or if you are aware of a new way to hide the Home indicator on React Native 0.64...

Thank you

kikeztw commented 2 years ago

Hey,

136217281-678ea873-c082-4bc2-8091-bd50b8751d57

My project is using TypeScript so I have this issue and can't be solve, can you maybe publish new declaration or if you are aware of a new way to hide the Home indicator on React Native 0.64...

Thank you

just add to in root of you project

// index.d.ts
declare module 'react-native-home-indicator' {
  import React from 'react';

  type HomeIndicatorProps = {
    autoHidden?: boolean;
  };

  // eslint-disable-next-line import/no-default-export
  export default class HomeIndicator extends React.Component<HomeIndicatorProps> {
    popAndGetPreviousProps(): void;
  }
}
michaelknoch commented 2 years ago

I opened a PR which addresses the missing types. Basically I converted the module to TS and also refactored the react class to hooks. This needs some testing but it will presumably go live within the next days. @kikeztw @IlanZ93