/* * This example demonstrates how to use ParallaxScrollView within a ScrollView component. */ import React, { Component } from 'react'; import { Dimensions, Image, ListView, PixelRatio, StyleSheet, Text, View, } from 'react-native'; import ParallaxScrollView from 'react-native-parallax-scroll-view'; class Talks extends Component { constructor(props) { super(props); this.state = { dataSource: new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }).cloneWithRows([ 'Simplicity Matters', 'Hammock Driven Development', 'Value of Values', 'Are We There Yet?', 'The Language of the System', 'Design, Composition, and Performance', 'Clojure core.async', 'The Functional Database', 'Deconstructing the Database', 'Hammock Driven Development', 'Value of Values' ]) }; } render() { const { onScroll = () => {} } = this.props; return ( ( { rowData } )} renderScrollComponent={props => ( ( )} renderForeground={() => ( Talks by Rich Hickey CTO of Cognitec, Creator of Clojure )} renderStickyHeader={() => ( Rich Hickey Talks )} renderFixedHeader={() => ( this.refs.ListView.scrollTo({ x: 0, y: 0 })}> Scroll to top )}/> )} /> ); } } const window = Dimensions.get('window'); const AVATAR_SIZE = 120; const ROW_HEIGHT = 60; const PARALLAX_HEADER_HEIGHT = 350; const STICKY_HEADER_HEIGHT = 70; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'black' }, background: { position: 'absolute', top: 0, left: 0, width: window.width, height: PARALLAX_HEADER_HEIGHT }, stickySection: { height: STICKY_HEADER_HEIGHT, width: 300, justifyContent: 'flex-end' }, stickySectionText: { color: 'white', fontSize: 20, margin: 10 }, fixedSection: { position: 'absolute', bottom: 10, right: 10 }, fixedSectionText: { color: '#999', fontSize: 20 }, parallaxHeader: { alignItems: 'center', flex: 1, flexDirection: 'column', paddingTop: 100 }, avatar: { marginBottom: 10, borderRadius: AVATAR_SIZE / 2 }, sectionSpeakerText: { color: 'white', fontSize: 24, paddingVertical: 5 }, sectionTitleText: { color: 'white', fontSize: 18, paddingVertical: 5 }, row: { overflow: 'hidden', paddingHorizontal: 10, height: ROW_HEIGHT, backgroundColor: 'white', borderColor: '#ccc', borderBottomWidth: 1, justifyContent: 'center' }, rowText: { fontSize: 20 } }); export default Talks;