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
// 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 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 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 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 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 DOUBLE_PRESS_DELAY = 300; | |
// ... | |
/** | |
* Double Press recognition | |
* @param {Event} e | |
*/ | |
handleImagePress(e) { | |
const now = new Date().getTime(); |
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 paramsToProps from 'paramsToProps.js' | |
const MainNavigator = StackNavigator({ | |
firstScreen: { screen: paramsToProps(FirstScreenComponent) }, | |
secondScreen: { screen: paramsToProps(SecondScreenComponent) }, | |
}); |
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 paramsToProps from 'paramsToProps.js' | |
const MainNavigator = StackNavigator({ | |
firstScreen: { screen: paramsToProps(FirstScreenComponent) }, | |
secondScreen: { screen: paramsToProps(SecondScreenComponent) }, | |
}); |
NewerOlder