Skip to content

Commit 3c1b923

Browse files
committed
Removed redundant type arg for widgets.
1 parent 3221b24 commit 3c1b923

File tree

9 files changed

+4
-18
lines changed

9 files changed

+4
-18
lines changed

src/components/fields/BooleanField.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function BooleanField({schema, name, uiSchema, formData, required, onChange}) {
88
const {widget} = uiSchema;
99
const commonProps = {
1010
schema,
11-
type: schema.type,
1211
onChange,
1312
label: title || name,
1413
placeholder: description,

src/components/fields/StringField.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import SelectWidget from "./../widgets/SelectWidget";
66

77

88
function StringField({schema, name, uiSchema, formData, required, onChange}) {
9-
const {type, title, description} = schema;
9+
const {title, description} = schema;
1010
const {widget} = uiSchema;
1111
const commonProps = {
1212
schema,
13-
type: type,
1413
label: title || name,
1514
placeholder: description,
1615
onChange,

src/components/widgets/CheckboxWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { PropTypes } from "react";
33

44
function CheckboxWidget({
55
schema,
6-
type,
76
onChange,
87
label,
98
defaultValue,
@@ -23,7 +22,6 @@ function CheckboxWidget({
2322
if (process.env.NODE_ENV !== "production") {
2423
CheckboxWidget.propTypes = {
2524
schema: PropTypes.object.isRequired,
26-
type: PropTypes.string.isRequired,
2725
onChange: PropTypes.func,
2826
label: PropTypes.string,
2927
defaultValue: PropTypes.bool,

src/components/widgets/RadioWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { PropTypes } from "react";
33

44
function RadioWidget({
55
schema,
6-
type,
76
options,
87
label,
98
placeholder,
@@ -38,7 +37,6 @@ function RadioWidget({
3837
if (process.env.NODE_ENV !== "production") {
3938
RadioWidget.propTypes = {
4039
schema: PropTypes.object.isRequired,
41-
type: PropTypes.string.isRequired,
4240
options: PropTypes.array.isRequired,
4341
label: PropTypes.string,
4442
placeholder: PropTypes.string,

src/components/widgets/RangeWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function rangeSpec(schema) {
1717

1818
function RangeWidget({
1919
schema,
20-
type,
2120
label,
2221
placeholder,
2322
value,
@@ -42,7 +41,6 @@ function RangeWidget({
4241
if (process.env.NODE_ENV !== "production") {
4342
RangeWidget.propTypes = {
4443
schema: PropTypes.object.isRequired,
45-
type: PropTypes.string.isRequired,
4644
label: PropTypes.string,
4745
placeholder: PropTypes.string,
4846
value: PropTypes.oneOfType([

src/components/widgets/SelectWidget.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ function processValue(type, value) {
1818

1919
function SelectWidget({
2020
schema,
21-
type,
2221
options,
2322
label,
2423
placeholder,
@@ -32,7 +31,9 @@ function SelectWidget({
3231
title={placeholder}
3332
value={value}
3433
defaultValue={defaultValue}
35-
onChange={(event) => onChange(processValue(type, event.target.value))}>{
34+
onChange={(event) => {
35+
onChange(processValue(schema.type, event.target.value));
36+
}}>{
3637
options.map((option, i) => {
3738
return <option key={i} value={option}>{String(option)}</option>;
3839
})
@@ -43,7 +44,6 @@ function SelectWidget({
4344
if (process.env.NODE_ENV !== "production") {
4445
SelectWidget.propTypes = {
4546
schema: PropTypes.object.isRequired,
46-
type: PropTypes.string.isRequired,
4747
options: PropTypes.array.isRequired,
4848
label: PropTypes.string,
4949
placeholder: PropTypes.string,

src/components/widgets/TextWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { PropTypes } from "react";
33

44
function TextWidget({
55
schema,
6-
type,
76
label,
87
placeholder,
98
value,
@@ -24,7 +23,6 @@ function TextWidget({
2423
if (process.env.NODE_ENV !== "production") {
2524
TextWidget.propTypes = {
2625
schema: PropTypes.object.isRequired,
27-
type: PropTypes.string.isRequired,
2826
label: PropTypes.string,
2927
placeholder: PropTypes.string,
3028
value: PropTypes.oneOfType([

src/components/widgets/TextareaWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { PropTypes } from "react";
33

44
function TextWidget({
55
schema,
6-
type,
76
label,
87
placeholder,
98
value,
@@ -24,7 +23,6 @@ function TextWidget({
2423
if (process.env.NODE_ENV !== "production") {
2524
TextWidget.propTypes = {
2625
schema: PropTypes.object.isRequired,
27-
type: PropTypes.string.isRequired,
2826
label: PropTypes.string,
2927
placeholder: PropTypes.string,
3028
value: PropTypes.string,

src/components/widgets/UpDownWidget.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function rangeSpec(schema) {
1717

1818
function UpDownWidget({
1919
schema,
20-
type,
2120
label,
2221
placeholder,
2322
value,
@@ -39,7 +38,6 @@ function UpDownWidget({
3938
if (process.env.NODE_ENV !== "production") {
4039
UpDownWidget.propTypes = {
4140
schema: PropTypes.object.isRequired,
42-
type: PropTypes.string.isRequired,
4341
label: PropTypes.string,
4442
placeholder: PropTypes.string,
4543
value: PropTypes.oneOfType([

0 commit comments

Comments
 (0)