Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit fb01932

Browse files
committed
Removing console.error in React Native env. Fixes #495
1 parent e2f4d19 commit fb01932

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/actions/field-actions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import getFieldFromState from '../utils/get-field-from-state';
1313
import isValid from '../form/is-valid';
1414
import NULL_ACTION from '../constants/null-action';
1515
import omit from 'lodash/omit';
16+
import isNative from '../utils/is-native';
1617

1718
const defaultStrategies = {
1819
get: _get,
@@ -198,7 +199,8 @@ function createFieldActions(s = defaultStrategies) {
198199
setValidity(model, response),
199200
]));
200201
}).catch(error => {
201-
console.error(error);
202+
if (!isNative) console.error(error);
203+
202204
dispatch(batch(model, [
203205
setSubmitFailed(model),
204206
errorsAction(model, error),

src/components/control-component.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
440440
changeAction,
441441
parser,
442442
} = this.props;
443-
const loadActions = [];
444443
let defaultValue = undefined;
445444

446445
if (controlProps.hasOwnProperty('defaultValue')) {
@@ -449,12 +448,11 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
449448
defaultValue = controlProps.defaultChecked;
450449
}
451450

451+
const loadActions = [this.getValidateAction(defaultValue)];
452+
452453
if (typeof defaultValue !== 'undefined') {
453-
loadActions.push(this.getValidateAction(defaultValue));
454454
loadActions.push(changeAction(model, defaultValue));
455455
} else {
456-
loadActions.push(this.getValidateAction(modelValue));
457-
458456
if (parser) {
459457
const parsedValue = parser(modelValue);
460458

@@ -528,7 +526,6 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
528526
: event;
529527
}
530528

531-
532529
if (isReadOnlyValue(controlProps)) {
533530
return compose(
534531
dispatchBatchActions,
@@ -592,10 +589,7 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
592589
if (control) {
593590
return cloneElement(
594591
control,
595-
{
596-
...mappedProps,
597-
onKeyPress: this.handleKeyPress,
598-
},
592+
mappedProps,
599593
controlProps.children);
600594
}
601595

@@ -604,9 +598,7 @@ function createControlClass(customControlPropsMap = {}, s = defaultStrategy) {
604598
{
605599
...controlProps,
606600
...mappedProps,
607-
onKeyPress: this.handleKeyPress,
608-
},
609-
controlProps.children);
601+
});
610602
}
611603
}
612604

0 commit comments

Comments
 (0)