Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bietkul committed Jul 8, 2017
1 parent c3b9b31 commit f7e1c03
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/components/panel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Animated, Dimensions, View, Easing } from 'react-native';
import { Animated, Dimensions, View, Easing, Keyboard } from 'react-native';
import styles from './styles';

class Panel extends Component {
Expand All @@ -23,6 +23,7 @@ class Panel extends Component {
}

toggle() {
Keyboard.dismiss();
const initialValue = this.state.expanded ?
(this.state.maxHeight + this.state.minHeight) : this.state.minHeight;
const finalValue = this.state.expanded ?
Expand Down
8 changes: 4 additions & 4 deletions src/fields/date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export default class DatePickerField extends Component {
this.props.updateValue(this.props.attributes.name, date);
}
showTimePicker = async (stateKey) => {
const currentDate = this.props.attributes.value || new Date();
const { attributes } = this.props;
const currentDate = attributes.value ? new Date(attributes.value) : new Date();
try {
const { action, minute, hour } = await TimePickerAndroid.open({
hour: currentDate.getHours(),
Expand All @@ -41,8 +42,8 @@ export default class DatePickerField extends Component {
}
};
showDatePicker = async (stateKey) => {
const attributes = this.props.attributes;
const currentDate = attributes.value || new Date();
const { attributes } = this.props;
const currentDate = attributes.value ? new Date(attributes.value) : new Date();
try {
const { action, year, month, day } = await DatePickerAndroid.open(
{
Expand All @@ -68,7 +69,6 @@ export default class DatePickerField extends Component {
}
};
render() {
console.log(this.props);
const { theme, attributes } = this.props;
const value = (attributes.value && new Date(attributes.value)) || null;
const mode = attributes.mode || 'datetime';
Expand Down
5 changes: 2 additions & 3 deletions src/fields/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class FormField extends Component {
attributes: React.PropTypes.object,
theme: React.PropTypes.object,
updateValue: React.PropTypes.func,
autoValidation: React.PropTypes.bool,
customValidation: React.PropTypes.func,
}
constructor(props) {
super(props);
Expand All @@ -24,13 +26,11 @@ export default class FormField extends Component {
}, () => this.props.updateValue(this.props.attributes.name, text));
}
render() {
console.log(this.props);
const {
attributes,
theme,
autoValidation,
customValidation,
formData,
} = this.props;
return (
<View>
Expand All @@ -43,7 +43,6 @@ export default class FormField extends Component {
onValueChange={this.onValueChange}
autoValidation={autoValidation}
customValidation={customValidation}
formData={formData}
showErrors
fields={attributes.fields}
theme={theme}
Expand Down
13 changes: 5 additions & 8 deletions src/fields/select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ export default class SelectField extends Component {
}, () => this.props.updateValue(this.props.attributes.name, newSelected));
}
render() {
console.log(this.props);
const { attributes, theme } = this.props;
const { attributes } = this.props;
const selectedText = attributes.multiple ?
attributes.value.length || 'None' :
attributes.objectType ?
Expand Down Expand Up @@ -110,12 +109,10 @@ export default class SelectField extends Component {
onPress={() => this.toggleSelect(item)}
>
{ attributes.multiple &&
<View pointerEvents="none">
<CheckBox
onPress={() => this.toggleSelect(item)}
checked={isSelected}
/>
</View>
<CheckBox
onPress={() => this.toggleSelect(item)}
checked={isSelected}
/>
}
<Body>
<Text style={{ paddingHorizontal: 5 }}>
Expand Down
2 changes: 1 addition & 1 deletion src/fields/textInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class TextInputField extends Component {
this.props.updateValue(this.props.attributes.name, text);
}
render() {
const {theme, attributes} = this.props;
const { theme, attributes } = this.props;
const inputProps = attributes.props;
const keyboardType = getKeyboardType(attributes.type);
return (
Expand Down

0 comments on commit f7e1c03

Please sign in to comment.