From 9ff43abe653ac5af0e591b369228f0809caad204 Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Mon, 11 Feb 2019 14:29:22 -0800 Subject: [PATCH] Prevent crash when scrollEnabled used in singleline textinput (#23361) Summary: Fixes #22949 , #21339. Currently, multiline textInput uses `UITextView` but singleline textInput uses `UITextField`, so singleline textinput may crash when use `scrollEnabled` property. [iOS] [Fixed] - Prevent crash when scrollEnabled used in singleline textinput Pull Request resolved: https://github.com/facebook/react-native/pull/23361 Differential Revision: D14030586 Pulled By: cpojer fbshipit-source-id: a8ae1b4e168469e65745c4d5e9329df8b6faa2aa --- Libraries/Text/TextInput/Singleline/RCTUITextField.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 411e2872b..6549f203c 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -87,6 +87,16 @@ self.enabled = editable; } +- (void)setScrollEnabled:(BOOL)enabled +{ + // Do noting, compatible with multiline textinput +} + +- (BOOL)scrollEnabled +{ + return NO; +} + #pragma mark - Context Menu - (BOOL)canPerformAction:(SEL)action withSender:(id)sender