@gm-mobile/c-react 3.12.7-beta.3 → 3.12.7-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-mobile/c-react",
3
- "version": "3.12.7-beta.3",
3
+ "version": "3.12.7-beta.4",
4
4
  "description": "> TODO: description",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-mobile#readme",
@@ -21,9 +21,9 @@
21
21
  "url": "https://github.com/gmfe/gm-mobile/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@gm-mobile/c-font": "^3.12.7-beta.3",
25
- "@gm-mobile/c-tool": "^3.12.7-beta.3",
26
- "@gm-mobile/locales": "^3.12.7-beta.3",
24
+ "@gm-mobile/c-font": "^3.12.7-beta.4",
25
+ "@gm-mobile/c-tool": "^3.12.7-beta.4",
26
+ "@gm-mobile/locales": "^3.12.7-beta.4",
27
27
  "dayjs": "^1.11.6"
28
28
  },
29
29
  "peerDependencies": {
@@ -34,5 +34,5 @@
34
34
  "prop-types": "^15.7.2",
35
35
  "react": "^16.13.1"
36
36
  },
37
- "gitHead": "2febbe7e8c3f9c92143aecca92bea1dd35fab799"
37
+ "gitHead": "b139541489e14038c41f4bd943beb3334f375235"
38
38
  }
@@ -49,6 +49,7 @@ const MonthsList: FC<MonthListProps> = ({
49
49
  }) => {
50
50
  const refList = useRef<VListRef>(null)
51
51
  const previous = usePreviousObject(selected)
52
+ const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)
52
53
 
53
54
  const computedMonthList = () => {
54
55
  // 优先 min,其次 begin ,其次 当前
@@ -106,6 +107,9 @@ const MonthsList: FC<MonthListProps> = ({
106
107
  if (!canScrollWhenMaxOrMinChange) {
107
108
  return
108
109
  }
110
+ if (timeoutRef.current) {
111
+ clearTimeout(timeoutRef.current)
112
+ }
109
113
  if (max || min) {
110
114
  const flagItem = whichValueChanged(previous as any, selected as any)
111
115
  const date = selected[flagItem]
@@ -116,7 +120,9 @@ const MonthsList: FC<MonthListProps> = ({
116
120
  moment(item).month() === moment(date).month()
117
121
  )
118
122
  if (targetId !== -1) {
119
- refList.current && refList.current.apiDoScrollToKey(targetId)
123
+ timeoutRef.current = setTimeout(() => {
124
+ refList.current && refList.current.apiDoScrollToKey(targetId)
125
+ }, 200)
120
126
  }
121
127
  }
122
128
  }, [max, min])