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 &
588588 needsInvalidateLayer = YES ;
589589 }
590590
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+
591602 _needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;
592603
593604 _props = std::static_pointer_cast<const ViewProps>(props);
Original file line number Diff line number Diff line change @@ -65,7 +65,16 @@ HostPlatformViewProps::HostPlatformViewProps(
6565 rawProps,
6666 " keyUpEvents" ,
6767 sourceProps.keyUpEvents,
68- {})) {}
68+ {})),
69+ tooltip(
70+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter ()
71+ ? sourceProps.tooltip
72+ : convertRawProp(
73+ context,
74+ rawProps,
75+ " tooltip" ,
76+ sourceProps.tooltip,
77+ {})) {}
6978
7079#define VIEW_EVENT_CASE_MACOS (eventType ) \
7180 case CONSTEXPR_RAW_PROPS_KEY_HASH (" on" #eventType): { \
@@ -102,6 +111,7 @@ void HostPlatformViewProps::setProp(
102111 RAW_SET_PROP_SWITCH_CASE_BASIC (enableFocusRing);
103112 RAW_SET_PROP_SWITCH_CASE_BASIC (keyDownEvents);
104113 RAW_SET_PROP_SWITCH_CASE_BASIC (keyUpEvents);
114+ RAW_SET_PROP_SWITCH_CASE_BASIC (tooltip);
105115 }
106116}
107117
Original file line number Diff line number Diff line change 1616
1717#include < react/renderer/components/view/KeyEvent.h>
1818
19+ #include < optional>
20+ #include < string>
21+
1922#include " HostPlatformViewEvents.h"
2023
2124namespace facebook ::react {
@@ -43,5 +46,7 @@ class HostPlatformViewProps : public BaseViewProps {
4346
4447 std::vector<HandledKey> keyDownEvents{};
4548 std::vector<HandledKey> keyUpEvents{};
49+
50+ std::optional<std::string> tooltip{};
4651};
4752} // namespace facebook::react
Original file line number Diff line number Diff 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' ,
You can’t perform that action at this time.
0 commit comments