mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
iOS: Fix autoCorrect doesn't revert to initial state
Summary: There's an inconsistency in autoCorrect's default state: - If you don't specify a value for autoCorrect, it defaults to on. - If you specify true/false for autoCorrect and later specify null, autoCorrect turns off. It should have reverted to its initial state of on. The reason for this discrepancy is that autoCorrect is exposed to JS as a boolean but it is actually an enum with three states in native: - UITextAutocorrectionTypeDefault (the default value) - UITextAutocorrectionTypeYes - UITextAutocorrectionTypeNo This is fixed by explicitly mapping JS null to UITextAutocorrectionTypeDefault. **Test plan (required)** Verified that switching `autoCorrect` between `true`, `false`, and `null` all work correctly in single line and multiline `TextInputs`. Adam Comella Microsoft Corp. Closes https://github.com/facebook/react-native/pull/11055 Differential Revision: D4226419 Pulled By: javache fbshipit-source-id: e3e5769a3aa537f00fb56ca4ae622ff4213481c5
This commit is contained in:
committed by
Facebook Github Bot
parent
b49e7afe47
commit
8016d838be
@@ -13,6 +13,7 @@
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTTextField.h"
|
||||
#import "RCTFont.h"
|
||||
#import "RCTConvert+Text.h"
|
||||
|
||||
@interface RCTTextFieldManager() <UITextFieldDelegate>
|
||||
|
||||
@@ -75,7 +76,7 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
|
||||
RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL)
|
||||
RCT_REMAP_VIEW_PROPERTY(autoCorrect, autocorrectionType, UITextAutocorrectionType)
|
||||
RCT_REMAP_VIEW_PROPERTY(editable, enabled, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
|
||||
RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, UIColor)
|
||||
|
||||
Reference in New Issue
Block a user