mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-06-21 14:08:31 -04:00
Support custom font in UserText (#454)
This commit is contained in:
@@ -2,8 +2,8 @@ import linkifyHtml from "linkify-html";
|
||||
import { trim } from "lodash";
|
||||
import MarkdownIt from "markdown-it";
|
||||
import * as React from "react";
|
||||
import { useWindowDimensions } from "react-native";
|
||||
import HTML from "react-native-render-html";
|
||||
import { Platform, useWindowDimensions } from "react-native";
|
||||
import HTML, { defaultSystemFonts } from "react-native-render-html";
|
||||
import WebView from "react-native-webview";
|
||||
import sanitizeHtml from "sanitize-html";
|
||||
|
||||
@@ -107,13 +107,21 @@ const UserText = ( {
|
||||
// <code>
|
||||
|
||||
html = linkifyHtml( html, LINKIFY_OPTIONS );
|
||||
const baseStyle = {
|
||||
fontFamily: `Whitney-Light${Platform.OS === "ios" ? "" : "-Pro"}`,
|
||||
fontSize: 16,
|
||||
lineHeight: 22,
|
||||
...htmlStyle
|
||||
};
|
||||
const fonts = ["Whitney-Light", "Whitney-Light-Pro", ...defaultSystemFonts];
|
||||
|
||||
return (
|
||||
<HTML
|
||||
baseStyle={htmlStyle}
|
||||
baseStyle={baseStyle}
|
||||
contentWidth={width}
|
||||
source={{ html }}
|
||||
WebView={WebView}
|
||||
systemFonts={fonts}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user