Fix some nits/typos in MapBuffer

Summary:
Was trying out some behaviour when using the MapBuffer experiment and fixed some small issues.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34108859

fbshipit-source-id: 550ca0847419006ec17472cc4b70d38fc8d05396
This commit is contained in:
Pieter De Baets
2022-02-15 14:06:42 -08:00
committed by Facebook GitHub Bot
parent 9f6f97151c
commit 45af635b1e
7 changed files with 14 additions and 16 deletions
@@ -116,11 +116,11 @@ public class ReadableMapBuffer implements Iterable<ReadableMapBuffer.MapBufferEn
private int getTypedValueOffsetForKey(int key, DataType expected) {
int bucketIndex = getBucketIndexForKey(key);
DataType dataType = readDataType(bucketIndex);
if (bucketIndex == -1) {
throw new IllegalArgumentException("Key not found: " + key);
}
DataType dataType = readDataType(bucketIndex);
if (dataType != expected) {
throw new IllegalStateException(
"Expected "
@@ -46,7 +46,7 @@ public class StateWrapperImpl implements StateWrapper {
@Override
@Nullable
public ReadableMapBuffer getStatDataMapBuffer() {
public ReadableMapBuffer getStateDataMapBuffer() {
if (mDestroyed) {
FLog.e(TAG, "Race between StateWrapperImpl destruction and getState");
return null;
@@ -25,7 +25,7 @@ public interface StateWrapper {
* <p>Unstable API - DO NOT USE.
*/
@Nullable
ReadableMapBuffer getStatDataMapBuffer();
ReadableMapBuffer getStateDataMapBuffer();
/**
* Get a ReadableNativeMap object from the C++ layer, which is a K/V map of string keys to values.
@@ -97,7 +97,7 @@ public class ReactTextViewManager
}
if (ReactFeatureFlags.isMapBufferSerializationEnabled()) {
ReadableMapBuffer stateMapBuffer = stateWrapper.getStatDataMapBuffer();
ReadableMapBuffer stateMapBuffer = stateWrapper.getStateDataMapBuffer();
if (stateMapBuffer != null) {
return getReactTextUpdate(view, props, stateMapBuffer);
}
@@ -48,7 +48,7 @@ public class TextAttributeProps {
public static final short TA_KEY_TEXT_DECORATION_COLOR = 14;
public static final short TA_KEY_TEXT_DECORATION_LINE = 15;
public static final short TA_KEY_TEXT_DECORATION_STYLE = 16;
public static final short TA_KEY_TEXT_SHADOW_RAIDUS = 18;
public static final short TA_KEY_TEXT_SHADOW_RADIUS = 18;
public static final short TA_KEY_TEXT_SHADOW_COLOR = 19;
public static final short TA_KEY_IS_HIGHLIGHTED = 20;
public static final short TA_KEY_LAYOUT_DIRECTION = 21;
@@ -193,8 +193,8 @@ public class TextAttributeProps {
break;
case TA_KEY_TEXT_DECORATION_STYLE:
break;
case TA_KEY_TEXT_SHADOW_RAIDUS:
result.setTextShadowRadius(entry.getInt());
case TA_KEY_TEXT_SHADOW_RADIUS:
result.setTextShadowRadius((float) entry.getDouble());
break;
case TA_KEY_TEXT_SHADOW_COLOR:
result.setTextShadowColor(entry.getInt());
@@ -243,7 +243,7 @@ public class TextAttributeProps {
result.setTextDecorationLine(getStringProp(props, ViewProps.TEXT_DECORATION_LINE));
result.setTextShadowOffset(
props.hasKey(PROP_SHADOW_OFFSET) ? props.getMap(PROP_SHADOW_OFFSET) : null);
result.setTextShadowRadius(getIntProp(props, PROP_SHADOW_RADIUS, 1));
result.setTextShadowRadius(getFloatProp(props, PROP_SHADOW_RADIUS, 1));
result.setTextShadowColor(getIntProp(props, PROP_SHADOW_COLOR, DEFAULT_TEXT_SHADOW_COLOR));
result.setTextTransform(getStringProp(props, PROP_TEXT_TRANSFORM));
result.setLayoutDirection(getStringProp(props, ViewProps.LAYOUT_DIRECTION));