Skip to content

Instantly share code, notes, and snippets.

View hadnazzar's full-sized avatar
:electron:
Force be with you.

Melih Yumak hadnazzar

:electron:
Force be with you.
View GitHub Profile
Medium test gist
import React, { Component } from 'react';
import { Text, View, StyleSheet, Button, Alert } from 'react-native';
import { Constants, Google } from 'expo';
export default class App extends Component {
_handleGoogleLogin = async () => {
try {
const result = await Expo.Google.logInAsync({
androidClientId: 'AndroidClientID.apps.googleusercontent.com',
iosClientId: 'IosClientId.apps.googleusercontent.com',
const test = async _ => {
const promises = [getOne(), getTwo(), getThree()]
console.log(‘Now’)
const [one, two, three] = await Promise.all(promises)
console.log(one)
console.log(two)
console.log(three)
console.log(‘Done’)
}
test()
@hadnazzar
hadnazzar / expo-localization-with-i18next.js
Created June 11, 2019 15:12
expo localization with i18next
import { Localization } from 'expo';
import i18n from 'i18next';
import { reactI18nextModule } from 'react-i18next';
const resources = {
fr: {
foo: 'como telle fous',
bar: 'chatouiller {{someValue}}',
},
en: {
@hadnazzar
hadnazzar / i18-next-sample.js
Created June 11, 2019 15:30
example i18next in react
import React from 'react';
import { withNamespaces } from 'react-i18next';
function TranslatableView(props) {
const { t, tReady } = props;
// tReady is true if translations were loaded.
// Use wait option to not render before loaded
// or render placeholder yourself if not tReady=false
return (
import React from 'react';
import Router from './Router'
import './App.css';
import { BrowserRouter } from "react-router-dom";
function App() {
return (
<BrowserRouter>
<Router />
@hadnazzar
hadnazzar / Router.js
Last active June 14, 2019 14:32
React-router example
import React from 'react';
import { Route, Switch } from "react-router-dom";
import Home from './pages/Home';
const About = () => <div>About</div>;
const Contact = (props) => <div>{`${props.extra}`}</div>;
const NotFound = () => <div>Not found page</div>;
const Router = () => {
import React from 'react';
import logo from '../logo.svg';
import { Link } from 'react-router-dom'
function Home() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
import React from 'react';
import {
BrowserRouter,
Route,
Switch,
Redirect
} from 'react-router-dom';
import decode from 'jwt-decode';
import Home from './Home';
import React from 'react';
import './App.css';
import { Provider } from 'react-redux'
import store from './store'
import Home from './pages/Home'
function App() {
return (
<Provider store={store}>
<Home/>