Skip to content

Instantly share code, notes, and snippets.

@timbuckley
Created March 24, 2016 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timbuckley/a72826072163f19352ce to your computer and use it in GitHub Desktop.
Save timbuckley/a72826072163f19352ce to your computer and use it in GitHub Desktop.
How to export/include a utility function.
import { percentage } from '../utils.js'
// Component goes here.
const width = Dimensions.get('window').width;
const height = Dimensions.get('window').height;
// Note the export
export function percentage(ratio, val) {
return Math.round((ratio / 100) * val);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment