Skip to content

Instantly share code, notes, and snippets.

View rileybracken's full-sized avatar
🎣

Riley Bracken rileybracken

🎣
  • Salt Lake City, Utah
View GitHub Profile
import { remCalc } from '@lib/helperMethods';
import { mergeObjectify, objectify } from '@lib/arrays';
import {
LARGE_DESKTOP,
LARGE_DESKTOP_HD,
LARGE_MOBILE,
MEDIUM_DESKTOP,
MEDIUM_DESKTOP_HD,
MEDIUM_MOBILE,
SMALL_DESKTOP,
import React from 'react';
export interface DynamicComponentProps {
_componentTypes: Record<string, any>;
name: string;
[key: string]: any;
}
const DynamicComponent = ({
_componentTypes,
const delivery = {
item: null,
};
const andAndMethod = (delivery && delivery.item && delivery.item.name) || "Untitled Product";
const typeOfMethod =(
typeof delivery != 'undefined' &&
typeof delivery.item != 'undefined' &&
typeof delivery.item.name != 'undefined' &&
const data = {
title: "company",
white: 44,
black: 3,
asian: 23,
hispanic: 5,
undefined: 25,
};
// this.props.data["white"] === 44
@rileybracken
rileybracken / app.js
Created February 8, 2016 23:14
Example of how I do logged in user session
class App extends Component {
componentDidMount() {
this._loadSession().done();
}
componentWillReceiveProps(nextProps) {
if (!this.props.userState.loggedIn && nextProps.userState.currentUser.sessionToken) {
this._setSession(nextProps.userState.currentUser.sessionToken).done();
}
}
@rileybracken
rileybracken / PerfTest.js
Last active May 5, 2017 05:08
React Native Animation Performance Test
'use strict';
import React, {
Component,
Animated,
Easing,
Dimensions,
StyleSheet
} from 'react-native';
@rileybracken
rileybracken / AnimatedPullDownHeader.js
Last active November 22, 2015 23:53
Animated Pull Down Header
/**
*
* My Attempt at the Twitter Mobile scroll and grow header interaction in
* React Native. The problem I am running into problems with the rendering
* at the top. I have tried animating translateY, top and margin top. All
* do the exact same thing. The only thing I can think to do to get around
* this is position the element at a negative margin to compensate for the
* jumping around.
*
**/
@rileybracken
rileybracken / SwitchBox.js
Last active September 3, 2015 16:58
SwitchBox
var SwitchBox = React.createClass({
propTypes: {
height: React.PropTypes.number.isRequred,
width: React.PropTypes.number.isRequred,
emitSelected: React.PropTypes.func
},
getInitialState() {
return { selected: false }
},
@rileybracken
rileybracken / MaterialSelect.js
Last active September 3, 2015 18:35
MaterialSelect
var MaterialSelect = React.createClass({
getInitialState: function() {
return {
open: false,
inputValue: this.props.placeholder,
options: this.props.options
}
},
_triggerOpen: function() {
func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView.contentOffset.y <= pointNow {
// Up
UIView.animateWithDuration(
0.0,
delay: 0.0,
options: .CurveEaseOut,
animations: {
self.addToProfileBtn.center.y = 32
},