ayand04

new1

Dec 8th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export default class recentChatListScreen extends Component
  2. {
  3.     constructor(props) {
  4.         super(props);
  5.         this.state = { elevation: 0 };
  6.     }
  7.  
  8.     onScroll = (e) => {
  9.         const { contentOffset } = e.nativeEvent;
  10.  
  11.         if (contentOffset.y > 0) {
  12.             this.setState({ elevation: 48 });
  13.         } else {
  14.             this.setState({ elevation: 0 });
  15.         }
  16.     };
  17.  
  18.     .
  19.     .
  20.     .
  21.     .
  22.     .
  23.     render() {
  24.         return (
  25.             <ThemeProvider uiTheme={uiTheme}>
  26.                 <View style={styles.contentWrapper}>
  27.                     <View>
  28.                         <Toolbar
  29.                             .
  30.                             .
  31.                             .
  32.                             style={{container: getPlatformElevation(this.state.elevation)}}
  33.                         />
  34.                     </View>
  35.                     <View style={styles.chatListContainer}>
  36.                         <FlatList
  37.                             data={[..]}
  38.                             renderItem={this._renderItem}
  39.                             keyExtractor={item => item.userId}
  40.                             onScroll={this.onScroll}
  41.                         />
Add Comment
Please, Sign In to add comment