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.
Related
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);
I'm trying to use this library. I cloned the code, ran npm install and then ran react-native run-android. As a result I got an error Cannot find module 'metro-config/src/defaults/blacklist'. I looked it up, and found an answer that suggest
to change the content of the blacklist.js file because of faulty regex.
However, I looked at the path suggested in the answer metro-config/src/defaults/blacklist but it didn't contain any blacklist.js files. I also looked at other paths but still didn't find anything with the name blacklist.js.
How can I fix this issue and get the library working?
Node version: v14.17.0
React native version: 0.64.2
I had the same issue in expo-yarn-workspace with the same react-native version.
I fixed it by find where 'metro-config/src/defaults/blacklist' is call and replace it
by 'metro-config/src/defaults/exclusionList' because it's been renamed.
https://github.com/facebook/metro/blob/a94200229df4e7f3a9549665142d4ad4b8d32de5/packages/metro-config/src/defaults/exclusionList.js
https://github.com/facebook/metro/issues/453
Let me know if it works for you !
I follow the Getting Started, Writing a Secret Contract, Creating a React Front-End, but I get this
Syntax Error about enigma_dapp/client/src/App.js
I copy the Creating a React Front-End said App.js, Error follow the pictures
Picture as following the "Module", "Failed"
Module not found
Failed to compile
If I didn’t add Writing a Secret Contract, Creating a React Front-End part
I get “Enigma setup still loading”
Picture as follow the "Original view"
Original view
I'm sure the /enigma_dapp/ have package.json
and /enigma_dapp/client/ have package.json, package-lock.json, yarn.lock
but /enigma_dapp/client/src/ don't have any of them, how can I fix the problem?
I receive the solution about this enigma version.
It's a early version , so it's not available now. (or bugs a lot)
https://forum.enigma.co/t/app-js-and-syntax-error/1090
Hope you could help me here:
I'm currently building an app which I created through CRNA and then ejected. I get the ios version right on but I'm currently struggling a lot with the android version.
When running react-native run-android all I can get is the following error:
Error type 3
Error: Activity class {com.myapp/com.myapp.MainActivity} does not exist.
I've checked app/build.gradle, app/src/main/AndroidManifest.xml, app/src/main/java/com/myapp/MainActivity.java and app/src/main/java/com/myapp/MainActivity.java for name errors on package. I've tried moving from com.myapp to com.mebius.myapp and com aswell.
Seems this comes from the only plugin I'm using. I'm keeping on the investigation
Any hints?
There are 3 possible reasons for the android app build fails to make
1. You need to define sdk path in android/local.properties
if local.properties doesn't place then make a file names with that
add
sdk.dir = home/user/AndroidApp/local/Sdk
You can match with their system path..
2. Your genymotion or avd must enable with the android studio
3. You must have to go with the following command
npm start
in new terminal .
Please go through with it.
Thanks
Actually I had a problem with my gradle config which look like:
include ':react-native-sensors'
project(':react-native-sensors').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sensors/android')
rootProject.name = 'accelapp'
I needed to add: include ':app'
I don't know if it's due to the process of ejecting from CRNA or if it's due to react-native link react-native-sensors though.
EDIT After some investigation, I couldn't reproduce this issue. This leads me to say it was a faulty copy/paste...
I created a React Native project from Expo. Then I wanted to add Flow to it. I noticed in my node_modules/react-native folder there was a .flowconfig so I copied that to the root of my project. After running flow I got some warnings from files in node_modules/exponent so I added an ignore for that whole folder. Afterwards, I still get many errors when running flow. Here are a few:
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:227
227: /* $FlowFixMe */
^^^^^^^^^^^^^^^^ Error suppressing comment. Unused suppression
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:1120
1120: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:2162
2162: if (__DEV__) {
^^^^^^^ identifier `__DEV__`. Could not resolve name
Expo SDK version: 14.0.0
Flow version: 0.37.0
React Native version: 0.41.2
You can suppress errors in .flowconfig file, in [options] section as follows:
[options]
suppress_type=$FlowFixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-8]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
Then, in [libs] section, you should point so called library definition file, like:
[libs]
./libdefs.js
And in libdefs.js just declare:
declare var __DEV__:string;
These changes should resolve your errors. See:
https://flow.org/en/docs/config/options/#toc-suppress-comment-regex and
https://flow.org/en/docs/libdefs/creation/ for details.
Looks like it might have been an oversight on the flow types for that release version.
All of those errors look fairly harmless though so you could just ignore it. If you absolutely cannot ignore it, update to a later version of React Native that's locked to a different version of Flow? I've had good results personally (no errors) with React Native # 0.42 and Flow # 0.38.
Found this issue which recommended updating the flowconfig to use the latest version from create-react-native-app. Seems to have worked for me.