React Native setAllowFontScaling argument 1 has type boolean, got java.lang.Integer - reactjs

I have a heavy react native application where I am occasionally getting this error. The application has lots of images and texts but I am really unable to figure out the root cause of this issue
LOCATION ViewManagersPropertyCache.java line 100 in com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp()
EXCEPTION java.lang.IllegalArgumentException
MESSAGE method com.facebook.react.views.text.ReactTextShadowNode.setAllowFontScaling argument 1 has type boolean, got java.lang.Integer
Any help would be appreciated.

Please Use like following
import {Text} from 'react-native';
Text.defaultProps.allowFontScaling = true;
or
<Text allowFontScaling={true}> Some Test Line </Text>

Try to grep your project to search the allowFontScaling prop. It should be a boolean but if you set it to an integer that's why you are seeing this error.
grep -rn "allowFontScaling" .

Related

next.js npm module comment giving an error

This is my error
10:03:56.049 ./components/navbar.js
10:03:56.049 13:33 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
10:03:56.049 39:33 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
10:03:56.049 Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
10:03:56.051 info - Creating an optimized production build...
10:04:04.307 Failed to compile.
10:04:04.308 HookWebpackError: Unexpected '/'. Escaping special characters with \ may help.
10:04:04.308 > Build error occurred
10:04:04.309 Error: > Build failed because of webpack errors
10:04:04.309 at /vercel/path0/node_modules/next/dist/build/index.js:15:924
10:04:04.309 at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/telemetry/trace/trace.js:6:584)
10:04:04.333 Error: Command "npm run build" exited with 1
At first I thought it was coming from navbar.js but I don't see any "special characters" there, here is my navbar.js: https://pastebin.com/8XFUtL5A
So then I went and checked node_modules/next/dist/telemetry/trace/trace.js:6:584 and I found a lot of comments there: https://pastecord.com/epygazosib.js
So how do I solve this error? Because I saw a similar error someone else had but they are using angular
I have fixed this by simply removing all the comments in all my css files
In my case I made a mistake in the comments in my stylesheet page.
I had something like this
/*/*Comment*/
*/.className{
}
so removing the comment solved the bug for me.
/*Comment*/
.className{
}

React "Module Not Found" when loading a local image

I am trying to load an image using React using the following code:
const DogImage = require("../../public/dog.jpg");
console.log(DogImage);
...
<img src={DogImage} width="100px"/>
but I am getting the error:
the console log statement gives:
Please let me know if you have any suggestions or if I can provide more info!
EDIT: The file listed in the console.log (dist/8ce0...) exists when built
The path is going into the default property, which is a special property used by the import syntax. Try:
import DogImage from '../../public/dog.jpg';
OR
const DogImage = require('../../public/dog.jpg').default;
Anything else would require digging into the webpack config.

howtographql + React tutorial : Error: Cannot find module './generated/prisma.graphql'

I'm following the howtographql + React tutorial right now. I'm currently at the beginning of the tutorial when I have to define my queries, mutation and stuff in my schema.graphql. But according to the tutorial, I have to import prisma.graphql from the generatedfolder by writing the following line :
# import Link, Vote, LinkSubscriptionPayload, VoteSubscriptionPayload from "./generated/prisma.graphql"
I indeed generated the serverfolder which contains everything except this file that is supposed to be generated as well I guess.
Apparently, I should be able to run the server using yarn startbut when I'm doing so, I have this message :
Error: Cannot find module './generated/prisma.graphql'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:609:15)
at resolveFileName (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:29:39)
at resolveFrom (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:43:9)
at module.exports (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/resolve-from/index.js:46:41)
at resolveModuleFilePath (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:150:24)
at /Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:187:30
at Array.forEach (<anonymous>)
at collectDefinitions (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:185:16)
at Object.importSchema (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-import/dist/index.js:73:14)
at mergeTypeDefs (/Users/hamza/tfeScreen/reactapp/react-apollo/server/node_modules/graphql-yoga/dist/index.js:412:37)
I don't understand what I'm doing wrong...
Do you guys have any idea ?

REACT PDF: Cannot use the packages to show static PDF file

I am trying to show a static pdf in React app. I have tried a lot of packages:
react-pdf
react-pdf-js
react-pdf-js-infinite
simple-react-pdf
pdfjs-dist
react-pdf-pages
They often say that we can use the URL, or pdf file for the props for the PDF component easily, but I cannot use either.
I had two main errors.
As I want to use myPDF for the props for the component, I write this:
import myPDF from 'path/to/pdf_file';
then, render_some_component pdf:{myPDF}
Here is the error:
ModuleParseError in
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
(When I comment that line, this kind of error disappears)
I used the file-loader in webpack config, I have tried many different ways but failed.
I use the pdf file directly for the props like this:
render_some_component pdf:{'path/to/pdf_file'}
In the Console:
Warning: Setting up fake worker.
11:23:55.962 pdf.worker.js:349 Warning: Ignoring invalid character "33" in hex string
11:23:55.963 pdf.worker.js:349 Warning: Ignoring invalid character "79" in hex string
...
There are a lot of 'Ignoring invalid character' like that and it always ends with:
localhost/:1 Uncaught (in promise) InvalidPDFException {name: "InvalidPDFException", message: "Invalid PDF structure"}
In the Network, Headers, I see:
Request URL:http://localhost:3000/myPdfFile.pdf
Request Method:GET
Status Code:200 OK
Remote Address:127.0.0.1:3000
but In the Network, Response, I see just the HTML layout.
I think the pdf file is loaded correctly but the package cannot recognize its PDF structure.
Except that two main errors, I had another error related to the Worker used in the packages but I don't know how to fix it:
Uncaught DOMException: Failed to construct 'Worker'
(This is something relates to Chrome as people say Chrome does not allow Worker in the local server)
Any help is highly appreciated as I am stuck in this in 4 days already.
Can you pleas clarify what you main task is?
If I understood it right you want to display a PDF file that already exists in a part of your application? You don't want to create a new PDF with JavaScript.
If you want to just show a PDF have you tried to use iframe?
Something like this:
<iframe
title="file"
style={{ width: '100%', height: '100%' }}
src={downloadURL}
/>
You ca use here also relative paths to the file from the location where your Component is or use full URLs to the file.

Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '\"movie'

I'm trying to test my Rails/Angular app in production Rails server and I'm getting an error in my console I don't know how to fix.
The error is,
Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '\"movie'.
The line of code,
%li.animate-repeat.search_results{"ng-if" => " movie.poster_path && movie.release_date", "ng-repeat" => "movie in movieList | orderBy:'-release_date'"}
The error is resolved when I remove the | orderBy:'-release_date' but obviously that's a filter I need.
Is there a good reason why this error is occuring?
You should check very well , all ng-repeats , specially if you have more than one ng-repeat within your page, I had the same error until I scan through my code carefulyl and found the issue
I read this from Here

Resources