From 45ed14259677cff4cbd133e705ec4f0ec84bc216 Mon Sep 17 00:00:00 2001 From: Adriano Melo Date: Tue, 7 Nov 2017 10:49:26 -0800 Subject: [PATCH] Docs: Improve BackHandler documentation (addEventListener and removeEventListener) Summary: This commit adds documentation to two methods of BackHandler API, addEventListener and removeEventListener. Despite being a simple change, it helps to keep the documentation consistent. I have tested the `./website` locally, the changes look similar to some other components such as `NetInfo`. [DOCS][ENHANCEMENT][BackHandler] - Improve BackHandler documentation (addEventListener and removeEventListener) Closes https://github.com/facebook/react-native/pull/16618 Differential Revision: D6260935 Pulled By: hramos fbshipit-source-id: ab04a9fca89ddaa1925844b5754caf1c355a9329 --- Libraries/Utilities/BackHandler.android.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index 21e320c5e..e9ccd1a58 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -74,6 +74,12 @@ var BackHandler = { DeviceEventManager.invokeDefaultBackPressHandler(); }, + /** + * Adds an event handler. Supported events: + * + * - `hardwareBackPress`: Fires when the Android hardware back button is pressed or when the + * tvOS menu button is pressed. + */ addEventListener: function ( eventName: BackPressEventName, handler: Function @@ -84,6 +90,9 @@ var BackHandler = { }; }, + /** + * Removes the event handler. + */ removeEventListener: function( eventName: BackPressEventName, handler: Function