Skip to content
New issue

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

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

Already on GitHub? # to your account

[#156101143][#156213326] Feature chat mentions upgrade #20

Merged
merged 7 commits into from
Mar 23, 2018

Conversation

armandgray
Copy link

  1. [#156101143] after deleting an @ mention moving the cursor to right after the “@” symbol
  2. [#156213326] sending on enter when clicked anywhere in the message

@@ -371,6 +370,31 @@ export default class MentionsTextInput extends Component {
}
}

setSelection(start, end = start) {

Choose a reason for hiding this comment

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

what are start and end?

Copy link
Author

Choose a reason for hiding this comment

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

the start and end of the selection!

Copy link
Author

@armandgray armandgray Mar 23, 2018

Choose a reason for hiding this comment

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

eg: 1234 -> you could select the chars from 0, 4

Choose a reason for hiding this comment

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

oh so these are indices, that wasn't too clear, but was able to gather from context. Might be useful to use flowtypes to say that they're numbers, e.g. start: number, end: number=start

Choose a reason for hiding this comment

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

Or maybe call it setSelectionFromIndices?

Copy link
Author

Choose a reason for hiding this comment

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

its called selection its a prop

Copy link
Author

Choose a reason for hiding this comment

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

the name is consistent with the name of the prop and the name of the passed param to onSelectionChange

Copy link
Author

Choose a reason for hiding this comment

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

ie selection: {start, end} is what RN has set as the naming convention

Choose a reason for hiding this comment

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

gotcha

@@ -526,12 +569,17 @@ export default class MentionsTextInput extends Component {
return !text1 && text2.length > 1 || text1.length < text2.length - 1;
}

hasNewLineChar(text) {
return text && text.length > 0 && text[text.length - 1] == '\n'
|| text.indexOf('\n') !== -1;

Choose a reason for hiding this comment

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

These two checks at the end seem redundant, it looks like you could get rid of the text[text.length - 1] == '\n'?

Copy link

@leoleblanc leoleblanc left a comment

Choose a reason for hiding this comment

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

👍

Copy link

@MattFoley MattFoley left a comment

Choose a reason for hiding this comment

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

👍

@armandgray armandgray merged commit db01ebe into master Mar 23, 2018
@armandgray armandgray deleted the feature-chat-mentions-upgrade branch March 23, 2018 22:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants