Skip to content

Commit b11f8ae

Browse files
committed
fix: fix build with use frameworks
1 parent 420b736 commit b11f8ae

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ios/AnimatedObserverView.mm

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
#import "RCTFabricComponentsPlugins.h"
99
#import "RCTConversions.h"
1010

11+
// Avoid error when `use_frameworks!` is enabled
12+
#if __has_include("AnimatedObserver/AnimatedObserver-Swift.h")
13+
#import "AnimatedObserver/AnimatedObserver-Swift.h"
14+
#else
1115
#import "AnimatedObserver-Swift.h"
16+
#endif
1217

1318
using namespace facebook::react;
1419

@@ -31,17 +36,17 @@ - (instancetype)initWithFrame:(CGRect)frame
3136
if (self = [super initWithFrame:frame]) {
3237
static const auto defaultProps = std::make_shared<const AnimatedObserverViewProps>();
3338
_props = defaultProps;
34-
39+
3540
_view = [[UIView alloc] init];
3641
_manager = [[AnimatedObserverEventManager alloc] initWithEmit:^(double value) {
3742
auto eventEmitter = std::static_pointer_cast<const AnimatedObserverViewEventEmitter>(self->_eventEmitter);
38-
43+
3944
if (eventEmitter) {
4045
eventEmitter->onValueChange(AnimatedObserverViewEventEmitter::OnValueChange{
4146
.value = value
4247
});
4348
}
44-
49+
4550
// This is temporary workaround to allow animations based on onPageScroll event
4651
// until Fabric implements proper NativeAnimationDriver,
4752
// see: https://github.com/facebook/react-native/blob/44f431b471c243c92284aa042d3807ba4d04af65/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm#L59
@@ -52,26 +57,26 @@ - (instancetype)initWithFrame:(CGRect)frame
5257
object:nil
5358
userInfo:userInfo];
5459
}];
55-
60+
5661
self.contentView = _view;
5762
}
58-
63+
5964
return self;
6065
}
6166

6267
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
6368
{
6469
const auto &oldViewProps = *std::static_pointer_cast<AnimatedObserverViewProps const>(_props);
6570
const auto &newViewProps = *std::static_pointer_cast<AnimatedObserverViewProps const>(props);
66-
71+
6772
if (oldViewProps.tag != newViewProps.tag) {
6873
[_manager setTag:RCTNSStringFromString(newViewProps.tag)];
6974
}
70-
75+
7176
if (oldViewProps.value != newViewProps.value) {
7277
[_manager setValue:newViewProps.value];
7378
}
74-
79+
7580
[super updateProps:props oldProps:oldProps];
7681
}
7782

0 commit comments

Comments
 (0)