This file contains hidden or 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
// Here is a function that I use all the time when creating public | |
// async APIs in JavaScript: | |
const resolvePromise = (promise, callback) => { | |
if (callback) | |
promise.then(value => callback(null, value), callback) | |
return promise | |
} | |
// Sometimes I like to use callbacks, but other times a promise is |
This file contains hidden or 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 cameraValid = camera => | |
camera && camera.geometry && Array.isArray(camera.geometry.coordinates); | |
// Workaround for Mapbox issue | |
// https://github.com/mapbox/react-native-mapbox-gl/issues/1126 | |
export const enforceIntegerPadding = padding => | |
padding.map(value => parseInt(value, 10)); | |
export const isValidBounds = camera => | |
camera && |
This file contains hidden or 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 { renderToString, renderToStaticMarkup } from 'react-dom/server' | |
import ApolloClient, { createNetworkInterface, } from 'apollo-client' | |
import { ApolloProvider, getDataFromTree } from 'react-apollo' | |
// Apollo Setup | |
const networkInterface = createNetworkInterface({ | |
uri: process.env.GRAPHCOOL_API | |
}) |
This file contains hidden or 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
// ES6 module syntax | |
import LocalizedStrings from 'react-native-localization'; | |
let AppStrings = new LocalizedStrings({ | |
'en-US': { | |
settingMenuOptionOne: 'Centimeters ({0})', | |
}, | |
en: { | |
settingMenuOptionOne: 'Centimeters ({0})', | |
}, |
This file contains hidden or 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
// useFetch.ts | |
import { useEffect, useState } from 'react' | |
export interface IPosts { | |
userId: number; | |
id: number; | |
title: string; | |
body: string; | |
} |
This file contains hidden or 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, { useReducer, useContext, ReactNode } from 'react' | |
import { Text, View, TouchableOpacity, StyleSheet } from 'react-native' | |
const initialArg = 0 | |
type Action = | |
| { type: 'increment' } | |
| { type: 'decrement' } | |
| { type: 'set'; count: number } |
This file contains hidden or 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 { AsyncStorage } from 'react-native' | |
import react, { useEffect } from "react" | |
import { useState } from 'react' | |
import { useNetInfo } from './useNetInfo'; | |
export const getData = async (key: string) => { | |
try { | |
const value = await AsyncStorage.getItem(key) | |
if (value !== null) { | |
return JSON.parse(value) |
This file contains hidden or 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
# Fastfile | |
# | |
# Author: Ronaldo Lima <[email protected]> | |
# | |
# ----------------------------------------------------------- | |
# | |
# Version bumping, the default type is `patch` | |
# Run: | |
# `fastlane ios bump` | |
# `fastlane ios beta [type:major|minor|patch]` |