ipanel-rnapp-ajb-base 1.0.19 → 1.0.20

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.
@@ -9,7 +9,7 @@ import px from '../../../utils/scaleSize';
9
9
  // } from 'react-native-reanimated';
10
10
  const pickerStyles = {
11
11
  okView:{borderLeftColor:'#F0F0F0',borderLeftWidth:1},
12
- okText: {color: '#E86003',width:px(500)},
12
+ okText: {color: '#E86003',width:px(500),fontWeight:'600'},
13
13
  dismissText: {color: '#666',width:px(500),},
14
14
  container:{borderTopLeftRadius:px(20),borderTopRightRadius:px(20)},
15
15
  wheelWrapperAdd:{paddingVertical:px(60)},
@@ -6,6 +6,7 @@ import {
6
6
  Platform,
7
7
  ScrollView,
8
8
  View,
9
+ TouchableWithoutFeedback
9
10
  } from 'react-native'
10
11
 
11
12
  type ColumnItem = {
@@ -27,11 +28,13 @@ type Props = {
27
28
  class Wheel extends React.Component<Props> {
28
29
  scrollerRef: any
29
30
 
30
- scrollBuffer: number
31
+ scrollBuffer: any
31
32
 
32
33
  selectValue: any
33
34
  isScrolling: boolean
34
35
 
36
+ animateFlaf:any
37
+
35
38
  componentDidMount() {
36
39
  const { value, column, itemHeight } = this.props
37
40
  setTimeout(() => {
@@ -40,6 +43,7 @@ class Wheel extends React.Component<Props> {
40
43
  }
41
44
 
42
45
  shouldComponentUpdate(nextProps: Props) {
46
+ if(this.animateFlaf){return true}
43
47
  const { value, column, itemHeight, wheelHeight } = nextProps
44
48
  if (
45
49
  value !== this.props.value ||
@@ -53,6 +57,7 @@ class Wheel extends React.Component<Props> {
53
57
  }
54
58
 
55
59
  componentDidUpdate(prevProps: Props) {
60
+ if(this.animateFlaf){return false}
56
61
  const { column } = prevProps
57
62
  if (column !== this.props.column) {
58
63
  this.scrollTo(
@@ -62,11 +67,12 @@ class Wheel extends React.Component<Props> {
62
67
  }
63
68
  }
64
69
 
65
- scrollTo = (y: any) => {
70
+ scrollTo = (y: any,flag?:any) => {
66
71
  this.scrollerRef?.scrollTo?.({
67
72
  y,
68
- animated: false,
73
+ animated: flag === 'animate'?true:false,
69
74
  })
75
+ this.animateFlaf = false
70
76
  }
71
77
 
72
78
  getSelectIndex(column: ColumnItem[], value?: Value) {
@@ -154,6 +160,18 @@ class Wheel extends React.Component<Props> {
154
160
  this.isScrolling = false
155
161
  }
156
162
 
163
+ handleItemClick = (item:any,index:any) =>{
164
+ if(this.props.value === item?.value){return}
165
+ this.animateFlaf = true
166
+ this.props.onSelect(item?.value, this.props.index)
167
+ setTimeout(() => {
168
+ this.scrollTo(
169
+ this.getSelectIndex(this.props.column, item?.value) *
170
+ this.props.itemHeight,'animate'
171
+ )
172
+ })
173
+ }
174
+
157
175
  renderItems = () => {
158
176
  const { column, renderLabel, itemHeight, wheelHeight } = this.props
159
177
  return (
@@ -162,7 +180,11 @@ class Wheel extends React.Component<Props> {
162
180
  paddingVertical: (wheelHeight - itemHeight) / (this.props.column.length===3?3:
163
181
  this.props.column.length>3?3:8),
164
182
  }}>
165
- {column.map((item, index) => renderLabel(item, index))}
183
+ {column.map((item, index) => {
184
+ return <TouchableWithoutFeedback key={index} onPress={()=>this.handleItemClick(item,index)}>
185
+ {renderLabel(item, index)}
186
+ </TouchableWithoutFeedback>
187
+ })}
166
188
  </View>
167
189
  )
168
190
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ipanel-rnapp-ajb-base",
3
- "version": "1.0.19",
4
- "ipanelVersion": "1.0.342",
3
+ "version": "1.0.20",
4
+ "ipanelVersion": "1.0.345",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "bin": {