Skip to content

Commit

Permalink
Min composer height is not respecting props in some instances. Fixing…
Browse files Browse the repository at this point in the history
… this issue (#1078)
  • Loading branch information
nandiniparimi1107 authored and xcarpentier committed Jan 11, 2019
1 parent 837bbf2 commit f872d67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GiftedChat.js
Expand Up @@ -55,7 +55,7 @@ class GiftedChat extends React.Component {


this.state = { this.state = {
isInitialized: false, // initialization will calculate maxHeight before rendering the chat isInitialized: false, // initialization will calculate maxHeight before rendering the chat
composerHeight: MIN_COMPOSER_HEIGHT, composerHeight: this.props.minComposerHeight,
messagesContainerHeight: null, messagesContainerHeight: null,
typingDisabled: false, typingDisabled: false,
}; };
Expand Down Expand Up @@ -222,7 +222,7 @@ class GiftedChat extends React.Component {
: this.props.minInputToolbarHeight; : this.props.minInputToolbarHeight;
} }
calculateInputToolbarHeight(composerHeight) { calculateInputToolbarHeight(composerHeight) {
return composerHeight + (this.getMinInputToolbarHeight() - MIN_COMPOSER_HEIGHT); return composerHeight + (this.getMinInputToolbarHeight() - this.props.minComposerHeight);
} }


/** /**
Expand Down Expand Up @@ -357,7 +357,7 @@ class GiftedChat extends React.Component {
this.textInput.clear(); this.textInput.clear();
} }
this.notifyInputTextReset(); this.notifyInputTextReset();
const newComposerHeight = MIN_COMPOSER_HEIGHT; const newComposerHeight = this.props.minComposerHeight;
const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(newComposerHeight); const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(newComposerHeight);
this.setState({ this.setState({
text: this.getTextFromProp(''), text: this.getTextFromProp(''),
Expand Down Expand Up @@ -412,7 +412,7 @@ class GiftedChat extends React.Component {
} }
this.notifyInputTextReset(); this.notifyInputTextReset();
this.setMaxHeight(layout.height); this.setMaxHeight(layout.height);
const newComposerHeight = MIN_COMPOSER_HEIGHT; const newComposerHeight = this.props.minComposerHeight;
const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(newComposerHeight); const newMessagesContainerHeight = this.getMessagesContainerHeightWithKeyboard(newComposerHeight);
this.setState({ this.setState({
isInitialized: true, isInitialized: true,
Expand Down Expand Up @@ -440,7 +440,7 @@ class GiftedChat extends React.Component {
const inputToolbarProps = { const inputToolbarProps = {
...this.props, ...this.props,
text: this.getTextFromProp(this.state.text), text: this.getTextFromProp(this.state.text),
composerHeight: Math.max(MIN_COMPOSER_HEIGHT, this.state.composerHeight), composerHeight: Math.max(this.props.minComposerHeight, this.state.composerHeight),
onSend: this.onSend, onSend: this.onSend,
onInputSizeChanged: this.onInputSizeChanged, onInputSizeChanged: this.onInputSizeChanged,
onTextChanged: this.onInputTextChanged, onTextChanged: this.onInputTextChanged,
Expand Down

0 comments on commit f872d67

Please sign in to comment.