React Native background location (#mauron85/react-native-background-geolocation) - problem installing, how to link modules with Expo managed workflow? - react-native

I'm developing a sports app with React Native / Expo which needs to track user background when the app is in the background.
This is related to my previous question (React Native expo-location: How to make the background location service update more often?). I came to the conclusion that the background location tracking in the 'expo-location' package does not seem to sufficiently work, so I started building a new solution based on the package '#mauron85/react-native-background-geolocation' (https://github.com/mauron85/react-native-background-geolocation) which I found was recommended in several tutorials.
So I installed the module and built my map component based on the example code provided in the documentation (https://github.com/mauron85/react-native-background-geolocation#quick-example).
However, when running the app on Expo Go, I get the following error message despite doing all the required imports:
Component Exception: RNBackgroundGeolocation is undefined
This appears to be caused by a problem in linking modules, which I failed to do during the installation. The component requires to do linking of modules with the following command:
node ./node_modules/#mauron85/react-native-background-geolocation/scripts/postlink.js
Because I use Expo managed workflow, I lack the folder structure (./android/settings.gradle etc) required by this script and receive an error of 'android/settings.gradle not found'. Based on some searching, this seems to require running 'expo eject' on the whole project so that I can do configurations in the platform-specific folders.
However, 'expo eject' runs into errors in the "Installing JavaScript dependencies" phase and just returns an error of "Something went wrong ... ...", and the error logs provide no further clarification.
Questions:
How to get forward when something goes wrong in the 'expo eject' phase like this? The error logs get really messy and unclear.
I would really prefer to stay in the managed workflow to avoid any mess. Is there a way to get the modules linking work within the Expo managed workflow?
Any help appreciated, thanks.

Related

React native app sourcemaps show incorrect location of error when error happens in asynchronous code

I have a react-native app. I recently moved to react-native version 0.61.5 for which I took the long route of creating a new react-native app and porting my code over to avoid any linking issues since new version used PODFILE as the default linking mechanism. Ever since I moved to version 0.61.5, I don't get the correct location of code in error logs. I think this is mainly happening when the code is running in asynchronous fashion which most of the code is. For e.g., look at below screenshot:
It is reporting that it is not able to call map on some array which is apparently undefined but the place where the error is reported is completely incorrect. I have no such file in my codebase and it is probably pointing to some file in some react-native package.
I am using Sentry #sentry/react-native": "^1.1.0". I don't think Sentry can cause issue with the sourcemaps reported during development.
I am not sure how to debug this problem. This problem is causing a lot of issues in debugging any errors as I have to manually figure out where the error happened. Please let me know if you have any tips on how to fix this problem.

How to create react-native app for route like uber, with the use of HERE-MAP?

installed 'npm install react-native-heremaps --save'
This is for react-native init android, I tried some application using ios concept.
Error
Loading dependency graph, done. Error: Unable to resolve module ./index
Referrence:
Github ios sample
this question is a bit vague for SO, something that would require an entire course to answer. Currently it looks like you should learn how to do react-native android before attempting to add on top HERE. There are many great tutorials to get that started and working.
For the here portion you will have to use the Here-Maps-SDK. Since there isn't a react version of this SDK, you will need to link it using a react bridge.
It's not that easy of a process, and will take a decent amount of work to get right.
Here are some examples to help get started: https://hackernoon.com/react-native-bridge-for-ios-and-android-43feb9712fcb
https://facebook.github.io/react-native/docs/native-modules-ios

React Native Example App does not run in Expo Snack

I'm learning React Native and trying to add a component to an Expo Snack for testing. I can't even get the example app to work though.
Is it something different about how Snacks work vs. a desktop development environment? I've encountered that type of difference using JSFiddle, for example.
I straight copy-pasted the code from the Github repo into snack.expo.io and it gave me an error:
Device: (946:881) Unable to resolve module 'module://expo-font.js'
Evaluating module://expo-font.js
Evaluating module://react-native-numeric-input.js
Evaluating module://App.js
Loading module://App.js
I've gotten this error before, but I've never been able to figure out why. Is it an issue with the package, which was updated just 7 days ago, or something else? Please advise.
It may be due to missing of node modules in your project compared to the Github project. As the Stack.expo browser won't give us full freedom to install custom modules, I suggest you to download VS Code and open the Github project in it, then do "npm install" from cmd and "react-native run-android/ios".

React Native app builds multiple times rapidly then fails when in production mode in Expo

Despite the app running perfectly in test builds, when I publish the app or put in in production mode the app builds once that takes a while, then several times within short succession as seen below:
After it stops I then receive the errors:
"Module AppRegistry is not a registered callable module (calling
runApplication)"
and
"undefined is not a function (evaluating
'babelHelpers.objectDestructuringEmpty(d.actions)')"
I have looked up this issue and found that those 2 error messages tend to be vague "catch-all" errors, however none of the posts I found had the rapid build issue I have, so that may a key part to solving this. I have tried restarting the app several times, npm install-ing, updating react and expo to their latest versions, and other small non-code related fixes however none have worked.
Here is a link to my repo: https://github.com/tc1240/AT-Assist. If anyone has had this or can take a look at my code any help is appreciated. Thank you,
Also this is my first question asked on stack so I apologize in advance if my question does not follow some of the guidelines.
I've been experiencing this lately, since I tried publishing for Android and iOS.
I'm currently unable to build additional projects in Expo other than the one I'm working on, so I can't test your project, but:
Can you add the android.package key in your app.json file and try running again? Restoring this back into my project seemed to fix the issue for me.

React Native Dev Setup in Team

I am currently working in a team developing a react native IOS application, we are all doing this for the first time. I am unable to find any information on development setup with many people working on the same code and we are running into many issues requiring each member to have their own project, and one person with the master project is having to copy and paste code over, any pointers much appreciated!!
Initial project build is successful, the problem occurs when someone else clones the repository and attempts a build. Too many errors to go over and different with each machine. Is there some setup in X-Code or something I am missing with regards to working in a team environment with react native?
Because React native use many libraries like module to help build app fastly and reuse.So, I suggest this workflow to build mobile application with RN.
- Use GIT as system version control
- Use IDE (Android Studio, Xcode) to help auto build and fix a lot build error when your team install new libraries and use `react-native link` (ex: react-native-router-flux,...)
- Just push js file to repository and other member can pull it and reload js file.
- Do it and take a look some repository on github with tutorials
Cheer!
Using Yarn rather than Node package manager resolved a majority of the issues.