Skip to content

Commit 3c149e4

Browse files
authored
Fix nightly builds (#2872)
# Summary Fixes build issue with latest react-native nightlies by passing `std::shared_ptr<RCTImageResponseObserverProxy>` to the `observerCoordinator::removeObserver` and `observerCoordinator::addObserver`. Interfaces of these methods were changed in this [commit](facebook/react-native@3b46755). The fix is backward compatible with older versions of react native. ## Test Plan Tested on latest react native nightly `0.85.0-nightly-20260218-51dc568d2`.
1 parent 8cdf01b commit 3c149e4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apple/Elements/RNSVGImage.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,22 @@ - (void)_setStateAndResubscribeImageResponseObserver:(RNSVGImageShadowNode::Conc
122122
{
123123
if (_state) {
124124
auto &observerCoordinator = _state->getData().getImageRequest().getObserverCoordinator();
125+
#if REACT_NATIVE_MINOR_VERSION > 84
126+
observerCoordinator.removeObserver(_imageResponseObserverProxy);
127+
#else
125128
observerCoordinator.removeObserver(*_imageResponseObserverProxy);
129+
#endif
126130
}
127131

128132
_state = state;
129133

130134
if (_state) {
131135
auto &observerCoordinator = _state->getData().getImageRequest().getObserverCoordinator();
136+
#if REACT_NATIVE_MINOR_VERSION > 84
137+
observerCoordinator.addObserver(_imageResponseObserverProxy);
138+
#else
132139
observerCoordinator.addObserver(*_imageResponseObserverProxy);
140+
#endif
133141
}
134142
}
135143

0 commit comments

Comments
 (0)