conorhastings / react-native-syntax-highlighter

a syntax highlighter for react native using https://github.com/conorhastings/react-syntax-highlighter under the hood
MIT License
167 stars 25 forks source link

Fix spurious console log errors (Uncaught SyntaxError: Unexpected token o in JSON at position 1) #34

Closed chrisglein closed 10 months ago

chrisglein commented 1 year ago

On the console you'll see a lot of errors like this:

Uncaught SyntaxError: Unexpected token o in JSON at position 1

The reason for that can be found here: https://github.com/PrismJS/prism/issues/1303 This PR applies the recommended fix for that thread and also tried with this PR: https://github.com/conorhastings/react-native-syntax-highlighter/pull/32

The fix is to add a prism-config.js that sets disableWorkerMessageHandler: true

Fixes #12

KonstantinZhukovskij commented 1 year ago

It didn't help me. I still get an error. Are you sure it works?

chrisglein commented 1 year ago

It didn't help me. I still get an error. Are you sure it works?

It worked for me? How did you test it? It should be the same as the fix suggested here (but reduced): https://github.com/conorhastings/react-native-syntax-highlighter/pull/32

KonstantinZhukovskij commented 1 year ago

Done in exactly the same way, in the debug mode there is still an error.

chrisglein commented 1 year ago

Done in exactly the same way, in the debug mode there is still an error.

Looks like the misunderstanding of how to test the patch was answered here: https://github.com/conorhastings/react-native-syntax-highlighter/pull/32#issuecomment-1492429449

@conorhastings, what would it take to get this PR merged?

chrisglein commented 10 months ago

@conorhastings Ping on what it would take to get this merged?

conorhastings commented 10 months ago

@chrisglein sorry i haven't used this library in a long time, i invited you as a collaborator, if there is some permission i missed please let me know but happy to give you merge ability, if you give me your npm handle i can add you three as well

chrisglein commented 10 months ago

@chrisglein sorry i haven't used this library in a long time, i invited you as a collaborator, if there is some permission i missed please let me know but happy to give you merge ability, if you give me your npm handle i can add you three as well

I accepted the invite, thanks. Happy to try to help. For npm, this is me.

conorhastings commented 10 months ago

@chrisglein invited you as a maintainer, let me know if it didnt go through

jcubic commented 7 months ago

Does it mean that the library has an active maintainer?

chrisglein commented 6 months ago

Does it mean that the library has an active maintainer?

As someone who's using the module, I'll try to help out. But there's a lot on my plate.

jcubic commented 6 months ago

I created a PR, but someone needs to merge it and release a new version.

Anyway, I created a fork and published it to NPM with my fix included. This is the only way to handle unmaintained projects.