-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose RawEvent::Category to Java callsites
Summary: For iOS, event category deduction is done from the C++ code, but the touch events are handled on Java layer in Android. This change exposes the category parameter through the `EventEmitterWrapper` called from Java, allowing to define category for events in the future. Changelog: [Internal] - Expose event category through JNI Reviewed By: mdvacca Differential Revision: D31205587 fbshipit-source-id: f2373ce18464b01ac08eb87df8f421b33d100be2
- Loading branch information
1 parent
a0c3c85
commit bf4c6b3
Showing
7 changed files
with
70 additions
and
15 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventCategoryDef.java
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,42 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package com.facebook.react.fabric.events; | ||
|
||
import static com.facebook.react.fabric.events.EventCategoryDef.CONTINUOUS; | ||
import static com.facebook.react.fabric.events.EventCategoryDef.CONTINUOUS_END; | ||
import static com.facebook.react.fabric.events.EventCategoryDef.CONTINUOUS_START; | ||
import static com.facebook.react.fabric.events.EventCategoryDef.DISCRETE; | ||
import static com.facebook.react.fabric.events.EventCategoryDef.UNSPECIFIED; | ||
|
||
import androidx.annotation.IntDef; | ||
|
||
/** | ||
* Java specific declaration of the `RawEvent::Category` enum. Keep in sync with | ||
* `renderer/core/RawEvent.h`. | ||
*/ | ||
@IntDef(value = {CONTINUOUS_START, CONTINUOUS_END, UNSPECIFIED, DISCRETE, CONTINUOUS}) | ||
public @interface EventCategoryDef { | ||
/** Start of a continuous event. To be used with touchStart. */ | ||
int CONTINUOUS_START = 0; | ||
|
||
/** End of a continuous event. To be used with touchEnd. */ | ||
int CONTINUOUS_END = 1; | ||
|
||
/** | ||
* Priority for this event will be determined from other events in the queue. If it is triggered | ||
* by continuous event, its priority will be default. If it is not triggered by continuous event, | ||
* its priority will be discrete. | ||
*/ | ||
int UNSPECIFIED = 2; | ||
|
||
/** Forces discrete type for the event. Regardless if continuous event is ongoing. */ | ||
int DISCRETE = 3; | ||
|
||
/** Forces continuous type for the event. Regardless if continuous event isn't ongoing. */ | ||
int CONTINUOUS = 4; | ||
} |
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