Skip to content

Commit 9fb5df2

Browse files
committed
fix: unmounting component
1 parent 80a7d81 commit 9fb5df2

7 files changed

Lines changed: 58 additions & 8 deletions

File tree

android/src/main/java/com/swmansion/enriched/EnrichedTextInputViewManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import com.facebook.react.uimanager.StateWrapper
1010
import com.facebook.react.uimanager.ThemedReactContext
1111
import com.facebook.react.uimanager.ViewDefaults
1212
import com.facebook.react.uimanager.ViewManagerDelegate
13-
import com.facebook.react.uimanager.ViewProps
1413
import com.facebook.react.uimanager.annotations.ReactProp
1514
import com.facebook.react.viewmanagers.EnrichedTextInputViewManagerDelegate
1615
import com.facebook.react.viewmanagers.EnrichedTextInputViewManagerInterface
@@ -132,7 +131,7 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
132131
view?.htmlStyle = HtmlStyle(view, style)
133132
}
134133

135-
@ReactProp(name = ViewProps.COLOR, customType = "Color")
134+
@ReactProp(name = "color", customType = "Color")
136135
override fun setColor(view: EnrichedTextInputView?, color: Int?) {
137136
view?.setColor(color)
138137
}
@@ -174,6 +173,7 @@ class EnrichedTextInputViewManager : SimpleViewManager<EnrichedTextInputView>(),
174173
view?.setPadding(left, top, right, bottom)
175174
}
176175

176+
@ReactProp(name = "isOnChangeHtmlSet", defaultBoolean = true)
177177
override fun setIsOnChangeHtmlSet(view: EnrichedTextInputView?, value: Boolean) {
178178
// this prop isn't used on Android as of now, but the setter must be present
179179
}

android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace facebook::react {
1010

1111
Size EnrichedTextInputMeasurementManager::measure(
1212
SurfaceId surfaceId,
13-
const EnrichedTextInputViewProps& props,
1413
LayoutConstraints layoutConstraints) const {
1514
const jni::global_ref<jobject>& fabricUIManager =
1615
contextContainer_->at<jni::global_ref<jobject>>("FabricUIManager");

android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputMeasurementManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <react/utils/ContextContainer.h>
66
#include <react/renderer/core/LayoutConstraints.h>
7-
#include <react/renderer/components/RNEnrichedTextInputViewSpec/Props.h>
87

98
namespace facebook::react {
109

@@ -16,7 +15,6 @@ namespace facebook::react {
1615

1716
Size measure(
1817
SurfaceId surfaceId,
19-
const EnrichedTextInputViewProps& props,
2018
LayoutConstraints layoutConstraints) const;
2119

2220
private:
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include "EnrichedTextInputProps.h"
2+
#include <react/renderer/core/PropsParserContext.h>
3+
#include <react/renderer/core/propsConversions.h>
4+
5+
namespace facebook::react {
6+
7+
EnrichedTextInputProps::EnrichedTextInputProps(
8+
const PropsParserContext &context,
9+
const EnrichedTextInputProps &sourceProps,
10+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) {}
11+
12+
#ifdef RN_SERIALIZABLE_STATE
13+
ComponentName EnrichedTextInputProps::getDiffPropsImplementationTarget() const {
14+
return "EnrichedTextInputView";
15+
}
16+
17+
folly::dynamic EnrichedTextInputProps::getDiffProps(
18+
const Props* prevProps) const {
19+
static const auto defaultProps = EnrichedTextInputProps();
20+
const EnrichedTextInputProps* oldProps = prevProps == nullptr
21+
? &defaultProps
22+
: static_cast<const EnrichedTextInputProps*>(prevProps);
23+
if (this == oldProps) {
24+
return folly::dynamic::object();
25+
}
26+
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
27+
return result;
28+
}
29+
#endif
30+
31+
} // namespace facebook::react
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
#include <react/renderer/components/view/ViewProps.h>
4+
#include <react/renderer/core/PropsParserContext.h>
5+
#include <react/renderer/graphics/Color.h>
6+
7+
namespace facebook::react {
8+
9+
class EnrichedTextInputProps final : public ViewProps {
10+
public:
11+
EnrichedTextInputProps() = default;
12+
EnrichedTextInputProps(const PropsParserContext& context, const EnrichedTextInputProps &sourceProps, const RawProps &rawProps);
13+
14+
#pragma mark - Props
15+
16+
#ifdef RN_SERIALIZABLE_STATE
17+
ComponentName getDiffPropsImplementationTarget() const override;
18+
folly::dynamic getDiffProps(const Props* prevProps) const override;
19+
#endif
20+
};
21+
22+
} // namespace facebook::react

android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern const char EnrichedTextInputComponentName[] = "EnrichedTextInputView";
2828
const LayoutContext &layoutContext,
2929
const LayoutConstraints &layoutConstraints) const {
3030

31-
return measurementsManager_->measure(getSurfaceId(), getConcreteProps(), layoutConstraints);
31+
return measurementsManager_->measure(getSurfaceId(), layoutConstraints);
3232
}
3333

3434
} // namespace facebook::react

android/src/main/new_arch/react/renderer/components/RNEnrichedTextInputViewSpec/EnrichedTextInputShadowNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#include "EnrichedTextInputMeasurementManager.h"
44
#include "EnrichedTextInputState.h"
5+
#include "EnrichedTextInputProps.h"
56

67
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
7-
#include <react/renderer/components/RNEnrichedTextInputViewSpec/Props.h>
88
#include <react/renderer/components/RNEnrichedTextInputViewSpec/EventEmitters.h>
99

1010
namespace facebook::react {
@@ -15,7 +15,7 @@ JSI_EXPORT extern const char EnrichedTextInputComponentName[];
1515
*/
1616
class EnrichedTextInputShadowNode final : public ConcreteViewShadowNode<
1717
EnrichedTextInputComponentName,
18-
EnrichedTextInputViewProps,
18+
EnrichedTextInputProps,
1919
EnrichedTextInputViewEventEmitter,
2020
EnrichedTextInputState> {
2121
public:

0 commit comments

Comments
 (0)