123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import React, { Component } from 'react';
- import {
- ScrollView,
- TouchableOpacity,
- StyleSheet,
- Image,
- Text,
- View,
- Platform,
- ScrolView
- } from 'react-native';
- import { SharedElementTransition } from 'react-native-navigation';
- import * as Animatable from 'react-native-animatable';
-
- const SHOW_DURATION = 400;
- const HIDE_DURATION = 300;
-
- class InfoScreen extends Component {
-
- constructor(props) {
- super(props);
- this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
- this.state = {
- animationType: 'fadeInRight',
- animationDuration: SHOW_DURATION
- }
- }
-
- onNavigatorEvent(event) {
- if (event.id === 'backPress') {
- this.setState({
- animationType: 'fadeOutRight',
- animationDuration: HIDE_DURATION
- });
- this.props.navigator.pop();
- }
- }
-
- render() {
- return (
- <View style={styles.container}>
- {this._renderImage()}
- {this._renderContent()}
- </View>
- );
- }
-
- _renderImage() {
- return (
- <SharedElementTransition
- style={styles.imageContainer}
- sharedElementId={this.props.sharedImageId}
- showDuration={SHOW_DURATION}
- hideDuration={HIDE_DURATION}
- animateClipBounds={true}
- showInterpolation={
- {
- type: 'linear',
- easing: 'FastOutSlowIn'
- }
- }
- hideInterpolation={
- {
- type: 'linear',
- easing: 'FastOutSlowIn'
- }
- }
- >
- <Image
- style={styles.image}
- source={require('../../../../../img/beach.jpg')}
- />
- </SharedElementTransition>
- );
- }
-
- _renderContent() {
- return (
- <Animatable.View
- style={styles.content}
- duration={this.state.animationDuration}
- animation={this.state.animationType}
- useNativeDriver={true}
- >
- <Text style={styles.text}>Line 1</Text>
- <Text style={styles.text}>Line 2</Text>
- <Text style={styles.text}>Line 3</Text>
- <Text style={styles.text}>Line 4</Text>
- <Text style={styles.text}>Line 5</Text>
- <Text style={styles.text}>Line 6</Text>
- <Text style={styles.text}>Line 7</Text>
- <Text style={styles.text}>Line 8</Text>
- </Animatable.View>
- );
- }
- }
-
- const styles = StyleSheet.create({
- container: {
- flex: 1
- },
- content: {
- flex: 1,
- marginTop: 190,
- backgroundColor: 'white'
- },
- imageContainer: {
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- },
- image: {
- height: 190
- },
- text: {
- fontSize: 17,
- paddingVertical: 4,
- paddingLeft: 8
- }
- });
-
- export default InfoScreen;
|