Transaction.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /**
  2. * 历史交易页面
  3. * @邠心vbe on 2024/05/16
  4. */
  5. import React, { Component, useState } from 'react';
  6. import { ScrollView, StyleSheet, RefreshControl } from 'react-native';
  7. import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
  8. import HistoryList from './HistoryList';
  9. import OverviewV2 from '../wallet/OverviewV2';
  10. import PointsHistory from './PointsHistory';
  11. import app from '../../../app.json';
  12. import { MyRefreshProps } from '../../components/ThemesConfig';
  13. const TabOverView = () => {
  14. const [refresh, setRefresh] = useState(false)
  15. return (
  16. <ScrollView
  17. style={styles.container}
  18. contentContainerStyle={$padding(16,0)}
  19. refreshControl={
  20. <RefreshControl
  21. {...MyRefreshProps()}
  22. refreshing={refresh}
  23. onRefresh={() => setRefresh(true)}
  24. />
  25. }>
  26. <OverviewV2
  27. atAglance={false}
  28. skeleton={false}
  29. refresh={refresh}
  30. isTabPage={true}
  31. refreshed={() => setRefresh(false)}
  32. shown={true}/>
  33. </ScrollView>
  34. )
  35. }
  36. export default class Transaction extends Component {
  37. constructor(props) {
  38. super(props);
  39. this.state = {
  40. pageAdapter: [{
  41. title: $t('wallet.tabOverview'),
  42. name: "Overview",
  43. component: TabOverView
  44. },{
  45. title: $t('wallet.tabHistory'),
  46. name: "History",
  47. component: HistoryList
  48. },{
  49. title: $t('points.points'),
  50. name: "Points",
  51. component: PointsHistory
  52. }]
  53. };
  54. this.tabBarStyle = {
  55. tabBarStyle: styles.tabStyle,
  56. tabBarPressColor: rippleColor,
  57. tabBarScrollEnabled: false,
  58. tabBarIndicatorStyle: styles.indicator,
  59. tabBarActiveTintColor: tabBarTextActive,
  60. tabBarInactiveTintColor: tabBarTextInactive
  61. }
  62. }
  63. backPage() {
  64. startPage(PageList.home);
  65. return true;
  66. }
  67. render() {
  68. const Tab = createMaterialTopTabNavigator();
  69. return (
  70. <Tab.Navigator
  71. style={styles.container}
  72. screenOptions={{
  73. lazy: false,
  74. lazyPreloadDistance: 1,
  75. ...this.tabBarStyle
  76. }}
  77. backBehavior={() => this.backPage()}>
  78. { this.state.pageAdapter.map((item, index) =>
  79. <Tab.Screen
  80. key={index}
  81. name={item.name}
  82. component={item.component}
  83. options={{
  84. title: item.title,
  85. tabBarAllowFontScaling: false
  86. }}
  87. />
  88. )}
  89. </Tab.Navigator>
  90. );
  91. }
  92. }
  93. const styles = StyleSheet.create({
  94. container: {
  95. flex: 1,
  96. backgroundColor: colorLight
  97. },
  98. tabStyle: {
  99. backgroundColor: app.isWhitelabel ? colorLight : colorPrimary
  100. },
  101. indicator: {
  102. backgroundColor: app.isWhitelabel ? colorPrimary : colorLight
  103. }
  104. })