From b7b0e232028723794af4c79fc6366c483ae2350b Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Tue, 8 Sep 2020 15:54:59 -0700 Subject: [PATCH] TextInput: Add `onPressIn` and `onPressOut` Summary: Introduces support for `onPressIn` and `onPressOut` on the `TextInput` component. This makes it possible to add visual feedback when users touch interact with `TextInput` components. Changelog: [General][Added] - TextInput now supports `onPressIn` and `onPressOut`. Reviewed By: TheSavior Differential Revision: D23514333 fbshipit-source-id: 1790e977b78f1c293d5476aef8613547f27d6731 --- Libraries/Components/TextInput/TextInput.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index 8bf08fdd17a6d8..a46efe02c63e99 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -571,6 +571,16 @@ export type Props = $ReadOnly<{| */ onEndEditing?: ?(e: EditingEvent) => mixed, + /** + * Called when a touch is engaged. + */ + onPressIn?: ?(event: PressEvent) => mixed, + + /** + * Called when a touch is released. + */ + onPressOut?: ?(event: PressEvent) => mixed, + /** * Callback that is called when the text input selection is changed. * This will be called with @@ -1135,6 +1145,8 @@ function InternalTextInput(props: Props): React.Node {