Advertisement
Dev4ster

stickyHeaderIndices with textinput

Jul 1st, 2020
855
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2. import {
  3.   ScrollView, View, TextInput, StyleSheet,
  4. } from 'react-native'
  5.  
  6. const styles = StyleSheet.create({
  7.   container: {
  8.     flex: 1,
  9.   },
  10.   box: {
  11.     width: '100%',
  12.     height: 200,
  13.   },
  14.   header: {
  15.     height: 100,
  16.     backgroundColor: '#7159c1',
  17.     elevation: 10,
  18.     borderBottomWidth: 2,
  19.     borderBottomColor: '#fff',
  20.     padding: 20,
  21.   },
  22.   input: {
  23.  
  24.     width: '100%',
  25.     height: 50,
  26.     backgroundColor: '#fff',
  27.   },
  28. })
  29.  
  30. const Teste3 = () => (
  31.   <ScrollView style={styles.container} stickyHeaderIndices={[ 0, 4 ]}>
  32.     <View style={styles.header}>
  33.       <TextInput style={styles.input} placeholder="Pesquisa...." />
  34.     </View>
  35.     <View style={[ styles.box, { backgroundColor: 'orange' }]} />
  36.     <View style={[ styles.box, { backgroundColor: 'green' }]} />
  37.     <View style={[ styles.box, { backgroundColor: 'red' }]} />
  38.     <View style={[ styles.box, { backgroundColor: 'blue' }]}>
  39.       <TextInput style={styles.input} placeholder="Pesquisa...." />
  40.     </View>
  41.     <View style={[ styles.box, { backgroundColor: 'gray' }]} />
  42.     <View style={[ styles.box, { backgroundColor: 'pink' }]} />
  43.     <View style={[ styles.box, { backgroundColor: 'black' }]} />
  44.   </ScrollView>
  45. )
  46.  
  47. export default Teste3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement