Open kavimuru opened 1 year ago
@0xmiroslav
The issue is that on iOS native apps, the double-tapping feature, which should add a dot when tapping the space key twice, is not working as expected.
Identifying the root cause of the problem:
The “TextInput” component on the iOS side is managed by the RCTSinglelineTextInputView
module ( multiline=false ). When the value prop is not used, the component behaves as an uncontrolled component, where the system handles the text updates. However, when the value prop is used, the component becomes a controlled component, relying on the provided value to update the text. This controlled component setup involves increased communication between the JS and Native sides.
To ensure the native state remains synchronized, there is a method called updateState
that handles updating the native event after a text change. However, in the case of a controlled component, the additional back-and-forth interaction between JavaScript and Native can cause the “updateState” method to be executed multiple times. During these multiple updates, the text may be replaced, even with the same text content. This discrepancy in the number of state updates disrupts the expected behavior of the double-tapping feature, which relies on the detection of consecutive spaces.
To resolve this issue, I propose adding a flag named _stateUpdated
to control the execution of the “updateState” method. By setting this flag to ensure that “updateState” is executed only once, this will align the behavior with that of an uncontrolled component. The flag will be cleared after any new text change in the textField:(_unused UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
method. Since this method is always executed before “updateState” and not affected by the back-and-forth sync between JS and Native realms, it provides a reliable point to control the state updates.
This mean a fix at react-native framework
During the investigation, I explored a couple of alternative solutions to address the issue:
multiline
prop: This approach involves utilizing a different component that is always uncontrolled and handled by the system. However, adopting this solution may introduce challenges in making the input behave as a single-line component, potentially conflicting with the desired functionality.value
prop (yes using onChange
): By not using the value
prop, we can revert the component to an uncontrolled state, allowing the system to handle all text changes. However, this would require accessing the text through a ref or storing it in the component’s state. While this approach may resolve the issue, it may result in the loss of text formatting features.Thanks for the deep research. I also confirmed that it happens only when single line and uncontrolled input. I am inclined to root cause analysis and proposed fix. As this should be upstream fix, will keep watching upstream issue you created and following PR. Meanwhile, we can hold the issue here since it will take some time for upstream PR to be reviewed, merged and deployed.
Nice, great work gedu. I'll demote the issue and place HOLD on it so that melvin doesn't make it overdue each day. Feel free to remove HOLD and make issue daily once upstream issue is live.
Sounds great, will take care another task for a couple of days and come back to create a Draft PR on react-native framework
Not overdue. On hold
Working on another tickets that has more priority, as soon as I can have them in a good position will continue here
This week or next top I will start working this issue
still on hold
Still on hold, will try to take this bug as soon as possible, writting some big features documentation
Still on hold
I'm going to be ooo until July 31st so going to unassign and assign a new teammate.
@tjferriss At this time, we're on hold. I'll take this back if it's still open when I return
Triggered auto assignment to @Christinadobrzyn (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Triggered auto assignment to @tjferriss (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)@gedu, @tjferriss, @chiragsalian, @Christinadobrzyn, @0xmiroslav Whoops! This issue is 2 days overdue. Let's get this updated quick!
Still on hold
@gedu, @tjferriss, @chiragsalian, @Christinadobrzyn, @0xmiroslav Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Still on hold, MelvinBot.
@gedu, @tjferriss, @chiragsalian, @Christinadobrzyn, @0xmiroslav Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
back from ooo - thanks for handling this @tjferriss - I can take it off your plate.
Still on hold for https://github.com/facebook/react-native/issues/37437 - going to move this to weekly while we wait
Sounds good, thanks
Hey, my Mac broke a couple of weeks ago, had most of the code there, I will have it back in 2 weeks, so I can keep working on this issue, sorry for the delay
Hi @gedu - do you have an update on this?
Next week I will have my Mac back and can start again with this one, sorry for the delay
Hi @gedu, any update or an ETA on this? No pressure, just asking for planning purposes.
I have my Mac back, I've been setting up so it is in good shape, so beginning of next week I can keep working on this. I had a solid solution I was mainly testing so I didn't break anything else @chiragsalian
Hi @gedu do you have an update on this for us?
Hey, I finished a couple of tickets, today I start again to look into this, I will check were I left everything and continue doing any changes, updates and let you know
I created a PR for this issue on react-native repository: https://github.com/facebook/react-native/pull/39385
Working on the PR, I got asked to add some integration tests, so working on it
Started with integration tests for the InputText
Ok could set the first test, and is working, will keep adding more, and will try to add as much as I can.
Testing RewriteExample
input: test space replace
output: test_space_replace
Tested Integration tests with and without my fix and Test just pass with my fix in place:
https://github.com/facebook/react-native/pull/39385#issuecomment-1747408586
Hi @gedu can you add an update here for us? Thanks!
Hi @gedu just checking on this - can you leave an update when possible?
Hey, sorry I had to jump among other tickets, I updated the code and seems there were a lot of changes, making my fix not work anymore, so I need to investigate again. Left a comment a couple of days ago https://github.com/facebook/react-native/pull/39385#issuecomment-1767657525. Will try to resume as soon as possible but the next weeks will be kind of complicated for me given that I have to work on another feature.
Hi @gedu do you have any update on this job? Thanks!
Hi @gedu please let us know of an update when you can!
asking in Slack for an update to this GH - https://expensify.slack.com/archives/C03UK30EA1Z/p1699661800466839
Hey, sorry, I didn't have the time to resume this bug, I will try to dedicate some time this week, had to focus on other features.
any update here @gedu?
Working on this, they changed a lot the native side, I'm debugging all over again
Still working on this
Was trying to find a fix with fabric=false, but I couldn't find a clear pattern, but since fabric is true by default, I'm trying to find a fix just for fabric enabled
I found the fix, not that different as the last time, but seems that it only works with fabric, I'm double checking and creating integration tests
Hey @gedu When will i get paid???
Hi @harshad2711 I can help with that question! Reporters are paid when the job is complete and it's been 7 days in production (details in our guidelines)That's the standard payment timeframe for all participants (reporters, contributors, C+) on a job. Let me know if you have any questions!
Integration tests are working on Android, but not on iOS, seems that webdriver or appium isn't getting the text from the Input, looking into it
Integration tests working for Android and iOS, pinged the reviewer so he can take a look
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
if "." shortcut is enabled, the shortcut should work when tapping the space 2 times
Actual Result:
if "." shorcut is enabled, the shortcut doesn't work when tapping the space 2 times
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.2.96-4 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
https://user-images.githubusercontent.com/43996225/230680037-97e38841-3890-4671-a905-6757633be3f0.mp4
https://user-images.githubusercontent.com/43996225/230680041-a8b718bc-2575-43d1-9d83-dc2662c3094a.mp4
https://user-images.githubusercontent.com/43996225/230680087-d94f2354-2a45-498a-9705-f9f691ea13e3.MP4
Expensify/Expensify Issue URL: Issue reported by: @harshad2711 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680851400066889
View all open jobs on GitHub
Upwork Automation - Do Not Edit