Skip to content

Commit

Permalink
Remove old hack for expanding textviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Muniz committed Mar 21, 2018
1 parent 19cb00e commit e74c34e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 47 deletions.
57 changes: 21 additions & 36 deletions __tests__/views/feedback/__snapshots__/FeedbackView.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,13 @@ exports[`renders form when request is finished 1`] = `
placeholder="Tell us what you think*"
returnKeyType="done"
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
},
Object {
"height": 50,
},
]
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
}
}
underlineColorAndroid="transparent"
value=""
Expand Down Expand Up @@ -282,18 +277,13 @@ exports[`renders form when request is finished 2`] = `
placeholder="Tell us what you think*"
returnKeyType="done"
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
},
Object {
"height": 50,
},
]
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
}
}
underlineColorAndroid="transparent"
value=""
Expand Down Expand Up @@ -441,18 +431,13 @@ exports[`renders without crashing 1`] = `
placeholder="Tell us what you think*"
returnKeyType="done"
style={
Array [
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
},
Object {
"height": 50,
},
]
Object {
"alignItems": "center",
"backgroundColor": "white",
"flex": 1,
"fontSize": 18,
"padding": 8,
}
}
underlineColorAndroid="transparent"
value=""
Expand Down
2 changes: 0 additions & 2 deletions app/reducers/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const initialState = {
comment: '',
name: '',
email: '',
commentHeight: 0,
status: {
requesting: false
}
Expand All @@ -22,7 +21,6 @@ function feedback(state = initialState, action) {
requesting: false
};
delete newState.status.timeRequested;
resetFeedback.commentHeight = 0;
return resetFeedback;
}
case 'FEEDBACK_POST_FAILED': {
Expand Down
12 changes: 3 additions & 9 deletions app/views/feedback/FeedbackView.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,13 @@ export class FeedbackView extends Component {

handleFeedbackInput = fieldName => (e) => {
const {
comment, name, email, commentHeight
comment, name, email
} = this.props.feedback;
const newFeedback = {
comment, name, email, commentHeight
comment, name, email
};
newFeedback[fieldName] = e.nativeEvent.text;

if (fieldName === 'comment') {
if (this.props.feedback.commentHeight !== e.nativeEvent.contentSize.height) {
newFeedback.commentHeight = e.nativeEvent.contentSize.height;
}
}

this.props.updateFeedback(newFeedback);
}

Expand All @@ -116,7 +110,7 @@ export class FeedbackView extends Component {
onChange={this.handleFeedbackInput('comment')}
placeholder="Tell us what you think*"
underlineColorAndroid="transparent"
style={[css.feedback_text_input, { height: Math.max(50, this.props.feedback.commentHeight) }]}
style={css.feedback_text_input}
returnKeyType="done"
maxLength={500}
/>
Expand Down

0 comments on commit e74c34e

Please sign in to comment.