Transaction.js 2.8 KB

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