TopTab.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. Image,
  6. StatusBar,
  7. Dimensions,
  8. PixelRatio,
  9. TouchableOpacity,
  10. Text,
  11. FlatList,
  12. DeviceEventEmitter,
  13. ScrollView,
  14. } from 'react-native'
  15. import { connect } from 'react-redux'
  16. import ScrollableTabView from 'react-native-scrollable-tab-view'
  17. import TopTabBar from './TopTabBar'
  18. import Icon from '../Iconfont/Iconfont'
  19. // import Commodity from "./Commodity";
  20. // import Detail from "./Details";
  21. // import DetailComponent from "./DetailComponent";
  22. const { width, height } = Dimensions.get('window')
  23. @connect(({ theme }) => ({ ...theme }))
  24. class TopTab extends Component {
  25. constructor() {
  26. super()
  27. this.state = {}
  28. }
  29. render() {
  30. const { appTheme } = this.props
  31. return (
  32. <View style={{ flex: 1 }}>
  33. <ScrollableTabView
  34. locked={true}
  35. style={{ backgroundColor: appTheme.backgroundColor }}
  36. initialPage={0}
  37. renderTabBar={() => <TopTabBar />}
  38. // scrollEnabled={true}
  39. // onChangeTab={e => {
  40. // console.log(e);
  41. // }}
  42. >
  43. {this.props.children}
  44. </ScrollableTabView>
  45. </View>
  46. )
  47. }
  48. }
  49. const styles = StyleSheet.create({
  50. tabView: {
  51. flex: 1,
  52. backgroundColor: 'rgba(0,0,0,0.01)',
  53. },
  54. })
  55. export default TopTab