Skip to content

Instantly share code, notes, and snippets.

View FreddyPoly's full-sized avatar
🍎

Frédéric Llorca FreddyPoly

🍎
  • 23:40 (UTC +02:00)
View GitHub Profile
@FreddyPoly
FreddyPoly / colors.xml
Created July 5, 2019 12:59
[REACT NATIVE] Splash Colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#000000</color>
</resources>
@FreddyPoly
FreddyPoly / launch_screen.xml
Created July 5, 2019 12:56
[REACT NATIVE] Splash Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/launch_screen"
android:orientation="vertical">
</LinearLayout>
@FreddyPoly
FreddyPoly / component.tsx
Created July 5, 2019 09:52
[REACT NATIVE] Env Var Usage Example
import * as React from "react"
import { View, Text } from "react-native"
import * as env from "../../environment-variables"
export class ComponentTest extends React.Component<{}, {}> {
render() {
return (
<View>
<Text>
@FreddyPoly
FreddyPoly / enivronment-variables.ts
Created July 5, 2019 09:48
[REACT NATIVE] Env Var Setup Example
//
// Load environment variables in.
//
// IMPORTANT:
//
// 1. These might be null, so fallback to sane defaults accordingly where you
// make use of these.
//
// 2. You must use this syntax: process.env.NAME_OF_ENV_VAR. No funny stuff
// or the babel plugin won't work.
@FreddyPoly
FreddyPoly / component.tsx
Created July 5, 2019 09:26
[REACT NATIVE] Font Family Montserrat
...
const TEXT: TextStyle = {
color: "#373737",
fontFamily: "Montserrat-Bold",
}
...
render() {
return (
...
@FreddyPoly
FreddyPoly / component.tsx
Created July 5, 2019 09:08
[REACT NATIVE] Validate.JS Usage Example
import * as React from "react"
import { View, TextInput, TouchableOpacity } from "react-native"
import * as validate from "../../utils/validate"
export interface Props extends NavigationScreenProps<{}> {}
export interface State {
form: {
textInput: string;
@FreddyPoly
FreddyPoly / component.tsx
Created July 4, 2019 13:36
[REACT NATIVE] react-native-localize Usage Example
import * as React from "react"
import { View, Image, ViewStyle, TextStyle, ImageStyle, SafeAreaView } from "react-native"
import { NavigationScreenProps } from "react-navigation"
import { Text } from "../../components/text"
import { Button } from "../../components/button"
import { Screen } from "../../components/screen"
import { Wallpaper } from "../../components/wallpaper"
import { Header } from "../../components/header"
import { color, spacing } from "../../theme"
import { bowserLogo } from "./"
@FreddyPoly
FreddyPoly / component.tsx
Created July 1, 2019 10:00
[REACT NATIVE] Keychain Usage Example
import * as React from "react"
import { View } from "react-native"
import * as keychain from "../../utils/keychain"
export class FirstExampleScreen extends React.Component<{}, {}> {
componentWillMount = async () => {
// Sauvegarde des logs
await keychain.save('[email protected]', '123456');
await keychain.save('[email protected]', '12345', 'server1');
await keychain.save('[email protected]', '123457', 'server2');
@FreddyPoly
FreddyPoly / component.tsx
Created July 1, 2019 09:35
[REACT NATIVE] i18n Usage Component Example
import * as React from "react"
import { View, Text } from "react-native"
import { translate } from "../../i18n/"
export class FirstExampleScreen extends React.Component<{}, {}>
render() {
return (
<View>
// JSX...
<Text>
@FreddyPoly
FreddyPoly / i18n.ts
Created July 1, 2019 09:24
[REACT NATIVE] i18n setup example
import * as RNLocalize from "react-native-localize"
import i18n from "i18n-js"
const en = require("./en")
const ja = require("./ja")
i18n.fallbacks = true
i18n.translations = { en, ja }
const fallback = { languageTag: "en", isRTL: false }