[$250] Bank account - Selected digit is not turned green &number entered is entered in incorrect place
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.62-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No Issue reported by: Applause - Internal Team
Action Performed:
- Launch app
- Go to workspace settings- enable workflow
- Tap connect bank account - connect manually
- Enter an incorrect magic code
- Try to select any digit by tapping on it
- Enter a number
Expected Result:
Selected digit must be turned green and number entered must be entered in correct place
Actual Result:
Selected digit is not turned green and number entered is entered in incorrect place
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [x] Android: HybridApp
- [ ] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/4cb38890-89f9-4bf1-8ec7-1b27f27f1ff9
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021858629538288881697
- Upwork Job ID: 1858629538288881697
- Last Price Increase: 2024-11-25
Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
Edited by proposal-police: This proposal was edited at 2024-11-14 16:27:08 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
Selected digit is not turned green and number entered is entered in incorrect place
What is the root cause of that problem?
We're using GestureDetector in MagicCodeInput but we didn't wrap it in GestureHandlerRootView
Reference: https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation/
We also wrapped GestureDetector inside GestureHandlerRootView in other places like AvatarCropModal, ...
What changes do you think we should make in order to solve the problem?
We should wrap MagicCodeInput inside GestureHandlerRootView, so in here, we can add GestureHandlerRootView
<GestureHandlerRootView
...
We can add GestureHandlerRootView in BaseModal, and PopoverWithoutOverlay then remove the unnecessary GestureHandlerRootView in other places
What alternative solutions did you explore? (Optional)
Result
https://github.com/user-attachments/assets/6c817101-0d50-48c3-8a0f-cbaa95b0ef19
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pressing on a magic code digit input doesn't highlight the digit input.
What is the root cause of that problem?
The magic code input consists of a single TextInput and we apply a gesture handler to detecte on which digit input placeholder is pressed/tapped. https://github.com/Expensify/App/blob/a6f1348d08a441f4f9b48a8ef05e5e95c96b53d7/src/components/MagicCodeInput.tsx#L213-L226
However, the gesture handler doesn't work when used inside a modal, which is true for our case. This is mentioned on the rngh docs here.
What changes do you think we should make in order to solve the problem?
We need to wrap the modal content with a gesture handler root view. RNGH provides a HOC (gestureHandlerRootHOC ) that only wraps it on Android.
We can wrap the color scheme wrapper with the HOC. https://github.com/Expensify/App/blob/a6f1348d08a441f4f9b48a8ef05e5e95c96b53d7/src/components/Modal/BaseModal.tsx#L272-L277
const ColorSchemeWrapperWithGesture = useMemo(() => gestureHandlerRootHOC(ColorSchemeWrapper, {
flex: modalContainerStyle.flex,
height: modalContainerStyle.height,
width: modalContainerStyle.width,
}), [modalContainerStyle.flex, modalContainerStyle.height, modalContainerStyle.width]);
...
<ColorSchemeWrapperWithGesture>{children}</ColorSchemeWrapperWithGesture>
We need to pass the sizing style based on the modalContainerStyle so it can be sized properly when sizing using flex or percentage value.
OR
We wrap the View wrapper instead, but GetureHandlerRootView doesn't accept ref, but I don't see we use the ref either.
Note for C+: The link I mentioned here suggest to use GestureHandlerRootView or gestureHandlerRootHOC, but using gestureHandlerRootHOC has 2 disadvantages:
- We don't encourage using HOCs, refer: https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md
- We're using
GestureHandlerRootViewin many places
As in the docs, they said that we should use GestureHandlerRootView in the root view, but we didn't do it in BaseModal or PopoverWithoutOverlay. I believe there's a reason that encourages us to use GestureHandlerRootView in the individual modal.
@johncschuster Whoops! This issue is 2 days overdue. Let's get this updated quick!
Job added to Upwork: https://www.upwork.com/jobs/~021858629538288881697
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)
@alitoshmatov Can you please review my proposal? Thanks
@johncschuster, @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
I'm working a shorter week this week and couldn't fit this in today
(I've bumped Slack)
@truph01 Thank you for your proposal, I suggest you provide more explanation on your root causes it seemed like it was just justifying your solution. I understood it after seeing @bernhardoj 's reasoning. Though your solution is correct and solves the issue.
@bernhardoj Thank you for your proposal, your solution works, but I think it is better to just use GestureHandlerRootView inside modal component fixing GestureDetector to work in any modal
We can go with @truph01 's proposal which solve the issue by adding GestureHandlerRootView inside modal
C+ reviewed π π π
Triggered auto assignment to @johnmlee101, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
My proposal also adds GestureHandlerRootView inside the modal through the gestureHandlerRootHOC. gestureHandlerRootHOC only applies it on Android.
, but I think it is better to just use GestureHandlerRootView
I don't see a reason why we prefer applying it to all platforms when the docs recommend using the HOC because it's an Android issue only. @truph01 proposal also doesn't handle the style break after applying GestureHandlerRootView.
@johnmlee101 @johncschuster @alitoshmatov this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
Issue not reproducible during KI retests. (First week)
@bernhardoj The docs recommend we use GestureHandlerRootView or gestureHandlerRootHOC.
After installation, wrap your entry point with
<GestureHandlerRootView>or gestureHandlerRootHOC.
But HOC is not recommend in our App.
@truph01 proposal also doesn't handle the style break after applying GestureHandlerRootView.
If we decide to add it in BaseValidateCodeForm, we don't need to add styles, you can see my video in the proposal. We just need to apply modalContainerStyle in case we add it in BaseModal
The docs recommend we use GestureHandlerRootView or gestureHandlerRootHOC.
I'm talking about this part of the doc: https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation#usage-with-modals-on-android
But HOC is not recommend in our App.
This is not true.
Hooks and HOCs Use hooks whenever possible, avoid using HOCs.
The docs stated to use hooks whenever possible, but GestureHandlerRootView is a View and not replaceable by a hook.
Looks like @alitoshmatov think that my proposal doesn't solve the issue globally which in fact does. Can you recheck all the conversation above?
We also wrapped GestureDetector inside GestureHandlerRootView in other places like AvatarCropModal, ...
So I believe we prefer using GestureHandlerRootView
@johnmlee101, @johncschuster, @alitoshmatov Huh... This is 4 days overdue. Who can take care of this?
Looks like @alitoshmatov think that my proposal doesn't solve the issue globally which in fact does. Can you recheck all the conversation above?
I am sorry, I think I miscommunicated there about this point.
My though process was that since we use GestureHandlerRootView in several places for modals, why not remove them all and apply it BaseModal component
@bernhardoj Can we also remove all GestureHandlerRootView usages when applying your solution?
Yes, we should be able to do that since the HOC wraps the component with GestureHanderRootView, but it's only for Android based on the doc.
I mentioned this in my proposal too.
We need to wrap the modal content with a gesture handler root view. RNGH provides a HOC (gestureHandlerRootHOC ) that only wraps it on Android.
@alitoshmatov GestureHandlerRootView also can apply in BaseModal