How to setup feathers offline in react native - react-native

I would like to know if anyone successfully set up feathers offline in react native. Right now I am having an issue whenever I call "owndataWrapper" i.e
import { owndataWrapper } from '#feathersjs-offline/client';
owndataWrapper(app, '/messages', {});
The error says Unable to resolve module path in /node-localstorage/LocalStorage.js . . so I ended up installing these packages.
assert, constants, events, path, stream, and fs
and got a new error.
here is the error.
https://github.com/feathersjs-offline/owndata-ownnet/issues/46
My guess is probably due to the fs package, it has a security issue.
Any idea? Thanks

After digging further it turns out it only works on web apps. It uses packages that does not exists in react native such as path, process, fs, and so on. I tried using
https://github.com/parshap/node-libs-react-native
and
https://github.com/staltz/react-native-process-shim
but got stuck and continuesly having error on fs. . in conclusion I need to drop the ball for now since this feathers offline is not yet fully created for react native.

Related

React Native Webview Clear Cache

Is there a way to clear cache in webview for both ios and android?
I tried using #react-native-community_cookies, it works for ios, but for android Im getting this error when trying to run: A problem occurred evaluating project ':#react-native-community_cookies'. > Plugin with id 'maven' not found.
Maybe any of you have suggestions how to fix this or know some other methods?
Thanks
You can use this plugin https://www.npmjs.com/package/#react-native-community/cookies for clear cache and write below function
import CookieManager from '#react-native-community/cookies';
CookieManager.clearAll(true)
The true param means that it will clear cookies for the webkit webview (which is what this library uses)
Check out this library it does the job done.
https://github.com/react-native-cookies/cookies
import CookieManager from '#react-native-cookies/cookies';
CookieManager.clearAll(true);

getDevicePushTokenAsync error on bare workflow

I implemented push notification on managed workflow which is working properly but when I eject from managed workflow, I am getting error at line
pushToken = (await Notifications.getExpoPushTokenAsync()).data;
Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process com.luciajane.taskuser. Make sure to call FirebaseApp.initializeApp(Context) first.
I passed experienceId but still getting error?
pushToken = (await Notifications.getExpoPushTokenAsync({experienceId: "#luciajane/task-user"})).data;
I found reason. You have to setup by making new project on firebase then download google-services.json file and add that to your expo project. As expo mentioned Firebase Cloud Messaging is required for all managed and bare workflow Android apps made with Expo.For setup follow this link https://docs.expo.io/push-notifications/using-fcm/

React Native Navigation Error - Unable to resolve module `#react-navigation/stack`

Since I've been recently made aware of React Navigation, I tried using it, but I can't get it to work.
I've followed the instructions presented at the documents of reactnavigation.org, normally, with npm. Since that didn't work, I also tried installing via their yarn commands, but the same error was presented.
While I couldn't find any answer to this same problem, since apparently it was react-navigation-stack instead of #react-navigation/stack, I tried out solutions for similar errors - trying to install it with --saveand trying to reinstall react-navigation, rebuild the project, then restart the packager with react-native-start.
The relevant part of the error reads as this:
The development server returned response error code: 500
URL:
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false
Body:
{"originModulePath":"App.js","targetModuleName":"#react-navigation/stack;","message":"Unable
to resolve module #react-navigation/stack; from App.js:
#react-navigation/stack; could not be found within the project.
Alternatively, I also tried using react-navigation-stack by following old setup tutorials, but I couldn't get that version to work either. I'd much prefer using something up-to-date, though.
I went to code as soon as I woke up and immediatly identified the problem, it was a semicolon.
Instead of import { createStackNavigator } from "#react-navigation/stack";, I'd written import { createStackNavigator } from "#react-navigation/stack;" so yeah. Silly problem.

Using styleguidist in a react native application

I'm trying to use styleguidist in a react native application application;
I come across this link and implemented the exact same set up in my application:
https://github.com/styleguidist/react-styleguidist/tree/master/examples/react-native
After running npx styleguidist build, i got this output:
FAIL Failed to compile
build/bundle.f44bbfd4.js from UglifyJs
Unexpected token punc «:», expected punc «,» [build/bundle.f44bbfd4.js:372,1165]
Any ideas how to solve this ?
Thanks in advance.
Can you please provide more examples of what exact code changes you made and to what files? I had a similar issue and it turned out I was applying config changes to webpack.config.js that needed to go into the styleguide.config.js instead.

Unable to resolve module (Expo, React Native)

Building a React Native app with Expo, the Javascript bundle fails after getting the error Unable to resolve "../stores/__fixtures__/matchlist/matchlistSourceFixture" from "src/containers/MatchlistSwipeContainer.tsx", despite the fact that I am 100% sure this file exists and its relative path in this instance is correct – especially as I’m using VSCode and it complains if the path isn’t right and I’m using VSCode’s autocomplete to begin with.
If I move the file into any other directory that is not with __ dunder affixes and update the relative path accordingly, it can find the file perfectly fine.
I’ve checked other similar topics with Unable to resolve module errors, but they all seem to be related to third-party packages, whereas this is a local file.
Import statement:
import { matchlistSourceFixture } from '../stores/__fixtures__/matchlist/matchlistSourceFixture';
Export statement in the file in matchlistSourceFixture.ts:
export const matchlistSourceFixture = {...}
Attached is an image of the error message in the Expo iOS app. The message stating that the file doesn’t even exist (it has a .ts extension by the way) makes me think the relative path isn’t really the issue here anyway.
Versions:
React 16.3.1
Expo 27.0.0
Exp 54.0.0
It seems like __fixtures__ dirs are blacklisted by default in RN: react-native/local-cli/util/Config.js.
See this comment on overriding the default.