Created
December 10, 2018 02:20
-
-
Save haruelrovix/b291e8a4f34577d94e85570d304b82fe to your computer and use it in GitHub Desktop.
RNW x RNE: RNVI works like a charm with RNW!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// Generate required css | |
import iconFont from 'react-native-vector-icons/Fonts/FontAwesome.ttf'; | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
// https://github.com/oblador/react-native-vector-icons#web-with-webpack | |
const iconFontStyles = `@font-face { | |
src: url(${iconFont}); | |
font-family: FontAwesome; | |
}`; | |
// Create stylesheet | |
const style = document.createElement('style'); | |
style.type = 'text/css'; | |
if (style.styleSheet) { | |
style.styleSheet.cssText = iconFontStyles; | |
} else { | |
style.appendChild(document.createTextNode(iconFontStyles)); | |
} | |
// Inject stylesheet | |
document.head.appendChild(style); | |
ReactDOM.render(<App />, document.getElementById('root')); | |
registerServiceWorker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment