1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

react-native-web でカスタムフォントを設定する

Last updated at Posted at 2019-08-09

まえがき

font family を指定するのにすこし手こずったのでメモ。

まとめ

<style>
    body * {
        font-family: Helvetica, Arial, sans-serif !important;
    }
</style>

を HTML に指定する。

単に body に対して font-family をあててても、react-native か react-native-web が内部で指定しているっぽい sans-serif に負けてしまうので、もっと厳密に要素に対してあてる必要があった。
* を使いたくなければ、 div, span, a, input, textarea, h1, h2, h3, h4, h5, h6 { ... } って感じで使いそうな要素に対して使えばいいのではないでしょうか。たぶん。

私はグローバルなスタイルは HTML に書くか CSS ファイル用意してそこに書くかで良いんじゃないか派なのでこうしました。CSS in JS 的な書き方は知りません。

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?