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

Rename TextInputFocusable to Composer ⌨️ & add Stories For TextInputs and fix bugs #7984

Merged
merged 17 commits into from
Mar 11, 2022

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Mar 2, 2022

Details

  • Fix bugs with TextInput.
  • Add Stories for Composer & TextInput variants.
  • Rename TextInputFocusable to Composer to better reflect its purpose.

Fixed Issues

$ #6584

Tests

  1. Tested the message sending functionality.
  2. Tested EmojiPicker.
  3. Add Stories and test that they are working fine without errors.
  • Verify that no errors appear in the JS console

PR Review Checklist

Contributor (PR Author) Checklist

  • I made sure to pull main before submitting my PR for review
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I clearly indicated the environment tests should be run in (Staging vs Production)
  • I wrote testing steps that cover success & fail scenarios (if applicable)
  • I ran the tests & they passed on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified there are no console errors related to changes in this PR
  • I followed proper code patterns (see Reviewing the code)
    • I added comments when the code was not self explanatory
    • I put all copy / text shown in the product in all src/languages/* files (if applicable)
    • I followed proper naming convention for platform-specific files (if applicable)
    • I followed style guidelines (in Styling.md) for all style edits I made
  • I followed the guidelines as stated in the Review Guidelines

PR Reviewer Checklist

  • I verified the Author pulled main before submitting the PR
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the testing environment is mentioned in the test steps
  • I verified testing steps cover success & fail scenarios (if applicable)
  • I verified tests pass on all platforms & I tested again on all platforms
  • I checked that screenshots or videos are included for tests on all platforms
  • I verified there are no console errors related to changes in this PR
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified comments were added when the code was not self explanatory
    • I verified any copy / text shown in the product was added in all src/languages/* files (if applicable)
    • I verified proper naming convention for platform-specific files was followed (if applicable)
    • I verified style guidelines were followed
  • I verified that this PR follows the guidelines as stated in the Review Guidelines

QA Steps

  1. Open the app on test the following steps on each platform.
  2. Check that you are able to send messages as before on all platforms. You are able to use Markdown as before to compose the message.

  1. Open Stories on Staging Web app via https://staging.new.expensify.com/docs/index.html.
  2. Check if it has the following stories (title can slightly differ from below mentioned items):
 -  TextInput/AutoGrow,
    TextInput/PrefixedInput,
    TextInput/ForceActiveLabel,
    TextInput/MaxLengthInput,
    TextInput/HintAndErrorInput,
    Composer/DefaultInput
  1. Test these stories. They should work as titled.

  1. Go to the request Money Page and try to add the amount. It should work as before. Test it on all platforms.
  2. Go to Profile Page, Try to change Profile settings and details. It should work as before.
  • Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

image
image

Mobile Web

image

Desktop

image

iOS

image

Android

@parasharrajat parasharrajat requested a review from a team as a code owner March 2, 2022 17:54
@parasharrajat parasharrajat changed the title Rename TextInput Focusable to Composer ⌨️ & add Stories [HOLD] Rename TextInput Focusable to Composer ⌨️ & add Stories Mar 2, 2022
@MelvinBot MelvinBot requested review from NikkiWines and rushatgabhane and removed request for a team March 2, 2022 17:55
@parasharrajat
Copy link
Member Author

Found one issue. MaxLength Counter is not incrementing automatically when a user types the value in the Story. The reason is that when we don't bound the value prop to state on the parent component, TextInput never renders on the new value as it does not use state. We have to move the value property to state so that increments properly.

But this issue is not linked with this PR and thus I request another milestone on the current contract to fix this.

@rushatgabhane
Copy link
Member

@parasharrajat this is ready for review yeah? let's remove the hold then

@parasharrajat
Copy link
Member Author

I will update the screenshots and then remove the hold.

@parasharrajat
Copy link
Member Author

Leaving a note so that I can fix those into the same milestone #7984 (comment)
Another issue: When the label is forced to be active. Placeholder text is not visible until you focus the input.

@parasharrajat
Copy link
Member Author

@rushatgabhane Do you want me to fix above-mentioned issues in the current PR or create a new PR?

@rushatgabhane
Copy link
Member

rushatgabhane commented Mar 7, 2022

@parasharrajat let's create a new PR, it'll be easier to read if someone comes back to it later.

@parasharrajat
Copy link
Member Author

Then it's good on hold. This is supposed to be final PR.

@parasharrajat
Copy link
Member Author

Issue: Autogrow does not work for unbound inputs.

@parasharrajat
Copy link
Member Author

I think it makes sense to keep them here as they won't make sense without stories.

@parasharrajat parasharrajat changed the title [HOLD] Rename TextInput Focusable to Composer ⌨️ & add Stories Rename TextInputFocusable to Composer ⌨️ & add Stories For TextInputs and fix bugs Mar 7, 2022
@rushatgabhane
Copy link
Member

Cool, I'll review this tomorrow

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

Looks good
@parasharrajat idk how to comment on files that aren't modified

But just rename these to composer, thanks!
Screen Shot 2022-03-09 at 6 23 49 PM

@parasharrajat
Copy link
Member Author

Yeah. Missed that.

Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@parasharrajat compose box disappears when editing comment.
This isn't present on main

Screen.Recording.2022-03-09.at.7.09.44.PM.mov

@parasharrajat
Copy link
Member Author

This is on main. And I don't see how this is related to changes on this PR.

@rushatgabhane
Copy link
Member

You're right. Sorry, I was mistaken

rushatgabhane
rushatgabhane previously approved these changes Mar 9, 2022
Copy link
Member

@rushatgabhane rushatgabhane left a comment

Choose a reason for hiding this comment

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

@NikkiWines LGTM! 🎉

Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

Couple small comments. I think since this is changing so much your test and QA steps need to be more robust @parasharrajat

src/styles/addOutlineWidth/index.js Outdated Show resolved Hide resolved
src/components/TextInput/baseTextInputPropTypes.js Outdated Show resolved Hide resolved
src/stories/Composer.stories.js Outdated Show resolved Hide resolved
src/stories/Composer.stories.js Show resolved Hide resolved
src/components/TextInput/BaseTextInput.js Outdated Show resolved Hide resolved
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
onChangeText={(value) => {
if (value && value.toLowerCase() === 'damn!') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why damn!? 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

Just an example. 🤣 It fits into Damn! there is an error. hint messages.

Copy link
Contributor

@NikkiWines NikkiWines Mar 11, 2022

Choose a reason for hiding this comment

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

😅 I think it's probably better to use something like Oops! Looks like there's an error.

src/components/TextInput/BaseTextInput.js Show resolved Hide resolved
@parasharrajat
Copy link
Member Author

Updated.

Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

Sorry noticed while running through the test steps that we're getting fairly inconsistent in TextInput.stories.js - let's try to have standard conventions there.

Also, I would update the QA steps to identify how to get to Stories

const AutoGrow = Template.bind({});
AutoGrow.storyName = 'Autogrow input';
AutoGrow.args = {
label: 'Autogrow input',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's standardize the case-convention for the labels: AutoGrow Input since the other labels seem to capitalize everything.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems older ones have first as only capital letter so I am going with that following the page titles in the app.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there are still two main conventions for labels:

  1. Input with xyz - e.g. Input with default value
  2. xyz input - e.g. Prefixed input

I'm fine with either options but i do think we should pick one

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated most of them. Left few whose name makes more sense. But I would say it does not matter much. The main perspective should be that they should clearly show the proper example of that component/varient

src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
/>
);
};
HintErrorInput.storyName = 'Input with hint & error';
Copy link
Contributor

Choose a reason for hiding this comment

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

HintAndError Input?

@parasharrajat
Copy link
Member Author

parasharrajat commented Mar 11, 2022

Updated. I don't remember the exact URL to open the stories on staging. Could you please let me know so that I can update that in QA steps?

NikkiWines
NikkiWines previously approved these changes Mar 11, 2022
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

Couple of other comments, but since you've updated the ones you added I'm happy to make another PR to handle standardizing some of the older inputs.

I'll approve but will re-review if you want to implement the suggested changes

src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
src/stories/TextInput.stories.js Outdated Show resolved Hide resolved
const AutoGrow = Template.bind({});
AutoGrow.storyName = 'Autogrow input';
AutoGrow.args = {
label: 'Autogrow input',
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like there are still two main conventions for labels:

  1. Input with xyz - e.g. Input with default value
  2. xyz input - e.g. Prefixed input

I'm fine with either options but i do think we should pick one

@NikkiWines
Copy link
Contributor

Updated. I don't remember the exact URL to open the stories on staging. Could you please let me know so that I can update that in QA steps?

yeah! the URL is https://staging.new.expensify.com/docs/index.html

Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

👍 Thanks for updating those

@NikkiWines
Copy link
Contributor

Gonna merge as @rushatgabhane already approved earlier

@NikkiWines NikkiWines merged commit a613b2b into Expensify:main Mar 11, 2022
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @NikkiWines in version: 1.1.43-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.43-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@mananjadhav
Copy link
Collaborator

I am tagging this PR to highlight an issue fixed here. All conditions in ternary expressions or left-hand operands on conditional renders, should be boolean. This PR is one of the PRs that uses conditional render with string operands, hence I am tagging it here for the contributors to check.

We've also updated the item in the checklist with this PR to avoid this issue in the future.

@parasharrajat parasharrajat deleted the textinput-final branch November 20, 2023 13:08
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.

None yet

5 participants