Fix nullability of StateWrapper

Summary:
ViewManager does a null-check already, and so inside the `updateState` method, we can safely assume this parameter is no longer nullable.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D36545806

fbshipit-source-id: 92eefa518f11c17b91aa3da2e14066d36fa4f4c2
This commit is contained in:
Pieter De Baets
2022-05-23 03:59:47 -07:00
committed by Facebook GitHub Bot
parent c69c14374d
commit f2fa2860d1
6 changed files with 6 additions and 17 deletions
@@ -285,7 +285,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
* this component type.
*/
public @Nullable Object updateState(
@NonNull T view, ReactStylesDiffMap props, @Nullable StateWrapper stateWrapper) {
@NonNull T view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
return null;
}
@@ -166,7 +166,7 @@ public class ReactModalHostManager extends ViewGroupManager<ReactModalHostView>
@Override
public Object updateState(
ReactModalHostView view, ReactStylesDiffMap props, @Nullable StateWrapper stateWrapper) {
ReactModalHostView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
view.getFabricViewStateManager().setStateWrapper(stateWrapper);
Point modalSize = ModalHostHelper.getModalHostSize(view.getContext());
view.updateState(modalSize.x, modalSize.y);
@@ -66,9 +66,7 @@ public class ReactHorizontalScrollViewManager extends ViewGroupManager<ReactHori
@Override
public Object updateState(
ReactHorizontalScrollView view,
ReactStylesDiffMap props,
@Nullable StateWrapper stateWrapper) {
ReactHorizontalScrollView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
view.getFabricViewStateManager().setStateWrapper(stateWrapper);
return null;
}
@@ -328,7 +328,7 @@ public class ReactScrollViewManager extends ViewGroupManager<ReactScrollView>
@Override
public Object updateState(
ReactScrollView view, ReactStylesDiffMap props, @Nullable StateWrapper stateWrapper) {
ReactScrollView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
view.getFabricViewStateManager().setStateWrapper(stateWrapper);
return null;
}
@@ -106,11 +106,7 @@ public class ReactTextViewManager
@Override
public Object updateState(
ReactTextView view, ReactStylesDiffMap props, @Nullable StateWrapper stateWrapper) {
if (stateWrapper == null) {
return null;
}
ReactTextView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
if (ReactFeatureFlags.isMapBufferSerializationEnabled()) {
MapBuffer stateMapBuffer = stateWrapper.getStateDataMapBuffer();
if (stateMapBuffer != null) {
@@ -1282,18 +1282,13 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
@Override
public Object updateState(
ReactEditText view, ReactStylesDiffMap props, @Nullable StateWrapper stateWrapper) {
ReactEditText view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
if (ReactEditText.DEBUG_MODE) {
FLog.e(TAG, "updateState: [" + view.getId() + "]");
}
view.getFabricViewStateManager().setStateWrapper(stateWrapper);
if (stateWrapper == null) {
return null;
}
ReadableNativeMap state = stateWrapper.getStateData();
if (state == null) {