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
// Redux + Redux Persist | |
const App = () => ( | |
<Provider store={store}> | |
<PersistGate loading={null} persistor={persistor}> | |
<Routes /> | |
</PersistGate> | |
</Provider> | |
); |
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
// Recuperação de Registros com o Async Storage | |
try { | |
const value = await AsyncStorage.getItem('TASKS'); | |
if (value !== null) { | |
// We have data!! | |
console.log(value); | |
} | |
} catch (error) { | |
// Error retrieving data |
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
// Exemplo de uso do RealmDB | |
let realm = new Realm({ schema: [Person] }); | |
realm.addListener((sender, name) => { | |
if (name === 'change') { | |
this.setState({ source: sender.objects('Dog') }); | |
} | |
}); |
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: 'ADD_REQUEST', | |
payload: { | |
id: 1 | |
data: { username: 'csorlandi', email: 'claudio@rocketseat.com.br', password: '123456' }, | |
}, | |
meta: { | |
retry: true | |
} | |
} |
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'; | |
export default class Main extends Component { | |
state = { | |
docs: [], | |
page: 1, | |
productInfo: {}, | |
} | |
componentDidMount() { |
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
render() { | |
return ( | |
<View style={styles.container}> | |
<View style={styles.insideContainer}> | |
<StatusBar | |
barStyle="light-content" | |
backgroundColor={styles.container.backgroundColor} | |
/> | |
<Text style={styles.title}>{I18n.t("HOME_pageTitle")}</Text> | |
<Text style={styles.language}> |
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 RNLanguages from "react-native-languages"; | |
import i18n from "i18n-js"; | |
import en from "../config/translations/en.json"; | |
import pt from "../config/translations/pt.json"; | |
i18n.locale = RNLanguages.language; | |
i18n.fallbacks = true; | |
i18n.translations = { en, pt }; |
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
{ | |
"HOME_pageTitle": "Multi Language App", | |
"HOME_pageDescription": "The current language is \"{{language}}\"", | |
"HOME_nameInputPlaceholder": "Your Email Here", | |
"HOME_emailInputPlaceholder": "Your Password Here", | |
"HOME_loginButtonText": "Login", | |
"HOME_toggleButton": "Toggle Language", | |
"HOME_languageDescription": "Language" | |
} |
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
{ | |
"HOME_pageTitle": "App Multi Idioma", | |
"HOME_pageDescription": "O idioma atual é \"{{language}}\"", | |
"HOME_nameInputPlaceholder": "Digite seu email aqui", | |
"HOME_emailInputPlaceholder": "Digite sua senha aqui", | |
"HOME_loginButtonText": "Entrar", | |
"HOME_toggleButton": "Mudar Idioma", | |
"HOME_languageDescription": "Idioma" | |
} |