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, { Component } from 'react' | |
import { Text, View } from 'react-native' | |
import styles from './styles' | |
import { translate } from './locales' | |
class App extends Component { | |
render() { | |
return ( | |
<View style={styles.container}> |
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
// en-US.js | |
export default = { | |
hello: 'Hello World', | |
} | |
// pt-BR.js | |
export default = { | |
hello: 'Olá Mundo', | |
} |
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 { Platform, NativeModules } from 'react-native' | |
import I18n from 'i18n-js' | |
import en from './en-US' // importa o objeto de traduções para o idioma inglês | |
import pt from './pt-BR' // importa o objeto de traduções para o idioma português | |
// Função que irá nos auxiliar a normalizar as traduções que serão recebidas pela função getLanguageByDevice | |
// Isso é necessário pois no android e no iOS o retorno do mesmo idioma pode ser diferente | |
// Exemplo: no iOS podemos receber pt_US e no android pt_BR para o idioma português Brasil. | |
const normalizeTranslate = { | |
'en_US': 'en_US', |
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
{ | |
type: 'h1', | |
props: { className: 'title' }, | |
children: ['Hello World'], | |
} |
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
React.createElement( | |
"h1", | |
{ className: "title" }, | |
"Hello World" | |
); |
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
<h1 className="title">Hello World</h1> |
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
var nav = React.createElement( | |
"nav", | |
{ className: "menu" }, | |
React.createElement( | |
"ul", | |
null, | |
React.createElement( | |
"li", | |
null, | |
React.createElement( |
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
const nav = ( | |
<nav className="menu"> | |
<ul> | |
<li><a href="#">Home</a></li> | |
<li><a href="#">About</a></li> | |
</ul> | |
</nav> | |
) |