Skip to content

Instantly share code, notes, and snippets.

View asgvard's full-sized avatar

Dmitriy Bryokhin asgvard

View GitHub Profile
@asgvard
asgvard / RootResponder.js
Created March 2, 2018 12:07
Root responder for global interception of touch events in RN
/**
* Wrapper for creating Global (RootContainer) PanResponder
* Responder events are bubbled up by the View hierarchy, but sometimes it's needed to "move"
* touch handling to a sibling component. Instead we're creating Root Responder to capture the touch and
* delegate the callbacks to any component that wants to listen to it.
*
* Any component in the App can hook into the Root Responder lifecycle callbacks
* For capturing of the Root Responder the *Capture callbacks should return true
*
* Only one component at a time can be attached to Root Responder
@asgvard
asgvard / FlatSwiper.js
Created November 10, 2017 20:48
Horizontal Paging Swiper based on FlatList
/**
* TODO Finish this for optimized Android swiping
* Inspired by react-native-swiper but based on cross-platform and optimized FlatList
*/
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
FlatList,
@asgvard
asgvard / ReactNativeComponentBoilerplate.js
Last active September 7, 2017 12:21
React Native Component Boilerplate
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
View,
StyleSheet
} from 'react-native';
const styles = StyleSheet.create({
});