@react-native-hero/picker 0.0.8 → 0.1.0

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.
@@ -47,14 +47,26 @@ class PickerView(private val reactContext: ThemedReactContext) : WheelView(react
47
47
  }
48
48
  }
49
49
 
50
+ if (tempIndex >= 0) {
51
+ selectedIndex = tempIndex
52
+ tempIndex = -1
53
+ }
54
+
50
55
  }
51
56
 
57
+ var tempIndex = -1
58
+
52
59
  var selectedIndex = -1
53
60
 
54
61
  set(value) {
55
62
  field = value
56
63
 
57
- if (value < 0 || value >= options.size()) {
64
+ val optionsSize = options.size()
65
+
66
+ if (value < 0 || value >= optionsSize) {
67
+ if (optionsSize == 0) {
68
+ tempIndex = value
69
+ }
58
70
  return
59
71
  }
60
72
 
@@ -66,7 +78,7 @@ class PickerView(private val reactContext: ThemedReactContext) : WheelView(react
66
78
  // putMap 必须传入 WritableMap
67
79
  // 如果直接传 ReadableMap 会报错
68
80
  val option = Arguments.createMap()
69
- option.merge(options.getMap(value)!!)
81
+ option.merge(options.getMap(value))
70
82
 
71
83
  map.putMap("option", option)
72
84
  sendEvent("onChange", map)
@@ -109,4 +121,4 @@ class PickerView(private val reactContext: ThemedReactContext) : WheelView(react
109
121
  reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, eventName, params)
110
122
  }
111
123
 
112
- }
124
+ }
package/index.js CHANGED
@@ -4,7 +4,6 @@ import React, {
4
4
 
5
5
  import {
6
6
  requireNativeComponent,
7
- ViewPropTypes,
8
7
  } from 'react-native'
9
8
 
10
9
  import PropTypes from 'prop-types'
@@ -22,7 +21,7 @@ class PickerComponent extends PureComponent {
22
21
  fontSize: PropTypes.number,
23
22
  rowHeight: PropTypes.number,
24
23
  onChange: PropTypes.func,
25
- style: ViewPropTypes.style,
24
+ style: PropTypes.any,
26
25
  }
27
26
 
28
27
  static defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-hero/picker",
3
- "version": "0.0.8",
3
+ "version": "0.1.0",
4
4
  "description": "react native picker",
5
5
  "main": "index.js",
6
6
  "scripts": {