Slava
``
/* eslint-disable lines-between-class-members */
/* eslint-disable react/require-optimization */
import * as R from 'ramda';
import React, {Component} from 'react';
import {
Animated,
Dimensions,
Platform,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import {shallowEqual, useSelector} from 'react-redux';
import {LabelText} from 'uiComponents/LabelText';
import {HeaderApp} from './component/HeaderApp';
import {MapScreenView} from './component/MapScreenView';
const IMAGE_HEIGHT = Dimensions.get('window').height - 75;
// TODO HEIGHT VALUE
// R.pipe(R.path(['garage', 'value']), isOdd, R.not)(garage)? Dimensions.get('window').height
const HEADER_HEIGHT = Platform.OS === 'ios' ? 64 : 50;
const SCROLL_HEIGHT = IMAGE_HEIGHT - HEADER_HEIGHT;
const THEME_COLOR = '#ff6100';
const FADED_THEME_COLOR = 'green';
export class Maps extends Component {
nScroll = new Animated.Value(0);
scroll = new Animated.Value(0);
textColor = this.scroll.interpolate({
inputRange: [0, SCROLL_HEIGHT / 5, SCROLL_HEIGHT],
outputRange: [THEME_COLOR, FADED_THEME_COLOR, 'red'],
extrapolate: 'clamp',
});
tabBg = this.scroll.interpolate({
inputRange: [0, SCROLL_HEIGHT],
outputRange: ['white', THEME_COLOR],
extrapolate: 'clamp',
});
tabY = this.nScroll.interpolate({
inputRange: [0, SCROLL_HEIGHT, SCROLL_HEIGHT + 1],
outputRange: [0, 0, 1],
});
headerBg = this.scroll.interpolate({
inputRange: [0, SCROLL_HEIGHT, SCROLL_HEIGHT + 1],
outputRange: ['transparent', 'transparent', THEME_COLOR],
extrapolate: 'clamp',
});
imgScale = this.nScroll.interpolate({
inputRange: [-25, 0],
outputRange: [1.1, 1],
extrapolateRight: 'clamp',
});
imgOpacity = this.nScroll.interpolate({
inputRange: [0, SCROLL_HEIGHT],
outputRange: [1, 0],
});
heights = [500, 500];
constructor(props) {
super(props);
this.nScroll.addListener(
Animated.event([{value: this.scroll}], {useNativeDriver: false}),
);
}
render() {
return (
<View style={{flex: 1}}>
<Animated.View
style={{
position: 'absolute',
width: Dimensions.get('screen').width,
backgroundColor: this.headerBg,
zIndex: 1,
minHeight: 40,
}}>
<Animated.View
style={{
backgroundColor: this.headerBg,
fontWeight: 'bold',
minHeight: 40,
}}>
<HeaderApp navigation={this.props.navigation} />
</Animated.View>
</Animated.View>
<Animated.ScrollView
onScroll={Animated.event(
[{nativeEvent: {contentOffset: {y: this.nScroll}}}],
{useNativeDriver: true},
)}
scrollEventThrottle={5}
showsVerticalScrollIndicator={false}
style={{zIndex: 0}}>
<Animated.View
style={{
transform: [
{translateY: Animated.multiply(this.nScroll, 0.35)},
{scale: this.imgScale},
],
backgroundColor: THEME_COLOR,
}}>
<Animated.View
style={{
height: IMAGE_HEIGHT,
width: Dimensions.get('window').width,
opacity: this.imgOpacity,
}}>
<MapScreenView navigation={this.props.navigation} />
</Animated.View>
</Animated.View>
<CardComponent navigation={this.props.navigation} />
</Animated.ScrollView>
</View>
);
}
}
``