- 
                Notifications
    
You must be signed in to change notification settings  - Fork 24.9k
 
[WIP] Convert TextInput to class component #26339
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
Conversation
| 
           Is it possible somehow to restrict the props spread into   | 
    
| 
           I think that just applying the needed props is probably the best way to go too! iOS (both the legacy and non-legacy rendering functions) will end up needing this treatment as well.  | 
    
| 
           Just to clarify, @empyrical, are you saying that you will update the PR? Just checking in.  | 
    
| 
           Yep! I just haven't had the time yet. Sorry, should have been clearer  | 
    
| 
           There's some small Flow conflicts currently with the event types in  react-native/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js Lines 324 to 330 in 543420c 
 While being readonly in  react-native/Libraries/Components/TextInput/TextInput.js Lines 77 to 85 in 543420c 
 I notice that the native component has lines with  What should be the best way to handle this? Temporarily make   | 
    
| 
           Any update on this @empyrical? I'd love to get this in. We are starting to need that forwarded ref and I currently need to work around this not having forwardRef by having a   | 
    
| 
           Hey! I think i might have time tomorrow to work on this again. A lot of time is being spent cleaning up flow errors, but functionality-wise in RNTester everything works great!  | 
    
| 
           Is there any chance we could add at least Jest tests for this component to verify the behavior of the JS is the same as before?  | 
    
| 
           I talked with @cpojer in person. I definitely would love to see tests for TextInput but I don't want to block this change on those tests being written. I think tests for TextInput is a larger problem we need to tackle but this refactor to TextInput is needed for our Fabric work. @JoshuaGross and I will take responsibility for landing and following this through.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| 
           Closing. Ended up in a commit but wasn't autoclosed 👍  | 
    
Summary
This is attempt 2 at porting TextInput to an ES6 class. Last attempt needed to be reverted because of an internal error at FB - one that I unfortunately was not able to recreate locally in Debug or Release builds. I am hoping that things may have changed enough on FB's end that this is no longer an issue - but should keep an eye out for this when merging.
This is a WIP for two Flow-related reasons that I need input on.
The first is a confusing Flow error I encounter with the forwardRef - I am probably missing something, but I am not sure why it's not able to find the value for the template parameter
Configeven when I explicitly provide it topropsSecondly, now that props being passed down are properly seen by Flow, the usage of
AndroidTextInputNativeComponentintroduced in this commit have a great deal of Flow errors, because TextInput'spropsis...spreadonto it, and there are a great deal of props in TextInput not present inAndroidTextInputNativeComponent.Should a
$FlowFixMebe applied here for the time being? Not quite sure what should be done to reconcile this.Changelog
[General] [Changed] - Converted TextInput to ES6 class-based component
Test Plan
I have tried this version of
<TextInput />out in RNTester (Debug and Release builds) and no regressions have been noted.