-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #11055 Differential Revision: D4226419 Pulled By: javache fbshipit-source-id: e3e5769a3aa537f00fb56ca4ae622ff4213481c5
- Loading branch information
Adam Comella
authored and
Facebook Github Bot
committed
Nov 23, 2016
1 parent
b49e7af
commit 8016d83
Showing
9 changed files
with
55 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "RCTConvert.h" | ||
|
||
@interface RCTConvert (Text) | ||
|
||
+ (UITextAutocorrectionType)UITextAutocorrectionType:(id)json; | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "RCTConvert+Text.h" | ||
|
||
@implementation RCTConvert (Text) | ||
|
||
+ (UITextAutocorrectionType)UITextAutocorrectionType:(id)json | ||
{ | ||
return | ||
json == nil ? UITextAutocorrectionTypeDefault : | ||
[RCTConvert BOOL:json] ? UITextAutocorrectionTypeYes : | ||
UITextAutocorrectionTypeNo; | ||
} | ||
|
||
@end |
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