Created
February 26, 2018 22:37
-
-
Save krvajal/e54ca1811e1a43c1e9df1a7d6ec9c249 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Text, View, StyleSheet, ScrollView, Image, Animated } from 'react-native'; | |
import { Constants } from 'expo'; | |
// You can import from local files | |
import AssetExample from './components/AssetExample'; | |
// or any pure javascript modules available in npm | |
import { Card } from 'react-native-elements'; // 0.18.5 | |
export default class App extends Component { | |
state = { | |
scroll: 0 | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Animated.ScrollView | |
contentInsetAdjustmentBehavior="always" | |
scrollEventThrottle={16} | |
contentContainerStyle={{paddingTop: 200, x:0}} | |
onScroll={(evt) => { this.setState({scroll: evt.nativeEvent.contentOffset.y})} } style={{flex:1, backgroundColor: 'red', position: "absolute", top: 0, left:0, right:0, height:2000}}> | |
<Text style={{height:23000}}>Hello world</Text> | |
</Animated.ScrollView> | |
<Image source={{uri:"http://hdwallsource.com/img/2014/3/green-landscape-16039-16527-hd-wallpapers.jpg"}} style={{position:"absolute", width: 500, height:200 - this.state.scroll , top:0}}/> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
paddingTop: Constants.statusBarHeight, | |
backgroundColor: '#ecf0f1', | |
}, | |
paragraph: { | |
margin: 24, | |
fontSize: 18, | |
fontWeight: 'bold', | |
textAlign: 'center', | |
color: '#34495e', | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment