相关疑难解决方法(0)

在React本机Webview中使用自定义字体

我在我的整个React本机应用程序中使用自定义字体.我使用react-native link命令链接了它们.除了Android的Webview组件之外,它们可以在任何地方工作.它在iOS Webview中正常运行.

import React, { Component } from "react"
import { View, StyleSheet, Text, WebView, ScrollView, Image } from "react-native"
import HTMLView from "react-native-htmlview"

export class PostDetailPage extends Component {

  static navigationOptions = {
    title: ({ state }) => state.params.post.title,
    header: {
      style: {
        backgroundColor: '#FF9800',
      },
      titleStyle: {
        color: 'white',
        fontFamily: "Ekatra",
        fontWeight: "normal"
      },
      tintColor: 'white'
    }
  }

  constructor(props) {
    super(props)
  }

  render() {
    const post = this.props.navigation.state.params.post
    const html = `
      <!DOCTYPE html>
      <html>
      <head>
        <style …
Run Code Online (Sandbox Code Playgroud)

css fonts android webview react-native

8
推荐指数
1
解决办法
6284
查看次数

标签 统计

android ×1

css ×1

fonts ×1

react-native ×1

webview ×1