Getting issue while using webview in react native Error evaluating injectedJavaScript - javascript

I am using webview for trading charts,getting the following issue as warning and url is not loading.have given the code for loading.Also video URI is working in full screen but other uri are not working.
{instrumentData.description == null ? (
<>
<WebView
ref={webviewRef}
source={{
uri: "https://github.com/facebook/react-native",
}}
/>
</>
) : null}
warning:- Error evaluating injectedJavaScript: This is possibly due to an
unsupported return type. Try adding true to the end of your injectedJavaScript
string. Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred"
UserInfo={WKJavaScriptExceptionLineNumber=2,
WKJavaScriptExceptionMessage=TypeError: undefined is not an object (evaluating
'window.ReactNativeWebView.postMessage'), WKJavaScriptExceptionColumnNumber=38,
WKJavaScriptExceptionSourceURL=undefined, NSLocalizedDescription=A JavaScript
exception occurred}

I understand that you're having an issue with react-native-webview. I did some research and I found a link from the official https://github.com/react-native-webview/react-native-webview/issues/341#issuecomment-466639820 that might help you resolve it.
I hope this helps! 😃

Related

Unknown argument type '_Bool' EAzureBlobStorageFile and Exception '*** -[__NSArrayM objectAtIndexedSubscript:]

The errors
Unknown argument type '_Bool' in method -[EAzureBlobStorageFile configure:key:container:token:]. Extend RCTConvert to support this type.
Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 3 beyond bounds [0 .. 2]' was thrown while invoking configure on target EAzureBlobStorageFile with params
and the fix of adding RCTReadString(input, "__attribute__((__unused__))") || does not apply as it was already corrected on the version im using, im working on iOS by the way
"react-native": "0.66.4"
"react-native-azure-blob-storage": "^2.0.3",
One of the workaround you can follow to resolve the above issue;
Based on the GitHub issue is the fix is to add the below code(by opening myproject /node_modules/react-native/React/Base/RCTModuleMethod.mm. ) with the upgraded version of react-native and react-native-azure-blob-storage .
Code:-
static BOOL RCTParseUnused(const char **input)
{
return RCTReadString(input, "__attribute__((unused))") ||
RCTReadString(input, "__attribute__((__unused__))") ||
RCTReadString(input, "__unused");
}
For more information please refer the below links:-
Similar SO THREAD .
Github solution|XCode 11 Beta App Launch Crash .

'MediaMetadata' is not defined no-undef and MediaMetadata is not a constructor

I've implemented playlist player using howler.js in vuejs. I want to integrate MediaMetadata API to it. MediaSession API is working fine with controls like notification bar, keyboard controls, remote devices. But I'm unable to set audio's metadata(title,artist,album,artwork) using MediaMetadata.
Followed the tutorial given github repo.
Getting below error:
error 'MediaMetadata' is not defined no-undef
I'm using chrome 57 to run it. Also tested browser compatibility with following code :
if ('mediaSession' in navigator) {
console.log("Browser supports MediaMetadata API")
navigator.mediaSession.metadata = new MediaMetadata({
title: "my_track_name",
artist: "track_artist_name",
album: "track_album_name",
artwork: "track_image",
});
} else {
console.log("Your browser doean't support MediaMetadata")
}
Above code prints Browser supports MediaMetadata API, but it continuously throwing error MediaMetadata is not defined.
I had also tried to import it from package #mdn/browser-compat-data like following :
const MediaMetadata = require("#mdn/browser-compat-data").api.MediaMetadata;
Now, it's showing below error :
Uncaught TypeError: MediaMetadata is not a constructor.
Also tried this solution but no luck, error continues.
Can anyone plese help me with this? Thanks in advance.
Fixed it by using new window.MediaMetadata({}) instead of new MediaMetadata({})

How to resolve TypeError: Cannot convert "null" to int

Error:
TypeError: Cannot convert "null" to int.
function play(connection, message){
var server = servers[message.guild.id];
server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audioonly"}));
server.queue.shift();
server.dispatcher.on("end", function(){
if(server.queue[0]){
play(connection, message);
}else {
connection.disconnect();
}
})
}
The error message I'm getting from the tester is:
TypeError: Cannot convert "null" to int
TypeError: Cannot convert "null" to int
Error: "abort(TypeError: Cannot convert "null" to int). Build with -s ASSERTIONS=1 for more info."
at (anonymous) (file:///c:/Users/pc/Documents/Discord%20Bot/node_modules/opusscript/build/opusscript_native_wasm.js:8:1741)
at emit (events.js:311:19)
I'm begging you, please help me.
Thanks.
I may have a solution for your problem!
UPDATE:
Following this answer and my bug report, prism-media released a fixed version. Thank you for such a quick solution! Keeping the text below just as a reference.
TL;DR
Find Opus.js in node_modules folder and go to line 55. You should see the following:
return this.encoder.encode(buffer, Opus.name === 'opusscript' ? null : this._options.frameSize);
CHANGE IT TO:
return this.encoder.encode(buffer, this._options.frameSize);
Then delete the same part at line 59.
Explanation
The exception is thrown in toWireType in opusscript_native_wasm.js which expects its second argument to be an int, but it gets a null. Hence, the exception.
Tracing it back, toWireType is called by OpusScriptHandler.encode for all its arguments.
Those four arguments come from OpusScript.prototype.encode in opusscript.js:69. The last argument causing the trouble (being null) is `frameSize.
The encode function is called from Opus.js:55 in prism-media which is a different module.
return this.encoder.encode(buffer, Opus.name === 'opusscript' ? null : this._options.frameSize);
There it is, the null causing all the trouble. So the exception is in fact not a fault of the opusscript package.
Long-term solutions
I reported the bug to the module owner, hopefully it gets fixed. Update: it has been fixed within a few hours! :)
Alternative solution
Using a custom loader should also work fine. It's still a hack, but more persistent :)

Nest JS Cannot read property of undefined

My application was working fine, and it stopped after trying to get the documentation with swagger, i think it may be a dependency issue, but can't find it anywhere.
I keep getting the error
10:10:22 PM - Starting compilation in watch mode...
Error Cannot read property 'getSymbol' of undefined
I don't know where getSymbol is used, and the error doesn't seem to help much. Hope someone can help me fix this issue. The complete application code can be found at:
https://github.com/JSLearningCode/enderecosAlunosAPI
Any help is welcome.
EDIT:
Running in dev mode I got this output:
/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:95877
throw e;
^
TypeError: Cannot read property 'getSymbol' of undefined
at Object.isArray (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/ast-utils.js:6:25)
at getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/plugin-utils.js:12:21)
at Object.getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/plugin-utils.js:31:29)
at ControllerClassVisitor.createTypePropertyAssignment (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:51:44)
at ControllerClassVisitor.createDecoratorObjectLiteralExpr (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:38:18)
at ControllerClassVisitor.addDecoratorToNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:29:22)
at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:16:29)
at visitNodes (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:70998:48)
at Object.visitEachChild (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:71266:355)
at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:18:23)
error Command failed with exit code 1.
There was an issue related to the routing in the application. I had a parser inside the controller that was used for directing correct routes between a route "aluno" with first Param.
Once I had taken the route with no params and put it first at the controller, there was no need anymore for the parser, and the issue was gone. Hope this answer helps more people if they get the same problem.
Please check your method result type of controller
Change this:
#Contoller()
export class MyController {
// ...
async myMethod() {
return {}
}
}
to:
#Contoller()
export class MyController {
// ...
async myMethod():Promise<any> {
return {}
}
}

Typescript SetAttribute Error

When i execute a JS code in typescript, i get the following error:
ORIGINAL EXCEPTION: TypeError: Cannot read property 'setAttribute' of
null
But It works perfectly in JS without any errors.
<HTML>
<path id="border" transform="translate(125, 125)" style="stroke:white; marker-end:url(#InverseSemicircleEnd);"/>
</HTML>
TS:
document.getElementById("border").setAttribute("style",dec);
But not sure, why it results in error on TS. I also tried to change the name of the property for this ID, but no luck. Can some one help me in explaining on what i'm doing wrong here.
Thanks For your support
Regards
Suresh
Because document.getElementById could return null, you need to check if it is different from null.
const myEl = document.getElementById("border");
if (myEl !== null) {
myEl.setAttribute("style",dec);
}
OR
document.getElementById("border")?.setAttribute("style",dec);
If you are sure that the element is defined and you want to avoid the check, use the ! (Non-null assertion) operator:
document.getElementById("border")!.setAttribute("style",dec);
Make sure that the browser has loaded before querying elements because not doing so could lead to a runtime error.
I use the following way to solve :
hideDesPan(){
let pan = (<HTMLInputElement>document.getElementById('showPan'));
pan.style.display = "none";
}

Categories

Resources