forked from microsoft/react-native-macos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RN][macos] Fix disable scrolling for multiline text input
Summary: # Context RN iOS supports disabling scrolling via `scrollEnabled` prop for multiline text inputs. https://reactnative.dev/docs/0.68/textinput#scrollenabled-ios This does [not work](microsoft#925) on MacOS Since MacOS does not use `UITextView` which inherits from `UIScrollView`, the view manager property was set but not actually passed down to the underlying scroll view. `RCTMultilineTextInputView` creates a `RCTUIScrollView` which is where we need to disable scrolling. https://www.internalfb.com/code/archon_react_native_macos/[fde4113acd89fb13ee11636c48b59eac49c21bae]/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m?lines=31 `RCTUIScrollView` inherits from `NSScrollView` which does not have a `scrollEnabled` property, but there is an api we can use to disable scrolling when the property is set. https://developer.apple.com/documentation/appkit/nsscrollview/1403494-scrollwheel # Usage NOTE: Only works with `multiline={true}` ``` <TextInput multiline={true} scrollEnabled={false} ... /> ``` # Change * Only expose the `scrollEnabled` property on `RCTMultilineTextInputView`. * `RCTSinglelineTextInputView` does not have scrolling so this property is unused. * `RCTMultilineTextInputView` delegates the `scrollEnabled` to it's underlying `_scrollView` * `RCTUIScrollView` defaults initial `scrollEnabled` to `YES` * `RCTUIScrollView` disables scrolling when the `scrollEnabled` is `NO` Test Plan: ## Zeratul ``` MDSTextInput {...textInputProps} {...(IS_MAC ? {multiline: true, blurOnSubmit: true, scrollEnabled: false} : {})} // workaround for T110399243 ``` |before|after| | https://pxl.cl/27gQp|https://pxl.cl/27gQr| ## RN Tester |before|after| |https://pxl.cl/27gRd|https://pxl.cl/27gRh| Reviewers: lyahdav, ericroz, ackchiu, #seller_expansion Reviewed By: lyahdav Differential Revision: https://phabricator.intern.facebook.com/D37659010 Tasks: T120776572 Tags: marketplace, marketplace_seller_expansion # Conflicts: # Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m # Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m # Libraries/Text/TextInput/RCTBaseTextInputViewManager.m # Conflicts: # Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m # React/Base/RCTUIKit.h # React/Base/macOS/RCTUIKit.m # Conflicts: # Libraries/Text/TextInput/RCTBaseTextInputViewManager.m # Conflicts: # Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h # Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m
- Loading branch information
Shawn Dempsey
committed
Nov 21, 2022
1 parent
99b53c5
commit 84fc10c
Showing
9 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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