Skip to content

Instantly share code, notes, and snippets.

View bogoslavskiy's full-sized avatar

Artem Bogoslavskiy bogoslavskiy

View GitHub Profile
import React, { Component } from "react";
import {
StyleSheet,
Text,
TouchableOpacity,
View,
ScrollView
} from "react-native";
import Modal from "react-native-modal";
import { Viewport, getStatusBarHeight } from '../utils';
import React from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
Button,
FlatList,
Keyboard,
ActivityIndicator,
import React from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
InputAccessoryView,
Button,
ScrollView,
Dimensions,
import React from 'react';
import { View, StyleSheet, ActivityIndicator } from 'react-native';
import { FlatList } from '../searchBarAnimation';
import { List, ListItem } from 'react-native-elements';
export default class Tab extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
class FlatListHelper extends React.PureComponent {
[...]
_onScrollEndDrag = e => {
if(e.nativeEvent.velocity.y == 0) {
this.props.animation.handleIntermediateState(this.scrollToOffset);
}
};
[...]
class FlatListHelper extends React.PureComponent {
[...]
_onMomentumScrollBegin = () => this.props._canJumpToTab(false);
_onMomentumScrollEnd = () => this.props._canJumpToTab(true);
[...]
render() {
export default class SearchBarProvider extends React.Component {
constructor(props) {
super(props);
[...]
this.state = {
currentTab: null,
canJumpToTab: true,
contextProvider: {
animation: this.searchBarAnimation.animationProps,
[...]
_renderHeader = (animation, canJumpToTab) => props => (
<SearchBar
animation={animation}
changeInputFocus={suggestionFocus =>
this.setState({suggestionFocus})
}
renderTabBar={() => (
<TabBar
onTabPress={({route}) => {
_updateScroll = ({value, manually}) => {
if(value && manually) {
this._clampedScrollValue = value;
} else {
const diff = value - this._scrollValue;
this._scrollValue = Math.max(value, this.topPartHeight); // Fix normal state
this._clampedScrollValue = Math.min(
Math.max(this._clampedScrollValue + diff, this.minClamp),
this.maxClamp
);
_handleIntermediateState = (scrollToOffset) => {
let scrollY = this.scrollY._value;
if(scrollY < this.topPartHeight) { // Full
scrollToOffset(scrollY > (this.topPartHeight / 2) ? this.topPartHeight : 0);
} else { // Clamped
if(
this._clampedScrollValue < this.maxClamp &&
this._clampedScrollValue > this.minClamp
) {
let scrollTo;