Closed tharpooljha closed 9 months ago
I am having difficulty tackling this as well, some help would be appreciated
Maybe there could be a default style prop for this?
import React, {FunctionComponent, useEffect, useState} from "react"; import Markdown from "react-native-markdown-display";
interface AppState {
darkmode?: boolean,
}
export const ThemedMarkdown: FunctionComponent
let darkMode = false;
if(props.darkmode !== undefined){
darkMode = props.darkmode
}
let darkModeTextColor = "white"
let lightModeTextColor = "black";
let textColor = darkMode ? darkModeTextColor : lightModeTextColor;
let fontSize = "18"; // or what you whish
//TODO add more adjustments
const style = {
text: {
color: textColor
},
body: {
backgroundColor: "transparent",
fontSize: fontSize
},
blockquote: {
backgroundColor: 'transparent',
},
code_inline: {
color: textColor,
backgroundColor: 'transparent',
},
}
return(
<Markdown
style={style}
>
{props.children}
</Markdown>
)
}
What is best way to handle dark mode?