Migrate StateWrapper to Kotlin (#49544)

Summary:
Migrate com.facebook.react.uimanager.StateWrapper to Kotlin

## Changelog:

[INTERNAL] - Migrate com.facebook.react.uimanager.StateWrapper to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/49544

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: cortinico, NickGerleman

Differential Revision: D69890013

Pulled By: Abbondanzo

fbshipit-source-id: 859ae727167638a0ef7fa6158d27f5429921a9f9
This commit is contained in:
Mateo Guzmán
2025-02-20 07:03:29 -08:00
committed by Facebook GitHub Bot
parent 0b67218a8a
commit 38190f530f
@@ -5,12 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.uimanager;
package com.facebook.react.uimanager
import com.facebook.react.bridge.ReadableNativeMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
import javax.annotation.Nullable;
import com.facebook.react.bridge.ReadableNativeMap
import com.facebook.react.bridge.WritableMap
import com.facebook.react.common.mapbuffer.ReadableMapBuffer
/**
* This is a wrapper that can be used for passing State objects from Fabric C++ core to
@@ -18,26 +17,23 @@ import javax.annotation.Nullable;
* by calling updateState, which communicates state back to the C++ layer.
*/
public interface StateWrapper {
/**
* Get a ReadableMapBuffer object from the C++ layer, which is a K/V map of short keys to values.
*
* <p>Unstable API - DO NOT USE.
* Unstable API - DO NOT USE.
*/
@Nullable
ReadableMapBuffer getStateDataMapBuffer();
public val stateDataMapBuffer: ReadableMapBuffer?
/**
* Get a ReadableNativeMap object from the C++ layer, which is a K/V map of string keys to values.
*/
@Nullable
ReadableNativeMap getStateData();
public val stateData: ReadableNativeMap?
/**
* Pass a map of values back to the C++ layer. The operation is performed synchronously and cannot
* fail.
*/
void updateState(WritableMap map);
public fun updateState(map: WritableMap)
/**
* Mark state as unused and clean up in Java and in native. This should be called as early as
@@ -45,5 +41,5 @@ public interface StateWrapper {
* used legitimately, don't destroy it! It is expected that all StateWrappers are destroyed
* immediately upon stopSurface.
*/
void destroyState();
public fun destroyState()
}