@conecli/cone-render 0.8.15-beta.41 → 0.8.15-beta.43

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.
@@ -1 +1 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react'
2
1
  const [componentShowState, setComponentShowState] = useState(false)
3
2
  const componentLazyRef = useRef<HTMLElement | null>(null)
4
3
  const componentShowStateRef = useRef(false)
5
4
  useEffect(() => {
6
5
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
7
6
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
8
7
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
9
8
  !componentShowStateRef.current && dealPageScrollInfo(res)
10
9
  })
11
10
 
12
11
 
13
12
  <View
14
13
  ref={componentLazyRef}
15
14
  className={classNames(
16
15
  imageStyle['d-app-lazy-image'],
17
16
  {
18
17
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
19
18
  },
20
19
  {
21
20
  [imageStyle['d-hide-image-error']]: imageErrState,
22
21
  },
23
22
  {
24
23
  [imageStyle['d-load-completed']]: loadSuccess,
25
24
  },
26
25
  {
27
26
  'd-imag-rendering-crisp-edges':
28
27
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
29
28
  imagRenderingSet,
30
29
  },
31
30
  'J_html5ImageBg',
32
31
  className,
33
32
  )}
34
33
  style={{
35
34
  ...style,
36
35
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
37
36
  }}
38
37
  >
39
38
  {componentShowState && <img
40
39
  src={getQualityImage(
41
40
  imgSrc,
42
41
  taroJdBaseInfo.info.pageInfo.isVipShop
43
42
  ? NetWorkTypeQuality['perfect']
44
43
  : NetWorkTypeQuality[getNetWorkType],
45
44
  )}
46
45
  onLoad={imageLoad.bind(this, imgSrc)}
47
46
  onError={imageError}
48
47
  />}
49
48
  </View>
50
49
  ) : (
51
50
  <Image
52
51
  style={{
53
52
  ...style,
54
53
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
55
54
  }}
56
55
  className={classNames(
57
56
  imageStyle['d-lazy-image'],
58
57
  {
59
58
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
60
59
  },
61
60
  {
62
61
  [imageStyle['d-hide-image-error']]: imageErrState,
63
62
  },
64
63
  {
65
64
  [imageStyle['d-load-completed']]: loadSuccess,
66
65
  },
67
66
  {
68
67
  'd-imag-rendering-crisp-edges': imagRenderingSet,
69
68
  },
70
69
  className,
71
70
  )}
72
71
  src={getQualityImage(
73
72
  imgSrc,
74
73
  NetWorkTypeQuality[getNetWorkType],
75
74
  )}
76
75
  lazyLoad={lazyLoad}
77
76
  onError={imageError}
78
77
  onLoad={imageLoad.bind(this, imgSrc)}
79
78
  {...otherOption}
80
79
  />
81
80
  )
81
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
82
82
  const [componentShowState, setComponentShowState] = useState(false)
83
83
  const componentLazyRef = useRef<HTMLElement | null>(null)
84
84
  const componentShowStateRef = useRef(false)
85
85
  useEffect(() => {
86
86
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
87
87
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
88
88
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
89
89
  !componentShowStateRef.current && dealPageScrollInfo(res)
90
90
  })
91
91
 
92
92
 
93
93
  <View
94
94
  ref={componentLazyRef}
95
95
  className={classNames(
96
96
  imageStyle['d-app-lazy-image'],
97
97
  {
98
98
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
99
99
  },
100
100
  {
101
101
  [imageStyle['d-hide-image-error']]: imageErrState,
102
102
  },
103
103
  {
104
104
  [imageStyle['d-load-completed']]: loadSuccess,
105
105
  },
106
106
  {
107
107
  'd-imag-rendering-crisp-edges':
108
108
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
109
109
  imagRenderingSet,
110
110
  },
111
111
  'J_html5ImageBg',
112
112
  className,
113
113
  )}
114
114
  style={{
115
115
  ...style,
116
116
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
117
117
  }}
118
118
  >
119
119
  {(componentShowState || lazyLoad === false) && <img
120
120
  src={getQualityImage(
121
121
  imgSrc,
122
122
  taroJdBaseInfo.info.pageInfo.isVipShop
123
123
  ? NetWorkTypeQuality['perfect']
124
124
  : NetWorkTypeQuality[getNetWorkType],
125
125
  )}
126
126
  onLoad={imageLoad.bind(this, imgSrc)}
127
127
  onError={imageError}
128
128
  />}
129
129
  </View>
130
130
  ) : (
131
131
  <Image
132
132
  style={{
133
133
  ...style,
134
134
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
135
135
  }}
136
136
  className={classNames(
137
137
  imageStyle['d-lazy-image'],
138
138
  {
139
139
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
140
140
  },
141
141
  {
142
142
  [imageStyle['d-hide-image-error']]: imageErrState,
143
143
  },
144
144
  {
145
145
  [imageStyle['d-load-completed']]: loadSuccess,
146
146
  },
147
147
  {
148
148
  'd-imag-rendering-crisp-edges': imagRenderingSet,
149
149
  },
150
150
  className,
151
151
  )}
152
152
  src={getQualityImage(
153
153
  imgSrc,
154
154
  NetWorkTypeQuality[getNetWorkType],
155
155
  )}
156
156
  lazyLoad={lazyLoad}
157
157
  onError={imageError}
158
158
  onLoad={imageLoad.bind(this, imgSrc)}
159
159
  {...otherOption}
160
160
  />
161
161
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conecli/cone-render",
3
- "version": "0.8.15-beta.41",
3
+ "version": "0.8.15-beta.43",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist/"