mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Backout D34630294
Summary: Backout D34630294 (https://github.com/facebook/react-native/commit/87cdb607e4792156d433c44b89932e7dae3371da) to fix T113767991 Changelog: [Internal][Change] - Backing out "Support animating text color with native driver" Differential Revision: D34772459 fbshipit-source-id: 7a536e4c5a9f692ddc410cb8cb352ffe71e7c93f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
84f8c9ad55
commit
04acb1cbc8
@@ -8,12 +8,10 @@
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -87,16 +85,11 @@ public class ReactStylesDiffMap {
|
||||
return mBackingMap.getMap(key);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Nullable
|
||||
public Dynamic getDynamic(String key) {
|
||||
return mBackingMap.getDynamic(key);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public ReadableType getType(String key) {
|
||||
return mBackingMap.getType(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{ " + getClass().getSimpleName() + ": " + mBackingMap.toString() + " }";
|
||||
|
||||
-19
@@ -48,25 +48,6 @@ public abstract class ReactTextAnchorViewManager<T extends View, C extends React
|
||||
view.setFocusable(accessible);
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.COLOR, customType = "Color")
|
||||
public void setColor(ReactTextView view, int color) {
|
||||
/**
|
||||
* This is needed for natively driven animations for text color. Typically, {@link
|
||||
* ReactTextView#setText} is called via {@link ReactTextViewManager#updateExtraData}, but
|
||||
* natively animated color changes bypass render and layout pass via direct call to {@link
|
||||
* SurfaceMountingManager#updateProps} from {@link UIManager#synchronouslyUpdateViewOnUIThread}.
|
||||
*/
|
||||
Spannable spannable = view.getSpanned();
|
||||
if (spannable != null) {
|
||||
spannable.setSpan(
|
||||
new ReactForegroundColorSpan(color),
|
||||
0,
|
||||
spannable.length(),
|
||||
Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
view.setText(spannable);
|
||||
}
|
||||
}
|
||||
|
||||
// maxLines can only be set in master view (block), doesn't really make sense to set in a span
|
||||
@ReactProp(name = ViewProps.NUMBER_OF_LINES, defaultInt = ViewDefaults.NUMBER_OF_LINES)
|
||||
public void setNumberOfLines(ReactTextView view, int numberOfLines) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import android.text.Spannable;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableNativeMap;
|
||||
import com.facebook.react.bridge.ReadableType;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
|
||||
@@ -22,7 +21,6 @@ import com.facebook.react.uimanager.IViewManagerWithChildren;
|
||||
import com.facebook.react.uimanager.ReactStylesDiffMap;
|
||||
import com.facebook.react.uimanager.StateWrapper;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.ViewProps;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -115,20 +113,6 @@ public class ReactTextViewManager
|
||||
Spannable spanned =
|
||||
TextLayoutManager.getOrCreateSpannableForText(
|
||||
view.getContext(), attributedString, mReactTextViewManagerCallback);
|
||||
|
||||
/**
|
||||
* For natively driven animations for text color, on mount, {@link
|
||||
* UIManager#synchronouslyUpdateViewOnUIThread} may be called before updateState, in which case
|
||||
* the ReactStylesDiffMap will contain the color.
|
||||
*/
|
||||
if (props.hasKey(ViewProps.COLOR) && props.getType(ViewProps.COLOR) == ReadableType.Number) {
|
||||
spanned.setSpan(
|
||||
new ReactForegroundColorSpan(props.getInt(ViewProps.COLOR, 0)),
|
||||
0,
|
||||
spanned.length(),
|
||||
Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
}
|
||||
|
||||
view.setSpanned(spanned);
|
||||
|
||||
int textBreakStrategy =
|
||||
|
||||
Reference in New Issue
Block a user