Skip to content

Commit 71e0222

Browse files
authored
Merge branch 'main' into drag-drop
2 parents 23c38b1 + 9006981 commit 71e0222

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,15 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
614614
[self registerForDraggedTypes:pasteboardTypes];
615615
}
616616
}
617-
#endif // macOS]
617+
618+
// `tooltip`
619+
if (oldViewProps.tooltip != newViewProps.tooltip) {
620+
if (newViewProps.tooltip.has_value()) {
621+
self.toolTip = RCTNSStringFromStringNilIfEmpty(newViewProps.tooltip.value());
622+
} else {
623+
self.toolTip = nil;
624+
}
625+
}
618626

619627
_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;
620628

packages/react-native/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@ HostPlatformViewProps::HostPlatformViewProps(
7474
rawProps,
7575
"draggedTypes",
7676
sourceProps.draggedTypes,
77-
{})) {};
77+
{})),
78+
tooltip(
79+
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
80+
? sourceProps.tooltip
81+
: convertRawProp(
82+
context,
83+
rawProps,
84+
"tooltip",
85+
sourceProps.tooltip,
86+
{})) {}
7887

7988
#define VIEW_EVENT_CASE_MACOS(eventType) \
8089
case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
@@ -112,6 +121,7 @@ void HostPlatformViewProps::setProp(
112121
RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
113122
RAW_SET_PROP_SWITCH_CASE_BASIC(keyUpEvents);
114123
RAW_SET_PROP_SWITCH_CASE_BASIC(draggedTypes);
124+
RAW_SET_PROP_SWITCH_CASE_BASIC(tooltip);
115125
}
116126
}
117127

packages/react-native/ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view/HostPlatformViewProps.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
#include <react/renderer/components/view/KeyEvent.h>
1818

19+
#include <optional>
20+
#include <string>
21+
1922
#include "HostPlatformViewEvents.h"
2023

2124
namespace facebook::react {
@@ -45,5 +48,7 @@ class HostPlatformViewProps : public BaseViewProps {
4548
std::vector<HandledKey> keyUpEvents{};
4649

4750
std::vector<std::string> draggedTypes{};
51+
52+
std::optional<std::string> tooltip{};
4853
};
4954
} // namespace facebook::react

packages/rn-tester/js/utils/RNTesterList.ios.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ const Components: Array<RNTesterModuleInfo> = [
127127
module: require('../examples/TextInput/TextInputExample.ios'),
128128
category: 'Basic',
129129
},
130-
{
131-
key: 'TooltipExample',
132-
module: require('../examples/Tooltip/TooltipExample'),
133-
},
134130
{
135131
key: 'TouchableExample',
136132
module: require('../examples/Touchable/TouchableExample'),
@@ -186,6 +182,11 @@ const APIs: Array<RNTesterModuleInfo> = ([
186182
key: 'AccessibilityShowMenu',
187183
module: require('../examples/AccessibilityShowMenu/AccessibilityShowMenu'),
188184
category: 'macOS',
185+
},
186+
{
187+
key: 'TooltipExample',
188+
module: require('../examples/Tooltip/TooltipExample'),
189+
category: 'macOS',
189190
}, // macOS]
190191
{
191192
key: 'AccessibilityExample',

0 commit comments

Comments
 (0)