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

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.4",
3
+ "version": "3.12.7-beta.5",
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.4",
25
- "@gm-mobile/c-tool": "^3.12.7-beta.4",
26
- "@gm-mobile/locales": "^3.12.7-beta.4",
24
+ "@gm-mobile/c-font": "^3.12.7-beta.5",
25
+ "@gm-mobile/c-tool": "^3.12.7-beta.5",
26
+ "@gm-mobile/locales": "^3.12.7-beta.5",
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": "b139541489e14038c41f4bd943beb3334f375235"
37
+ "gitHead": "6305b0d3f16a98761987b8ab0af644135f7c14c6"
38
38
  }
@@ -80,6 +80,9 @@ const MonthsList: FC<MonthListProps> = ({
80
80
  const monthsList = computedMonthList()
81
81
 
82
82
  const scrollToTarget = (flag: boolean) => {
83
+ if (timeoutRef.current) {
84
+ clearTimeout(timeoutRef.current)
85
+ }
83
86
  if (selected.length) {
84
87
  const date = type === CALENDAR_TYPE.RANGE ? selected[1] : selected[0]
85
88
  const targetId = _.findIndex(
@@ -89,13 +92,9 @@ const MonthsList: FC<MonthListProps> = ({
89
92
  moment(item).month() === moment(date).month()
90
93
  )
91
94
 
92
- if (flag) {
93
- setTimeout(() => {
94
- refList.current && refList.current.apiDoScrollToKey(targetId)
95
- }, 200)
96
- } else {
95
+ timeoutRef.current = setTimeout(() => {
97
96
  refList.current && refList.current.apiDoScrollToKey(targetId)
98
- }
97
+ }, 200)
99
98
  }
100
99
  }
101
100
 
@@ -111,8 +110,8 @@ const MonthsList: FC<MonthListProps> = ({
111
110
  clearTimeout(timeoutRef.current)
112
111
  }
113
112
  if (max || min) {
114
- const flagItem = whichValueChanged(previous as any, selected as any)
115
- const date = selected[flagItem]
113
+ const date = selected[0]
114
+
116
115
  const targetId = _.findIndex(
117
116
  monthsList,
118
117
  (item) =>
@@ -120,12 +119,12 @@ const MonthsList: FC<MonthListProps> = ({
120
119
  moment(item).month() === moment(date).month()
121
120
  )
122
121
  if (targetId !== -1) {
123
- timeoutRef.current = setTimeout(() => {
122
+ setTimeout(() => {
124
123
  refList.current && refList.current.apiDoScrollToKey(targetId)
125
124
  }, 200)
126
125
  }
127
126
  }
128
- }, [max, min])
127
+ }, [max, min, monthsList])
129
128
 
130
129
  return (
131
130
  <VList