Skip to content

Commit be3c604

Browse files
committed
Supp
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: PrismJS/prism#1303 This PR applies the recommended fix for that thread and also tried with this PR: conorhastings#32 The fix is to add a prism-config.js that sets `disableWorkerMessageHandler: true` Fixes conorhastings#12
1 parent 8bcb035 commit be3c604

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { Text, ScrollView, Platform } from 'react-native';
3+
import "./prism-config.js";
34
import SyntaxHighlighter from 'react-syntax-highlighter';
45
import SyntaxHighlighterPrism from 'react-syntax-highlighter/prism';
56
import { createStyleObject } from 'react-syntax-highlighter/create-element';
@@ -123,7 +124,8 @@ function createNativeElement({ node, stylesheet, key, defaultColor, fontFamily,
123124
stylesheet
124125
);
125126
const children = childrenCreator(node.children, style.color || defaultColor);
126-
return <Text key={key} style={style}>{children}</Text>;
127+
// ellipsizeMode='none' is a workaround for bug #68 (newlines at the end are showing ellipses)
128+
return <Text key={key} style={style} ellipsizeMode='none'>{children}</Text>;
127129
}
128130
}
129131

src/prism-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global.Prism = { disableWorkerMessageHandler: true };

0 commit comments

Comments
 (0)