Files
react-native/ReactCommon/fabric/mounting/ShadowViewMutation.cpp
empyrical cf2a289372 Fabric: Remove designated initializers in Events and Mounting (#23441)
Summary:
This pull request removes the designated initializers in `react/mounting/**` and `react/events/**` to improve portability.

A destructor was also defined for `ShadowView` to fix this error:

```
ShadowViewMutation.cpp:14: error: undefined reference to 'facebook::react::ShadowView::~ShadowView()'
ShadowViewMutation.cpp:24: error: undefined reference to 'facebook::react::ShadowView::~ShadowView()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

[General] [Changed] - Fabric: Remove designated initializers in Events and Mounting
Pull Request resolved: https://github.com/facebook/react-native/pull/23441

Differential Revision: D14298890

Pulled By: shergin

fbshipit-source-id: f5d8fc6e1f5968b94e8bb3ca0c3f0e81cf892f83
2019-03-03 22:32:37 -08:00

75 lines
1.9 KiB
C++

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ShadowViewMutation.h"
namespace facebook {
namespace react {
ShadowViewMutation ShadowViewMutation::CreateMutation(ShadowView shadowView) {
return {
/* .type = */ Create,
/* .parentShadowView = */ {},
/* .newChildShadowView = */ shadowView,
/* .oldChildShadowView = */ {},
/* .index = */ -1,
};
}
ShadowViewMutation ShadowViewMutation::DeleteMutation(ShadowView shadowView) {
return {
/* .type = */ Delete,
/* .parentShadowView = */ {},
/* .oldChildShadowView = */ shadowView,
/* .newChildShadowView = */ {},
/* .index = */ -1,
};
}
ShadowViewMutation ShadowViewMutation::InsertMutation(
ShadowView parentShadowView,
ShadowView childShadowView,
int index) {
return {
/* .type = */ Insert,
/* .parentShadowView = */ parentShadowView,
/* .oldChildShadowView = */ {},
/* .newChildShadowView = */ childShadowView,
/* .index = */ index,
};
}
ShadowViewMutation ShadowViewMutation::RemoveMutation(
ShadowView parentShadowView,
ShadowView childShadowView,
int index) {
return {
/* .type = */ Remove,
/* .parentShadowView = */ parentShadowView,
/* .oldChildShadowView = */ childShadowView,
/* .newChildShadowView = */ {},
/* .index = */ index,
};
}
ShadowViewMutation ShadowViewMutation::UpdateMutation(
ShadowView parentShadowView,
ShadowView oldChildShadowView,
ShadowView newChildShadowView,
int index) {
return {
/* .type = */ Update,
/* .parentShadowView = */ parentShadowView,
/* .oldChildShadowView = */ oldChildShadowView,
/* .newChildShadowView = */ newChildShadowView,
/* .index = */ index,
};
}
} // namespace react
} // namespace facebook