grabcode / react-native-web-starter

Starter for a React Native for Web project (RN4Web)
Other
228 stars 36 forks source link

How I should use custom fonts? #11

Closed 6pm closed 8 years ago

6pm commented 8 years ago

Hello. I want to include in my app custom font. How best way to do this with your great starter kit? Thank you!

faceyspacey commented 8 years ago

add it to /web/src/index.html so your code looks like this:

<!DOCTYPE html>
<meta charset="utf-8">
<title>React Native for Web</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<div id="react-root"></div>
<script src="/bundle.js"></script>
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">

then specify the font family property like this: <Text style={{fontFamily: Montserrat}}>sexy</Text>

and done.

grabcode commented 8 years ago

Thanks @faceyspacey. Great question @6pm, it's giving me the idea of a FAQ.