Skip to content

Commit

Permalink
fixes #221 update Select filed to set the currentValue
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Sep 20, 2020
1 parent d98bd0b commit 0abefcc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-schema-form",
"version": "0.9.6",
"version": "0.9.7",
"description": "React json schema form",
"keywords": [
"json schema",
Expand Down
3 changes: 2 additions & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function Select(props) {

const onSelected = (event) => {
const selectedValue = event.target.value
setCurrentValue(selectedValue)
if (isObject) {
const item = values.find((each) =>
findFn ? findFn(each, selectedValue) : each === selectedValue
Expand All @@ -58,7 +59,7 @@ function Select(props) {
}

let menuItems = []
if (form.schema.isObject) {
if (isObject) {
menuItems = form.schema.enum.map((item, idx) => (
// eslint-disable-next-line react/no-array-index-key
<MenuItem key={idx} value={item}>
Expand Down

0 comments on commit 0abefcc

Please sign in to comment.