mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: New extendend signature of ViewManager::updateState()
Summary: Now, the signature of `updateState` method practically copies the signature of `updateLocalData`. We need that to support all features that `updateLocalData` does support now (to migrate from it). Reviewed By: mdvacca Differential Revision: D15962377 fbshipit-source-id: 61e0af6c191e0c6a358c5859613e9c512f91d29a
This commit is contained in:
committed by
Facebook Github Bot
parent
142af1751b
commit
71f0079809
@@ -210,7 +210,7 @@ public class MountingManager {
|
||||
componentName, propsDiffMap, stateWrapper, themedReactContext);
|
||||
view.setId(reactTag);
|
||||
if (stateWrapper != null) {
|
||||
viewManager.updateState(view, stateWrapper);
|
||||
viewManager.updateState(view, propsDiffMap, stateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,11 @@ public class MountingManager {
|
||||
if (viewManager == null) {
|
||||
throw new IllegalStateException("Unable to find ViewManager for tag: " + reactTag);
|
||||
}
|
||||
viewManager.updateState(viewState.mView, stateWrapper);
|
||||
Object extraData =
|
||||
viewManager.updateState(viewState.mView, viewState.mCurrentProps, stateWrapper);
|
||||
if (extraData != null) {
|
||||
viewManager.updateExtraData(viewState.mView, extraData);
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
@@ -252,7 +252,10 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
* Subclasses can implement this method to receive state updates shared between all instances of
|
||||
* this component type.
|
||||
*/
|
||||
public void updateState(@Nonnull T view, StateWrapper stateWrapper) {}
|
||||
public @Nullable Object updateState(
|
||||
@Nonnull T view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public long measure(
|
||||
Context context,
|
||||
|
||||
+4
-1
@@ -11,6 +11,7 @@ import android.graphics.Point;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.ReactStylesDiffMap;
|
||||
import com.facebook.react.uimanager.StateWrapper;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
@@ -101,8 +102,10 @@ public class ReactModalHostManager extends ViewGroupManager<ReactModalHostView>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(ReactModalHostView view, StateWrapper stateWrapper) {
|
||||
public Object updateState(
|
||||
ReactModalHostView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
|
||||
Point modalSize = ModalHostHelper.getModalHostSize(view.getContext());
|
||||
view.updateState(stateWrapper, modalSize.x, modalSize.y);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user