InView package not working in react native typescript mobile app - react-native

In my TypeScript React Native mobile app, I'm trying to detect elements appearing on the screen. I'm trying to use many packages such as react-native-inview and react-native-component-inview but they keep throwing typescript typing related errors. How can I resolve these errors or is there other ways or packages available which are typescript supported?
Error:
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';`
Note: The automatically specified type packages do not exist such as npm i --save-dev #types/react-native-inview.

It seems you didn't add these packages correctly to your app. Have you tried pod install command in your ios folder? If it is not the case, I recommend refreshing your node modules in your app directory.

Related

null is not an object react native error when I try to use native implementation from a module in react-native app

I'm creating a plugin/module that uses many modules with native implementations like #react-native-async-storage/async-storage, react-native-fs, #react-native-community/netinfo, react-native-audio-recorder-player any many others. Link to my plugin/module is this. When I run this code as a standalone app, it runs fine, but when I use this npm module then I get this error. In the host application, I installed all of the peer dependencies and linked them automatically and manually both, but the error is never resolved. So to summarize the situation, below are the points:
The npm module has the index.js with exporting the code only.
The code uses #react-native-async-storage/async-storage, react-native-fs, #react-native-community/netinfo, react-native-audio-recorder-player etc..
The npm module has all the dependencies as peerDependencies so the host app has them and links to the android files.
The host app links all these packages with react-native link command but error is still shown.
Host and guest, both have same react and react-native versions too: "react": "17.0.1", "react-native": "0.64.2"
I also tried having all these packages as dependencies of the module but in that case, I could not link them with this command because we need those packages in the host application.
Any kind of help is appreciated.

'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary

This is my Code which is showing this error . Here I am trying to make a Drawer-navigation
This is the error showing , I am doing this in react-native.
It seems you might have missed some installation / setup steps for react-navigation.
Please check this section in the docs: https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project
If you have already installed the packages listed there (notably react-native-reanimated), perhaps you have not installed the native dependencies. This is important on iOS - run npx pod-install in your project root, and then build the app again (hot reload will not be enough).

How to implement dendency module linking in my module

Im currently working on my own package module for React Native.
As dependency it will have react-native-community/async-storage.
Async-storage for installation requires:
Linking
Cocoa pods install
So the question is how can i add this dependency in my module in that way so end will only need to:
npm install 'MyModuleName'
And thats it, without any additional linking and installations.
Since the async-storage dependency will be handled in 'MyModuleName'/node_modules folder, and not in the project one.
No you can’t do this you have to use async-storage as a peerDependencies that’s the only way to use other libs in your module.

npm SDK peer dependency

i want to ask on specific problem
We have SDK library (on local gitlab), which contains some JS files and it contains all packages as React, Redux, Typescript... defined in package.json as "dependency" and "peerDependency"
This library is included into new project as dependency and new project is using SDK libraries and their versions defined in SDK package.json file.
React, Redux all included (used as imported module) into files is exported right
But problem is, when typescript or some #types/* package is added
MPM not install that packages and tslint-loader of course throw error, that typescript is not installed.
Any advice, how to properly add peerDependencies into package.json file and specially for SDK library?
Many thx for any advice
I'm facing the same problem. I'm developing a framework module for angular projects and define the required angular packages as peerDependencies.
During development typescript can't resolve the packages (eg. '#angular/core').
My current solution for this problem is to add the peerDependencies also as devDependency so it gets installed. But I consider this more as a workaround.
Is there a better solution for this?

Installing npm modules makes flex crash with type errors

I'm attempting to use a component in my React Native project, specifically this one:
https://github.com/lucholaf/react-native-grid-view
I run npm install react-native-grid-view in the project's directory, but as soon as I do that, after building I get:
Is the problem that I'm running npm install in the wrong location? I've tried other directories, but then React doesn't see the modules and says "unknown module".
Thanks!
The problem was that the component was pointing to an older version of React Native, 0.3.4. Manually updated to 0.4 and it worked.