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.
Migrate fabric.mounting.mountitems subset to Kotlin
Summary: # Changelog: [Internal] - As in the title, note that there are more files there to migrate, will come separately, to make reviewing easier. Differential Revision: D57046953
- Loading branch information
1 parent
47848ad
commit 62260bb
Showing
9 changed files
with
157 additions
and
171 deletions.
There are no files selected for viewing
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
16 changes: 0 additions & 16 deletions
16
...ctAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...eactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/BatchMountItem.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,13 @@ | ||
/* | ||
* 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.fabric.mounting.mountitems | ||
|
||
public interface BatchMountItem : MountItem { | ||
/** @return if the BatchMountItem contains any MountItem */ | ||
public fun isBatchEmpty(): Boolean | ||
} |
54 changes: 0 additions & 54 deletions
54
...c/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.java
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
...src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.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,46 @@ | ||
/* | ||
* 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.fabric.mounting.mountitems | ||
|
||
/** | ||
* Utility class for Fabric components, this will be removed | ||
* | ||
* TODO T97384889: remove this class when the component names are unified between JS - Android - | ||
* iOS - C++ | ||
*/ | ||
internal object FabricNameComponentMapping { | ||
private val componentNames: MutableMap<String, String> = HashMap() | ||
|
||
init { | ||
// TODO T97384889: unify component names between JS - Android - iOS - C++ | ||
componentNames["View"] = "RCTView" | ||
componentNames["Image"] = "RCTImageView" | ||
componentNames["ScrollView"] = "RCTScrollView" | ||
componentNames["Slider"] = "RCTSlider" | ||
componentNames["ModalHostView"] = "RCTModalHostView" | ||
componentNames["Paragraph"] = "RCTText" | ||
componentNames["Text"] = "RCText" | ||
componentNames["RawText"] = "RCTRawText" | ||
componentNames["ActivityIndicatorView"] = "AndroidProgressBar" | ||
componentNames["ShimmeringView"] = "RKShimmeringView" | ||
componentNames["TemplateView"] = "RCTTemplateView" | ||
componentNames["AxialGradientView"] = "RCTAxialGradientView" | ||
componentNames["Video"] = "RCTVideo" | ||
componentNames["Map"] = "RCTMap" | ||
componentNames["WebView"] = "RCTWebView" | ||
componentNames["Keyframes"] = "RCTKeyframes" | ||
componentNames["ImpressionTrackingView"] = "RCTImpressionTrackingView" | ||
} | ||
|
||
/** @return the name of component in the Fabric environment */ | ||
@JvmStatic | ||
fun getFabricComponentName(componentName: String): String { | ||
val component = componentNames[componentName] | ||
return component ?: componentName | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
...e/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...ive/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.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,21 @@ | ||
/* | ||
* 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.fabric.mounting.mountitems | ||
|
||
import androidx.annotation.AnyThread | ||
import androidx.annotation.UiThread | ||
import com.facebook.proguard.annotations.DoNotStripAny | ||
import com.facebook.react.fabric.mounting.MountingManager | ||
|
||
@DoNotStripAny | ||
public interface MountItem { | ||
/** Execute this [MountItem] into the operation queue received by parameter. */ | ||
@UiThread public fun execute(mountingManager: MountingManager) | ||
|
||
@AnyThread public fun getSurfaceId(): Int | ||
} |
69 changes: 0 additions & 69 deletions
69
...Android/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItemFactory.java
This file was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
...ctAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItemFactory.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,70 @@ | ||
/* | ||
* 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.fabric.mounting.mountitems | ||
|
||
import com.facebook.react.bridge.ReadableArray | ||
import com.facebook.react.bridge.ReadableMap | ||
import com.facebook.react.fabric.events.EventEmitterWrapper | ||
import com.facebook.react.uimanager.StateWrapper | ||
|
||
/** Factory class that expose creation of [MountItem] */ | ||
public object MountItemFactory { | ||
/** @return a [DispatchCommandMountItem] for commands identified by an int */ | ||
@JvmStatic | ||
public fun createDispatchCommandMountItem( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
commandId: Int, | ||
commandArgs: ReadableArray? | ||
): DispatchCommandMountItem = | ||
DispatchIntCommandMountItem(surfaceId, reactTag, commandId, commandArgs) | ||
|
||
/** @return a [DispatchCommandMountItem] for commands identified by a String */ | ||
@JvmStatic | ||
public fun createDispatchCommandMountItem( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
commandId: String, | ||
commandArgs: ReadableArray? | ||
): DispatchCommandMountItem = | ||
DispatchStringCommandMountItem(surfaceId, reactTag, commandId, commandArgs) | ||
|
||
/** @return a [MountItem] that will control the execution of an AccessibilityEvent */ | ||
@JvmStatic | ||
public fun createSendAccessibilityEventMountItem( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
eventType: Int | ||
): MountItem = SendAccessibilityEventMountItem(surfaceId, reactTag, eventType) | ||
|
||
/** @return a [MountItem] that will be used to preallocate views */ | ||
@JvmStatic | ||
public fun createPreAllocateViewMountItem( | ||
surfaceId: Int, | ||
reactTag: Int, | ||
component: String, | ||
props: ReadableMap?, | ||
stateWrapper: StateWrapper?, | ||
eventEmitterWrapper: EventEmitterWrapper?, | ||
isLayoutable: Boolean | ||
): MountItem = | ||
PreAllocateViewMountItem( | ||
surfaceId, reactTag, component, props, stateWrapper, eventEmitterWrapper, isLayoutable) | ||
|
||
/** | ||
* @return a [MountItem] that will be read and execute a collection of MountItems serialized in | ||
* the int[] and Object[] received by parameter | ||
*/ | ||
@JvmStatic | ||
public fun createIntBufferBatchMountItem( | ||
surfaceId: Int, | ||
intBuf: IntArray?, | ||
objBuf: Array<Any?>?, | ||
commitNumber: Int | ||
): MountItem = IntBufferBatchMountItem(surfaceId, intBuf, objBuf, commitNumber) | ||
} |