Skip to content

Instantly share code, notes, and snippets.

View ashrithks's full-sized avatar

Ashrith K S ashrithks

  • Cisco Systems
  • Bangalore
View GitHub Profile
@ashrithks
ashrithks / nestedScrollview
Created October 31, 2017 13:55
nestedScrollview in react native
import React, { Component } from 'react';
import { View, ScrollView } from 'react-native';
export default class App extends Component {
constructor() {
super();
this.state = {
enabled:true
};
}
const TransitionConfiguration = () => {
return {
transitionSpec: {
duration: 750,
easing: Easing.out(Easing.poly(4)),
timing: Animated.timing,
useNativeDriver: true,
},
screenInterpolator: (sceneProps) => {
const { layout, position, scene } = sceneProps;
moveToExpand = () => {
this.props.navigation.navigate('CollapseExpand', { transition: 'collapseExpand' });
}
moveToSlideFromRight = () => {
this.props.navigation.navigate('SlideFromRight');
}
let CollapseExpand = (index, position) => {
const inputRange = [index - 1, index, index + 1];
const opacity = position.interpolate({
inputRange,
outputRange: [0, 1, 1],
});
const scaleY = position.interpolate({
inputRange,
outputRange: ([0, 1, 1]),
let SlideFromRight = (index, position, width) => {
const inputRange = [index - 1, index, index + 1];
const translateX = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [width, 0, 0]
})
const slideFromRight = { transform: [{ translateX }] }
return slideFromRight
};