Skip to content

Instantly share code, notes, and snippets.

View alexbrillant's full-sized avatar
🎯
Focusing

Alexandre Brillant alexbrillant

🎯
Focusing
  • Québec, Canada
View GitHub Profile
@alexbrillant
alexbrillant / CircleTransitionRendering.js
Created February 16, 2017 00:10
CircleTransitionRendering
<CircleTransition
  ref={circle => this.circleTransition = circle}
  color={‘blue’}
  expand={true}
  callback={() => {
  // change the scene here. the callback will be called before the circle is hidden 
  }}
/>
@alexbrillant
alexbrillant / gist:85da8019acf13d7aa7b2a3547e3d870f
Created February 16, 2017 00:17
Trigger circle transition animation
handlePress () {
this.circleTransition.start()
}
handlePress () {
this.circleTransition.start()
}
@alexbrillant
alexbrillant / CircleTransitionJest.js
Created February 16, 2017 00:35
Circle transition animation jest test
import 'react-native'
import React from 'react'
import CircleTransition from '../CircleTransition.js'
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer'
const positionTest = (position) => {
const tree = renderer.create(
<CircleTransition
import React, {
Component
} from 'react'
import {
AppRegistry,
Easing,
StyleSheet,
Text,
Image,
@alexbrillant
alexbrillant / zIndexExemple.js
Last active February 19, 2017 10:15
zindex exemple
import React, {
Component
} from 'react'
import {
AppRegistry,
Easing,
StyleSheet,
Text,
Image,
import {Dimensions} from 'react-native'
const {width, height} = Dimensions.get('window')
const calculateFontSizeForAScreenSizePercentage = (percentage) => {
return Math.sqrt((width * width) + (height * height)) * (percentage / 100)
}
const baseUnit = calculateFontSizeForAScreenSizePercentage(2.5)
const em = (value) => {
import update from 'immutability-helper';
import {cloneDeep} from 'lodash';
const selectedChoice = {isChosen: true};
const choices = [selectedChoice, selectedChoice, selectedChoice];
const options = {choices: choices};
const selectedOptions = [options, options];
const OPTION_INDEX = 0;
const CHOICE_INDEX = 1;
import { ACTION_TYPES } from '../actions/branchActions';
const {
NEAREST_BRANCH_SUCCESS,
NEAREST_BRANCH_REQUEST,
NEAREST_BRANCH_FAILURE
} = ACTION_TYPES;
export const INITIAL_STATE = { searching: false, nearestBranch: null };
export default (state = INITIAL_STATE, action) => {
import {
nearestBranchRequest,
nearestBranchSuccess,
nearestBranchFailure,
INITIAL_STATE
} from '../branchReducer';
describe('branch reducer tests', () => {
it('given latitude and longitude when nearestBranchRequest then should set latitude, longitude and searching to true', () => {
const latitude = 1;