Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep keyboard visible on iOS/Android after posting a comment #224

Merged
merged 4 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/icon-send.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 25 additions & 17 deletions src/page/HomePage/Report/ReportHistoryCompose.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import {View, Image, TouchableOpacity} from 'react-native';
import styles from '../../../style/StyleSheet';
import TextInputFocusable from '../../../components/TextInputFocusable';
import sendIcon from '../../../../assets/images/icon-send.png';

const propTypes = {
// A method to call when the form is submitted
Expand Down Expand Up @@ -75,22 +76,29 @@ class ReportHistoryCompose extends React.Component {
render() {
return (
<View style={[styles.chatItemCompose]}>
<TextInputFocusable
multiline
blurOnSubmit
textAlignVertical="top"
numberOfLines={1}
minHeight={40}
maxHeight={60}
placeholder="Write something..."
placeholderTextColor="#7D8B8F"
onChangeText={this.updateComment}
onKeyPress={this.triggerSubmitShortcut}
style={[styles.textInput]}
value={this.state.comment}
returnKeyType="send"
onSubmitEditing={this.submitForm}
/>
<View style={[styles.chatItemComposeBox, styles.flexRow]}>
<TextInputFocusable
multiline
textAlignVertical="top"
placeholder="Write something..."
placeholderTextColor="#7D8B8F"
onChangeText={this.updateComment}
onKeyPress={this.triggerSubmitShortcut}
style={[styles.textInput, styles.textInputCompose, styles.flex4]}
value={this.state.comment}
/>
<TouchableOpacity
style={[styles.chatItemSubmitButton, styles.buttonSuccess]}
onPress={this.submitForm}
underlayColor="#fff"
>
<Image
resizeMode="contain"
style={[styles.chatItemSubmitButtonIcon]}
source={sendIcon}
/>
</TouchableOpacity>
</View>
</View>
);
}
Expand Down
39 changes: 39 additions & 0 deletions src/style/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const styles = {
mr2: {
marginRight: 8,
},
mr3: {
marginRight: 12,
},

ml1: {
marginLeft: 10,
Expand Down Expand Up @@ -135,11 +138,13 @@ const styles = {
textInput: {
backgroundColor: colors.componentBG,
borderRadius: 8,
height: 40,
borderColor: colors.border,
borderWidth: 1,
color: colors.text,
fontFamily: 'GTAmericaExp-Regular',
padding: 12,
textAlignVertical: 'center',
},

textInputReversed: {
Expand Down Expand Up @@ -457,6 +462,40 @@ const styles = {
paddingBottom: 20,
paddingLeft: 20,
paddingRight: 20,
display: 'flex',
},

chatItemComposeBox: {
backgroundColor: '#FFFFFF',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: could this be defined as a color variable?

borderWidth: 1,
borderColor: colors.border,
borderRadius: 8,
minHeight: 40,
},

textInputCompose: {
borderWidth: 0,
outline: 0,
height: 'auto',
minHeight: 38,
padding: 10,
},

chatItemSubmitButton: {
alignSelf: 'flex-end',
borderRadius: 6,
height: 32,
paddingTop: 8,
paddingRight: 6,
paddingBottom: 8,
paddingLeft: 6,
margin: 3,
justifyContent: 'center',
},

chatItemSubmitButtonIcon: {
height: 20,
width: 20,
},

hamburgerOpenAbsolute: {
Expand Down