react-native-picker-select
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -0,1 +1,9 @@ | ||
### 6.1.1 | ||
##### Bugfix | ||
- Replaced setTimeouts with callbacks for arrow buttons (#177) | ||
--- | ||
### 6.1.0 | ||
@@ -2,0 +10,0 @@ |
{ | ||
"name": "react-native-picker-select", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "A Picker component for React Native which emulates the native <select> interfaces for each platform", | ||
@@ -37,4 +37,4 @@ "license": "MIT", | ||
"enzyme-to-json": "^3.3.5", | ||
"eslint-config-ls-react": "https://github.com/lawnstarter/eslint-config-ls-react#2.0.3", | ||
"husky": "^0.14.3", | ||
"eslint-config-ls-react": "https://github.com/lawnstarter/eslint-config-ls-react#3.0.0", | ||
"husky": "^2.4.0", | ||
"jest": "^23.6.0", | ||
@@ -54,7 +54,13 @@ "prettier": "^1.15.3", | ||
"open:coverage": "open ./coverage/lcov-report/index.html", | ||
"precommit": "pretty-quick --staged", | ||
"prettier:debug-check": "prettier --config ./.prettierrc.js --debug-check \"{src,test}/**/*.js\"", | ||
"preprettier:all": "yarn run prettier:debug-check", | ||
"prettier:all": "prettier --config ./.prettierrc.js --write \"{src,test}/**/*.js\"" | ||
"prettier:all": "prettier --config ./.prettierrc.js --write \"{src,test}/**/*.js\"", | ||
"lint": "echo \"---Running ESLint---\" && eslint \"src/**/*.{js,jsx}\"" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged", | ||
"pre-push": "echo \"---Running ESLint---\" && yarn lint && yarn test" | ||
} | ||
}, | ||
"jest": { | ||
@@ -61,0 +67,0 @@ "preset": "react-native", |
@@ -79,3 +79,3 @@ # react-native-picker-select | ||
This component has been tested on React Native v0.51 - v0.57 | ||
This component has been tested on React Native v0.51 - v0.58 | ||
@@ -82,0 +82,0 @@ [![BrowserStack](https://i.imgur.com/cOdhMed.png)](https://www.browserstack.com/) |
@@ -169,11 +169,9 @@ import React, { PureComponent } from 'react'; | ||
this.togglePicker = this.togglePicker.bind(this); | ||
this.triggerDoneCallback = this.triggerDoneCallback.bind(this); | ||
} | ||
// these timeouts were a hacky first pass at ensuring the callback triggered after the modal animation | ||
// TODO: find a better approach | ||
onUpArrow() { | ||
const { onUpArrow } = this.props; | ||
this.togglePicker(); | ||
setTimeout(onUpArrow); | ||
this.togglePicker(false, onUpArrow); | ||
} | ||
@@ -184,4 +182,3 @@ | ||
this.togglePicker(); | ||
setTimeout(onDownArrow); | ||
this.togglePicker(false, onDownArrow); | ||
} | ||
@@ -194,4 +191,6 @@ | ||
this.setState({ | ||
selectedItem: this.state.items[index], | ||
this.setState((prevState) => { | ||
return { | ||
selectedItem: prevState.items[index], | ||
}; | ||
}); | ||
@@ -229,3 +228,10 @@ } | ||
togglePicker(animate = false) { | ||
triggerDoneCallback() { | ||
const { hideDoneBar, onDonePress } = this.props; | ||
if (!hideDoneBar && onDonePress) { | ||
onDonePress(); | ||
} | ||
} | ||
togglePicker(animate = false, postToggleCallback) { | ||
const { modalProps, disabled } = this.props; | ||
@@ -237,2 +243,6 @@ | ||
if (!this.state.showPicker) { | ||
Keyboard.dismiss(); | ||
} | ||
const animationType = | ||
@@ -243,11 +253,15 @@ modalProps && modalProps.animationType ? modalProps.animationType : 'slide'; | ||
this.setState({ | ||
animationType: animate ? animationType : undefined, | ||
showPicker: !this.state.showPicker, | ||
}); | ||
if (!this.state.showPicker && this.inputRef) { | ||
this.inputRef.focus(); | ||
this.inputRef.blur(); | ||
} | ||
this.setState( | ||
(prevState) => { | ||
return { | ||
animationType: animate ? animationType : undefined, | ||
showPicker: !prevState.showPicker, | ||
}; | ||
}, | ||
() => { | ||
if (postToggleCallback) { | ||
postToggleCallback(); | ||
} | ||
} | ||
); | ||
} | ||
@@ -269,3 +283,3 @@ | ||
renderDoneBar() { | ||
const { doneText, hideDoneBar, onUpArrow, onDownArrow, onDonePress, style } = this.props; | ||
const { doneText, hideDoneBar, onUpArrow, onDownArrow, style } = this.props; | ||
@@ -313,5 +327,2 @@ if (hideDoneBar) { | ||
this.togglePicker(true); | ||
if (onDonePress) { | ||
onDonePress(); | ||
} | ||
}} | ||
@@ -383,3 +394,2 @@ hitSlop={{ top: 4, right: 4, bottom: 4, left: 4 }} | ||
onPress={() => { | ||
Keyboard.dismiss(); | ||
this.togglePicker(true); | ||
@@ -397,2 +407,3 @@ }} | ||
supportedOrientations={['portrait', 'landscape']} | ||
onDismiss={this.triggerDoneCallback} | ||
// onOrientationChange={TODO: use this to resize window} | ||
@@ -399,0 +410,0 @@ {...modalProps} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36684
527