Migrate setNativeProps to commands in iOS text input

Summary: Changelog: Move from setNativeProps to ViewCommands.

Reviewed By: JoshuaGross

Differential Revision: D20843018

fbshipit-source-id: 9be9d2bbee01f2e15279e3c3ae785c1a5b163765
This commit is contained in:
Samuel Susla
2020-04-09 03:44:56 -07:00
committed by Facebook GitHub Bot
parent 00c4d950cf
commit c7f259526b
5 changed files with 70 additions and 67 deletions
@@ -24,6 +24,7 @@ import type {TextStyleProp, ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
import requireNativeComponent from '../../ReactNative/requireNativeComponent';
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
import type {TextInputNativeCommands} from './TextInputNativeCommands';
import * as React from 'react';
import AndroidTextInputViewConfig from './AndroidTextInputViewConfig';
const ReactNativeViewConfigRegistry = require('../../Renderer/shims/ReactNativeViewConfigRegistry');
@@ -540,21 +541,7 @@ export type NativeProps = $ReadOnly<{|
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+focus: (viewRef: React.ElementRef<NativeType>) => void;
+blur: (viewRef: React.ElementRef<NativeType>) => void;
+setMostRecentEventCount: (
viewRef: React.ElementRef<NativeType>,
eventCount: Int32,
) => void;
+setTextAndSelection: (
viewRef: React.ElementRef<NativeType>,
mostRecentEventCount: Int32,
value: ?string, // in theory this is nullable
start: Int32,
end: Int32,
) => void;
}
type NativeCommands = TextInputNativeCommands<NativeType>;
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: [