mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d54113d8c4
Summary: `showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243. On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not) ## Changelog [iOS] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: https://github.com/facebook/react-native/pull/28834 Test Plan: You'd use this just like you would in the Android implementation: ```jsx <TextInput showSoftInputOnFocus={false} /> ``` ## GIFs ### Before change  ### After change  Differential Revision: D21418763 Pulled By: shergin fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
65 lines
2.3 KiB
Objective-C
65 lines
2.3 KiB
Objective-C
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <React/RCTView.h>
|
|
|
|
#import "RCTBackedTextInputDelegate.h"
|
|
#import "RCTBackedTextInputViewProtocol.h"
|
|
|
|
@class RCTBridge;
|
|
@class RCTEventDispatcher;
|
|
@class RCTTextAttributes;
|
|
@class RCTTextSelection;
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface RCTBaseTextInputView : RCTView <RCTBackedTextInputDelegate>
|
|
|
|
- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
- (instancetype)initWithCoder:(NSCoder *)decoder NS_UNAVAILABLE;
|
|
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
|
|
|
|
@property (nonatomic, readonly) UIView<RCTBackedTextInputViewProtocol> *backedTextInputView;
|
|
|
|
@property (nonatomic, strong, nullable) RCTTextAttributes *textAttributes;
|
|
@property (nonatomic, assign) UIEdgeInsets reactPaddingInsets;
|
|
@property (nonatomic, assign) UIEdgeInsets reactBorderInsets;
|
|
|
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange;
|
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange;
|
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onChange;
|
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput;
|
|
@property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll;
|
|
|
|
@property (nonatomic, assign) NSInteger mostRecentEventCount;
|
|
@property (nonatomic, assign, readonly) NSInteger nativeEventCount;
|
|
@property (nonatomic, assign) BOOL autoFocus;
|
|
@property (nonatomic, assign) BOOL blurOnSubmit;
|
|
@property (nonatomic, assign) BOOL selectTextOnFocus;
|
|
@property (nonatomic, assign) BOOL clearTextOnFocus;
|
|
@property (nonatomic, assign) BOOL secureTextEntry;
|
|
@property (nonatomic, copy) RCTTextSelection *selection;
|
|
@property (nonatomic, strong, nullable) NSNumber *maxLength;
|
|
@property (nonatomic, copy, nullable) NSAttributedString *attributedText;
|
|
@property (nonatomic, copy) NSString *inputAccessoryViewID;
|
|
@property (nonatomic, assign) UIKeyboardType keyboardType;
|
|
@property (nonatomic, assign) BOOL showSoftInputOnFocus;
|
|
|
|
/**
|
|
Sets selection intext input if both start and end are within range of the text input.
|
|
**/
|
|
- (void)setSelectionStart:(NSInteger)start
|
|
selectionEnd:(NSInteger)end;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|