【问题标题】:InView package not working in react native typescript mobile appInView 包在 React Native TypeScript 移动应用程序中不起作用
【发布时间】:2023-01-18 19:52:13
【问题描述】:

在我的 TypeScript React Native 移动应用程序中,我试图检测出现在屏幕上的元素。我正在尝试使用许多包,例如 react-native-inviewreact-native-component-inview,但它们不断抛出与 typescript typing 相关的错误。我该如何解决这些错误,或者是否有其他支持打字稿的方法或软件包可用?

错误:

Could not find a declaration file for module 'react-native-inview'. 'PATH/node_modules/react-native-inview/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/react-native-inview` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-inview';`

注意:不存在自动指定类型的包如npm i --save-dev @types/react-native-inview

【问题讨论】:

    标签: react-native


    【解决方案1】:

    您似乎没有将这些包正确添加到您的应用程序中。您是否在 ios 文件夹中尝试过 pod install 命令?如果不是这种情况,我建议在您的应用程序目录中刷新您的节点模块。

    【讨论】:

      猜你喜欢
      • 2018-11-13
      • 2021-09-22
      • 2017-02-13
      • 2019-10-22
      • 2022-12-29
      • 2021-02-02
      • 1970-01-01
      • 2021-11-02
      • 2021-04-23
      相关资源
      最近更新 更多