import { ScrollView, View, Text } from "@tarojs/components"; import './recents.scss' import Layout from "@/components/layout/layout"; import { useTranslation } from "react-i18next"; import NewHeader, { NewHeaderType } from "../components/new_header"; import { rpxToPx } from "@/utils/tools"; import NewButton, { NewButtonType } from "../base/new_button"; import { getThemeColor } from "@/features/health/hooks/health_hooks"; import { MainColorType } from "@/context/themes/color"; import { NaviBarTitleShowType, TemplateType } from "@/utils/types"; import { useEffect, useRef, useState } from "react"; import MainHistory from "@/features/health/MainHistory"; import Taro from "@tarojs/taro"; import { checkSummaries } from "@/services/health"; import StickyDateList from "../components/sticky_date_list"; export default function Recents() { const [mode, setMode] = useState('EAT') const { t } = useTranslation() const historyRef = useRef() const [list, setList] = useState([]) const [isPulling,setIsPulling] = useState(false) useEffect(() => { getData() }, []) function getData() { checkSummaries().then(res => { setList((res as any).windows) setMode((res as any).windows[0].window) }) } if (list.length == 0) { return } function detail() { return { global.refreshWindow() setIsPulling(true) if (global.refreshHistory) { global.refreshHistory() } }} loadMore={() => { if (historyRef) { (historyRef.current as any).more() } }} onScroll={e => { // props.onScroll(e) // if (showDate && e.detail.scrollTop > 100) { // dispatch(setTitle(t('health.recents'))) // } // else if (e.detail.scrollTop > 100) { // dispatch(setTitle(t('health.today'))) // } // else { // dispatch(setTitle('')) // } // if (historyRef2) { // (historyRef2.current as any).onScroll(e) // } if (e.detail.scrollTop > 100){ Taro.setNavigationBarTitle({ title:t('health.check_ins') }) } else { Taro.setNavigationBarTitle({ title:'' }) } }} > { list.map((item, index) => { return setMode(item.window)}> {item.title} {item.log_count} }) } { // setShowDate(e.show) // setDate(e.date) }} /> } return detail() // return }