Add Fabric Interop constants example (#36693)

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

Similar to #36417, this changes adds an example to RNTester to verify that the Interop Layer can process constants in Fabric as it used to do in Paper for Android.

Changelog:
[Android] [Added] - Add Fabric Interop constants example

Reviewed By: cipolleschi

Differential Revision: D44466391

fbshipit-source-id: 74e654319b93e60b415297dcdddc98eb100913df
This commit is contained in:
Nicola Corti
2023-03-29 04:48:21 -07:00
committed by Riccardo Cipolleschi
parent 0026f73360
commit 341cda45ee
@@ -16,6 +16,8 @@ import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
import java.util.Collections;
import java.util.Map;
/** Legacy View manager (non Fabric compatible) for {@link MyNativeView} components. */
@ReactModule(name = MyLegacyViewManager.REACT_CLASS)
@@ -52,4 +54,9 @@ public class MyLegacyViewManager extends SimpleViewManager<MyNativeView> {
public void setColor(@NonNull MyNativeView view, @Nullable String color) {
view.setBackgroundColor(Color.parseColor(color));
}
@Override
public final Map<String, Object> getExportedViewConstants() {
return Collections.singletonMap("PI", 3.14);
}
}