File tree Expand file tree Collapse file tree 4 files changed +32
-5
lines changed
ReactCommon/react/renderer/components/view/platform/macos/react/renderer/components/view
React/Fabric/Mounting/ComponentViews/View Expand file tree Collapse file tree 4 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,17 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
588
588
needsInvalidateLayer = YES ;
589
589
}
590
590
591
+ #if TARGET_OS_OSX // [macOS]
592
+ // `tooltip`
593
+ if (oldViewProps.tooltip != newViewProps.tooltip ) {
594
+ if (newViewProps.tooltip .has_value ()) {
595
+ self.toolTip = RCTNSStringFromStringNilIfEmpty (newViewProps.tooltip .value ());
596
+ } else {
597
+ self.toolTip = nil ;
598
+ }
599
+ }
600
+ #endif // macOS]
601
+
591
602
_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;
592
603
593
604
_props = std::static_pointer_cast<const ViewProps>(props);
Original file line number Diff line number Diff line change @@ -65,7 +65,16 @@ HostPlatformViewProps::HostPlatformViewProps(
65
65
rawProps,
66
66
" keyUpEvents" ,
67
67
sourceProps.keyUpEvents,
68
- {})) {}
68
+ {})),
69
+ tooltip(
70
+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter ()
71
+ ? sourceProps.tooltip
72
+ : convertRawProp(
73
+ context,
74
+ rawProps,
75
+ " tooltip" ,
76
+ sourceProps.tooltip,
77
+ {})) {}
69
78
70
79
#define VIEW_EVENT_CASE_MACOS (eventType ) \
71
80
case CONSTEXPR_RAW_PROPS_KEY_HASH (" on" #eventType): { \
@@ -102,6 +111,7 @@ void HostPlatformViewProps::setProp(
102
111
RAW_SET_PROP_SWITCH_CASE_BASIC (enableFocusRing);
103
112
RAW_SET_PROP_SWITCH_CASE_BASIC (keyDownEvents);
104
113
RAW_SET_PROP_SWITCH_CASE_BASIC (keyUpEvents);
114
+ RAW_SET_PROP_SWITCH_CASE_BASIC (tooltip);
105
115
}
106
116
}
107
117
Original file line number Diff line number Diff line change 16
16
17
17
#include < react/renderer/components/view/KeyEvent.h>
18
18
19
+ #include < optional>
20
+ #include < string>
21
+
19
22
#include " HostPlatformViewEvents.h"
20
23
21
24
namespace facebook ::react {
@@ -43,5 +46,7 @@ class HostPlatformViewProps : public BaseViewProps {
43
46
44
47
std::vector<HandledKey> keyDownEvents{};
45
48
std::vector<HandledKey> keyUpEvents{};
49
+
50
+ std::optional<std::string> tooltip{};
46
51
};
47
52
} // namespace facebook::react
Original file line number Diff line number Diff line change @@ -127,10 +127,6 @@ const Components: Array<RNTesterModuleInfo> = [
127
127
module : require ( '../examples/TextInput/TextInputExample.ios' ) ,
128
128
category : 'Basic' ,
129
129
} ,
130
- {
131
- key : 'TooltipExample' ,
132
- module : require ( '../examples/Tooltip/TooltipExample' ) ,
133
- } ,
134
130
{
135
131
key : 'TouchableExample' ,
136
132
module : require ( '../examples/Touchable/TouchableExample' ) ,
@@ -186,6 +182,11 @@ const APIs: Array<RNTesterModuleInfo> = ([
186
182
key : 'AccessibilityShowMenu' ,
187
183
module : require ( '../examples/AccessibilityShowMenu/AccessibilityShowMenu' ) ,
188
184
category : 'macOS' ,
185
+ } ,
186
+ {
187
+ key : 'TooltipExample' ,
188
+ module : require ( '../examples/Tooltip/TooltipExample' ) ,
189
+ category : 'macOS' ,
189
190
} , // macOS]
190
191
{
191
192
key : 'AccessibilityExample' ,
You can’t perform that action at this time.
0 commit comments