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

Add prop onInputTextChanged on GiftedChat API and help fix #286 #301

Closed
wants to merge 2 commits into from

Conversation

jayshah123
Copy link
Contributor

This introduces a new prop : onInputTextChanged on GiftedChat API,
which is a callback function that will give whatever text is present currently in Composer back to user.
Composer has onChange prop but it is kind of consumed by onType function in GiftedChat.js.
This will also help fix #286, where you see GiftedChat.js personally uses onChange,
and the behaviour such as height calculation would have to be performed by library user (which right now happens in onType in GiftedChat.js)
This prop gives users a simpler interface to track change in input text, with all other features intact.
Kindly guide with suggestions/comments wherever feels necessary.
Thank you.

@@ -82,7 +82,7 @@ export default class Message extends React.Component {
<View>
{this.renderDay()}
<View style={[styles[this.props.position].container, {
marginBottom: this.isSameUser(this.props.currentMessage, this.props.nextMessage) ? 2 : 10,
marginBottom: this.isSameUser(this.props.currentMessage, this.props.nextMessage) ? this.props.marginSameUser : this.props.marginDifferentUser,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jayshah123

I think that this is not related to the original PR. In my opinion, is better to split this changes in two different PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry,
Actually in the PR I only want the first commit to go in (When I raised PR it had only the first commit) I have never sent a pull request before on a github.
How can I do that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jayshah123 This is how github works, you stated that the master branch of your fork is the source of the PR so every change in it will be included, you could use a feature branch to achieve what you want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I think I will revert the second commit and that should remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure :)
Give it a try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewriting history is Ok? I will close PR, rewrite history and raise a fresh PR(with single commit).

Copy link
Contributor

@dgdavid dgdavid Dec 12, 2016

Choose a reason for hiding this comment

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

@jayshah123 Don't worry.

You only need to create a new branch in your fork, make the commit on it and create a new PR in the same way you created the previous one.

The Github documentation is better explained that my comment. Here you have some links. I hope it'll be useful for you.

https://guides.github.com/introduction/flow/
https://help.github.com/articles/creating-a-pull-request/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha Got it thanks!

@@ -119,6 +119,8 @@ Message.defaultProps = {
renderBubble: null,
renderDay: null,
position: 'left',
marginSameUser: 6,
Copy link
Contributor

Choose a reason for hiding this comment

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

The original value was 2. Just for curiosity, Why do you want to change it?

@jayshah123 jayshah123 closed this Dec 12, 2016
@jayshah123
Copy link
Contributor Author

I'm a novice github user,
messed up this PR by adding a unnecessary commit on master branch.
Will raise a proper PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange behavior with onChange in overridden Composer for typing indicator for that user
3 participants