Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. import { View, ScrollView, Text, Animated, PanResponder } from 'react-native';
  2. class App extends Component {
  3.  
  4. constructor(props) {
  5. super(props);
  6.  
  7. this.state = {
  8. cards: [],
  9. }
  10. }
  11.  
  12.  
  13. render() {
  14. return (
  15. <View style={{ flex: 1 }}>
  16. <ScrollView
  17. onScroll={this.handleScroll}>
  18. <View style={styles.cardContainer}>
  19. {this.state.cards}
  20. </View>
  21. </ScrollView>
  22. <View style={styles.panel}
  23. onLayout={this.handleOnLayout}>
  24. <Animated.View
  25. style={{ ...styles.panelCard }}>
  26. <Text>Sample</Text>
  27. </Animated.View>
  28. </View>
  29. </View>
  30. )
  31. }
  32. }
  33.  
  34.  
  35. const styles = {
  36. cardContainer: {
  37. minHeight: 1000,
  38. flex: 1,
  39. backgroundColor: '#f3f3f3'
  40. },
  41. panel: {
  42. position: 'absolute',
  43. backgroundColor: '#bdbdbd',
  44. flex: 1,
  45. maxHeight: 200,
  46. height: 200,
  47. bottom: 0,
  48. left: 0,
  49. right: 0,
  50. justifyContent: 'center'
  51. },
  52. panelCard: {
  53. backgroundColor: '#fff',
  54. elevation: 2,
  55. height: 150,
  56. maxHeight: 150,
  57. borderRadius: 10,
  58. marginLeft: 10,
  59. marginRight: 10,
  60. justifyContent: 'center',
  61. alignItems: 'center'
  62. },
  63. dropCard: {
  64. backgroundColor: '#fff',
  65. height: 150,
  66. maxHeight: 150,
  67. elevation: 2,
  68. borderRadius: 10,
  69. position: 'absolute',
  70. left: 10,
  71. right: 10,
  72. alignItems: 'center',
  73. justifyContent: 'center'
  74. }
  75. }
  76.  
  77. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement