Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,17 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
needsInvalidateLayer = YES;
}

#if TARGET_OS_OSX // [macOS]
// `tooltip`
if (oldViewProps.tooltip != newViewProps.tooltip) {
if (newViewProps.tooltip.has_value()) {
self.toolTip = RCTNSStringFromStringNilIfEmpty(newViewProps.tooltip.value());
} else {
self.toolTip = nil;
}
}
#endif // macOS]

_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;

_props = std::static_pointer_cast<const ViewProps>(props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ HostPlatformViewProps::HostPlatformViewProps(
rawProps,
"keyUpEvents",
sourceProps.keyUpEvents,
{})) {}
{})),
tooltip(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.tooltip
: convertRawProp(
context,
rawProps,
"tooltip",
sourceProps.tooltip,
{})) {}

#define VIEW_EVENT_CASE_MACOS(eventType) \
case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
Expand Down Expand Up @@ -102,6 +111,7 @@ void HostPlatformViewProps::setProp(
RAW_SET_PROP_SWITCH_CASE_BASIC(enableFocusRing);
RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
RAW_SET_PROP_SWITCH_CASE_BASIC(keyUpEvents);
RAW_SET_PROP_SWITCH_CASE_BASIC(tooltip);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

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

#include <optional>
#include <string>

#include "HostPlatformViewEvents.h"

namespace facebook::react {
Expand Down Expand Up @@ -43,5 +46,7 @@ class HostPlatformViewProps : public BaseViewProps {

std::vector<HandledKey> keyDownEvents{};
std::vector<HandledKey> keyUpEvents{};

std::optional<std::string> tooltip{};
};
} // namespace facebook::react
9 changes: 5 additions & 4 deletions packages/rn-tester/js/utils/RNTesterList.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ const Components: Array<RNTesterModuleInfo> = [
module: require('../examples/TextInput/TextInputExample.ios'),
category: 'Basic',
},
{
key: 'TooltipExample',
module: require('../examples/Tooltip/TooltipExample'),
},
{
key: 'TouchableExample',
module: require('../examples/Touchable/TouchableExample'),
Expand Down Expand Up @@ -186,6 +182,11 @@ const APIs: Array<RNTesterModuleInfo> = ([
key: 'AccessibilityShowMenu',
module: require('../examples/AccessibilityShowMenu/AccessibilityShowMenu'),
category: 'macOS',
},
{
key: 'TooltipExample',
module: require('../examples/Tooltip/TooltipExample'),
category: 'macOS',
}, // macOS]
{
key: 'AccessibilityExample',
Expand Down
Loading