react-native-picker-select
Advanced tools
Comparing version 6.3.3 to 6.3.4
@@ -0,1 +1,10 @@ | ||
### 6.3.4 | ||
##### Bugfix | ||
- Fix for `onDonePress` regression (#236) | ||
- "Done" Text element now set to `allowFontScaling={false}` (#247) | ||
--- | ||
### 6.3.3 | ||
@@ -2,0 +11,0 @@ |
{ | ||
"name": "react-native-picker-select", | ||
"version": "6.3.3", | ||
"version": "6.3.4", | ||
"description": "A Picker component for React Native which emulates the native <select> interfaces for each platform", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -150,9 +150,9 @@ import React, { PureComponent } from 'react'; | ||
const items = RNPickerSelect.handlePlaceholder({ | ||
placeholder: this.props.placeholder, | ||
}).concat(this.props.items); | ||
placeholder: props.placeholder, | ||
}).concat(props.items); | ||
const { selectedItem } = RNPickerSelect.getSelectedItem({ | ||
items, | ||
key: this.props.itemKey, | ||
value: this.props.value, | ||
key: props.itemKey, | ||
value: props.value, | ||
}); | ||
@@ -174,3 +174,2 @@ | ||
this.togglePicker = this.togglePicker.bind(this); | ||
this.triggerDoneCallback = this.triggerDoneCallback.bind(this); | ||
this.renderInputAccessoryView = this.renderInputAccessoryView.bind(this); | ||
@@ -215,4 +214,5 @@ } | ||
const { placeholder, placeholderTextColor, style } = this.props; | ||
const { selectedItem } = this.state; | ||
if (!isEqual(placeholder, {}) && this.state.selectedItem.label === placeholder.label) { | ||
if (!isEqual(placeholder, {}) && selectedItem.label === placeholder.label) { | ||
return { | ||
@@ -229,8 +229,9 @@ ...defaultStyles.placeholder, | ||
const { onOpen, onClose } = this.props; | ||
const { showPicker } = this.state; | ||
if (!this.state.showPicker && onOpen) { | ||
if (!showPicker && onOpen) { | ||
onOpen(); | ||
} | ||
if (this.state.showPicker && onClose) { | ||
if (showPicker && onClose) { | ||
onClose(); | ||
@@ -240,11 +241,5 @@ } | ||
triggerDoneCallback() { | ||
const { hideDoneBar, onDonePress } = this.props; | ||
if (!hideDoneBar && onDonePress) { | ||
onDonePress(); | ||
} | ||
} | ||
togglePicker(animate = false, postToggleCallback) { | ||
const { modalProps, disabled } = this.props; | ||
const { showPicker } = this.state; | ||
@@ -255,3 +250,3 @@ if (disabled) { | ||
if (!this.state.showPicker) { | ||
if (!showPicker) { | ||
Keyboard.dismiss(); | ||
@@ -281,3 +276,5 @@ } | ||
renderPickerItems() { | ||
return this.state.items.map((item) => { | ||
const { items } = this.state; | ||
return items.map((item) => { | ||
return ( | ||
@@ -301,2 +298,3 @@ <Picker.Item | ||
onDownArrow, | ||
onDonePress, | ||
style, | ||
@@ -353,3 +351,3 @@ } = this.props; | ||
onPress={() => { | ||
this.togglePicker(true); | ||
this.togglePicker(true, onDonePress); | ||
}} | ||
@@ -360,3 +358,5 @@ hitSlop={{ top: 4, right: 4, bottom: 4, left: 4 }} | ||
<View testID="needed_for_touchable"> | ||
<Text style={[defaultStyles.done, style.done]}>{doneText}</Text> | ||
<Text allowFontScaling={false} style={[defaultStyles.done, style.done]}> | ||
{doneText} | ||
</Text> | ||
</View> | ||
@@ -387,2 +387,4 @@ </TouchableWithoutFeedback> | ||
const { children, style, textInputProps } = this.props; | ||
const { selectedItem } = this.state; | ||
const containerStyle = | ||
@@ -406,3 +408,3 @@ Platform.OS === 'ios' ? style.inputIOSContainer : style.inputAndroidContainer; | ||
]} | ||
value={this.state.selectedItem.label} | ||
value={selectedItem.label} | ||
ref={this.setInputRef} | ||
@@ -419,2 +421,3 @@ editable={false} | ||
const { style, modalProps, pickerProps } = this.props; | ||
const { animationType, orientation, selectedItem, showPicker } = this.state; | ||
@@ -433,7 +436,6 @@ return ( | ||
testID="ios_modal" | ||
visible={this.state.showPicker} | ||
visible={showPicker} | ||
transparent | ||
animationType={this.state.animationType} | ||
animationType={animationType} | ||
supportedOrientations={['portrait', 'landscape']} | ||
onDismiss={this.triggerDoneCallback} | ||
onOrientationChange={this.onOrientationChange} | ||
@@ -453,3 +455,3 @@ {...modalProps} | ||
defaultStyles.modalViewBottom, | ||
{ height: this.state.orientation === 'portrait' ? 215 : 162 }, | ||
{ height: orientation === 'portrait' ? 215 : 162 }, | ||
style.modalViewBottom, | ||
@@ -461,3 +463,3 @@ ]} | ||
onValueChange={this.onValueChange} | ||
selectedValue={this.state.selectedItem.value} | ||
selectedValue={selectedItem.value} | ||
{...pickerProps} | ||
@@ -475,2 +477,3 @@ > | ||
const { disabled, Icon, style, pickerProps } = this.props; | ||
const { selectedItem } = this.state; | ||
@@ -489,3 +492,3 @@ return ( | ||
onValueChange={this.onValueChange} | ||
selectedValue={this.state.selectedItem.value} | ||
selectedValue={selectedItem.value} | ||
{...pickerProps} | ||
@@ -501,2 +504,3 @@ > | ||
const { disabled, Icon, style, pickerProps } = this.props; | ||
const { selectedItem } = this.state; | ||
@@ -514,3 +518,3 @@ return ( | ||
onValueChange={this.onValueChange} | ||
selectedValue={this.state.selectedItem.value} | ||
selectedValue={selectedItem.value} | ||
{...pickerProps} | ||
@@ -517,0 +521,0 @@ > |
41614
563