conorhastings / react-native-syntax-highlighter

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

undefined is not an object (evaluting 'topLevel[property]') #25

Open swapanil opened 4 years ago

swapanil commented 4 years ago

Simulator Screen Shot - iPhone X - 2020-08-06 at 00 16 00

AbednegoTM commented 3 years ago

@swapanil Did you get this fixed , I have the same error

AbednegoTM commented 3 years ago

Fixed this by removing "prism" from the highlighter prop value

BEFORE

<SyntaxHighlighter 
    language='javascript' 
    style={docco}
    highlighter={"prism" || "hljs"}
  >
    {codeString}
  </SyntaxHighlighter>;  

AFTER

<SyntaxHighlighter 
    language='javascript' 
    style={docco}
    highlighter={"hljs"}
  >
    {codeString}
  </SyntaxHighlighter>; 
Desintegrator commented 2 years ago

same. removing "prism" changed nothing

Desintegrator commented 2 years ago

Solved. My problem was that we cannot use just style name. We need to import appropriate stylesheet file and use it for style prop Example: import { docco } from 'react-syntax-highlighter/styles/hljs';