11
2- import React , { useState } from 'react' ;
2+ import React , { JSX , useState } from 'react' ;
33import {
44 LayoutChangeEvent ,
55 Pressable ,
@@ -13,8 +13,10 @@ import Animated, {
1313 useSharedValue ,
1414 withTiming ,
1515} from 'react-native-reanimated' ;
16- import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' ;
17- import { ghcolors , tomorrow } from 'react-syntax-highlighter/dist/esm/styles/prism' ;
16+ // temporarily disabled react-native-syntax-highlighter as it is being buggy :(
17+ // todo: resolve issues with react-syntax-highlighter
18+ // import { ghcolors, tomorrow } from 'react-syntax-highlighter/styles/prism';
19+ // import SyntaxHighlighter from 'react-native-syntax-highlighter';
1820
1921interface CodeSnippetProps {
2022 code : string ;
@@ -24,7 +26,7 @@ export default function CodeSnippet({ code }: CodeSnippetProps): JSX.Element {
2426 const colorScheme = useColorScheme ( ) ;
2527 const backgroundColor = colorScheme === 'dark' ? '#333' : '#f5f5f5' ;
2628 const color = colorScheme === 'dark' ? '#fff' : '#222' ;
27- const syntaxStyle = colorScheme === 'dark' ? tomorrow : ghcolors ;
29+ // const syntaxStyle = colorScheme === 'dark' ? tomorrow : ghcolors;
2830
2931 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
3032 const height = useSharedValue ( 0 ) ;
@@ -54,9 +56,11 @@ export default function CodeSnippet({ code }: CodeSnippetProps): JSX.Element {
5456 </ Pressable >
5557 < Animated . View style = { animatedStyle } >
5658 < View onLayout = { onLayout } style = { styles . codeContainer } >
57- < SyntaxHighlighter language = 'jsx' style = { syntaxStyle } >
59+ < Text style = { [ { color} ] } >
60+ { /* <SyntaxHighlighter language='jsx' style={syntaxStyle}> */ }
5861 { code }
59- </ SyntaxHighlighter >
62+ </ Text >
63+ { /* </SyntaxHighlighter> */ }
6064 </ View >
6165 </ Animated . View >
6266 </ View >
@@ -80,5 +84,6 @@ const styles = StyleSheet.create({
8084 top : 0 ,
8185 left : 0 ,
8286 right : 0 ,
87+ padding : 16
8388 } ,
8489} ) ;
0 commit comments