Skip to content

Instantly share code, notes, and snippets.

View jennmueng's full-sized avatar
👽

Jenn Mueng jennmueng

👽
View GitHub Profile
@jennmueng
jennmueng / dragger.js
Created February 3, 2019 15:30
Snippet for the dragger animations.
// @flow
...
/*
this.animationKey is transitioned between 3 values: 0, 1, and 2.
0 is when dragger is not active.
1 is when a touch is active on dragger but not attached to a dropzone.
2 is when a touch is active on dragger and attached to dropzone.
*/
@jennmueng
jennmueng / webview.js
Created February 13, 2019 05:12
Webview scroll issue
// @flow
import React, { Component } from 'react';
import { WebView } from 'react-native-webview';
import styled from 'styled-components';
import { connect } from 'react-redux';
import * as Animatable from 'react-native-animatable';
import Reactotron from 'reactotron-react-native';
import type { NavigationScreenProp } from 'react-navigation';
import type { DeviceProps } from '../../../flow/general';
@jennmueng
jennmueng / authStack.js
Created March 7, 2019 09:56
The stack navigator and its transitioner for Tour's authentication stack.
// @flow
import React, { Component } from 'react';
import { createStackNavigator, NavigationActions, StackActions } from 'react-navigation';
import styled from 'styled-components';
import { connect } from 'react-redux';
import type { NavigationScreenProp, DeviceProps } from '../../../flow/general';
import Main from './screens/main';
import EmailLogin from './screens/emailLogin';
const instanceFactory = (x) => {
this.a = 10;
this.b = x * 5;
this.c = () => {
return a + b;
}
}
const instance = new instanceFactory(3);
// basically returns an object with the following values appended to this.
// @flow
import React from 'react';
import { Animated } from 'react-native';
import styled from 'styled-components';
import type { DeviceProps } from '../../../flow/general';
import Stockholm from '../../assets/stockholm/stockholm';
import IconButton from '../feedback/iconButton';
// @flow
import React, { PureComponent } from 'react';
import styled from 'styled-components';
import { connect } from 'react-redux';
import memoize from 'memoize-one';
import * as Animatable from 'react-native-animatable';
import { type PlannerTravel, type TravelType, type PlannerEntity } from '../../../../../../flow/planner';
import { type Flight } from '../../../../../../flow/flights';
class HoverableTouchable extends PureComponent {
hoverOpacity = new Animated.Value(1);
onMouseEnter = () => {
Animated.timing(this.hoverOpacity, {
toValue: 0.3,
duration: 100,
useNativeDriver: true // not available on web, make a check here, something like Platform.OS === 'web' ? ...
}).start()
}
onMouseLeave = () => {
// @flow
import React, { Component } from 'react';
import { StyleSheet } from 'react-native';
import * as Animatable from 'react-native-animatable';
import MaskedView from '@react-native-community/masked-view';
import Svg, { Path } from 'react-native-svg';
import moment from 'moment-timezone';
import styled from 'styled-components';
import { BlurView } from '@react-native-community/blur';
import { connect } from 'react-redux';
// @flow
import * as Sentry from '@sentry/react-native';
import type { Store } from 'redux';
type Action = {
type: string
};
type State = {};
setAnchor = (anchorPos: 'small' | 'medium' | 'full') => {
switch (anchorPos) {
case 'full':
// Keyboard must always be dismissed for full map anchor.
Keyboard.dismiss();
// Scroll to top for full map anchor
if (this.scrollContainer) {
this.scrollContainer.getNode().scrollTo({ y: 0, animated: true });
}