forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert ReactSwitchEvent to Kotlin (facebook#43881)
Summary: Pull Request resolved: facebook#43881 convert Java to Kotlin: `/react/views/switchview/ReactSwitchEvent.java` Changelog: [Internal] internal Differential Revision: D55770377
- Loading branch information
1 parent
fd3ef7b
commit f00e50a
Showing
2 changed files
with
38 additions
and
52 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
...tive/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.kt
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,38 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and 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.views.switchview | ||
|
||
import com.facebook.react.bridge.Arguments | ||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.uimanager.common.ViewUtil | ||
import com.facebook.react.uimanager.events.Event | ||
|
||
/** Event emitted by a ReactSwitchManager once a switch is fully switched on/off */ | ||
internal class ReactSwitchEvent(surfaceId: Int, viewId: Int, private val isChecked: Boolean) : | ||
Event<ReactSwitchEvent>(surfaceId, viewId) { | ||
|
||
@Deprecated( | ||
"Use the constructor with surfaceId, viewId and isChecked parameters.", | ||
replaceWith = ReplaceWith("ReactSwitchEvent(surfaceId, viewId, isChecked)")) | ||
constructor(viewId: Int, isChecked: Boolean) : this(ViewUtil.NO_SURFACE_ID, viewId, isChecked) | ||
|
||
public override fun getEventName(): String { | ||
return EVENT_NAME | ||
} | ||
|
||
public override fun getEventData(): WritableMap? { | ||
val eventData = Arguments.createMap() | ||
eventData.putInt("target", viewTag) | ||
eventData.putBoolean("value", isChecked) | ||
return eventData | ||
} | ||
|
||
private companion object { | ||
private const val EVENT_NAME = "topChange" | ||
} | ||
} |