forked from facebook/react-native
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 149
fix(fabric, text input): use window to focus and blur TextInput #2284
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
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    1b0cfcf    to
    081ac2a      
    Compare
  
    NSTextView
      NSTextViewSummary: Fix AppKit exception throws when focusing text inputs by calling becomeFirstResponder directly on the backing text input view. Making a view first responder has to happen through the window using makeFirstResponder. Test Plan: - Run Zeratul with Fabric - Focus the search text input above the message threads - Click inside the active message thread to trigger the auto-focus of the composer - The composer gets focus without AppKit throwing an exception. https://pxl.cl/3dVMx Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D48696690
081ac2a    to
    ba8744a      
    Compare
  
    
              
                    FalseLobster
  
              
              approved these changes
              
                  
                    Nov 20, 2024 
                  
              
              
            
            
              
                    tido64
  
              
              approved these changes
              
                  
                    Nov 20, 2024 
                  
              
              
            
            
        
          
                ...ges/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...ges/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
              
                Outdated
          
            Show resolved
            Hide resolved
        
      …stance Summary: Fix AppKit exception throws when blurring text inputs by calling `resignFirstResponder` directly on the backing text input view. Resigning the first responder state has to happen through the window by calling `[window makeFirstResponder:nil]` which will: - call `resignFirstResponder` on the current first responder - if successful, the window will become the first responder Test Plan: - Run Zeratul with Fabric - Focus the search text input above the message threads - Click inside the active message thread to trigger the auto-focus of the composer and the blur on the search field - The focused field resigns the first responder status without throwing an exception https://pxl.cl/3GvZD Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D50700782
ba8744a    to
    2b7bbcf      
    Compare
  
    
              
                    lenaic
  
              
              reviewed
              
                  
                    Nov 20, 2024 
                  
              
              
            
            
        
          
                ...ges/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
              
                Outdated
          
            Show resolved
            Hide resolved
        
      2b7bbcf    to
    78467d2      
    Compare
  
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary:
Cherry pick a couple of changes to have TextInput call focus and blur (natively,
makeFirstResponderandresignFirstResponder) through its window instance variable rather than through its' self.Test Plan:
RNTester runs fine while focusing and blurring some text inputs.