Skip to content

Commit b2c9f1d

Browse files
authored
[feat] Add support for expo-image (#113)
1 parent 6bcfd11 commit b2c9f1d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ios/RNSharedElementContent.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ - (instancetype)initWithData:(id) data type:(RNSharedElementContentType)type ins
2020

2121
+ (BOOL) isKindOfImageView:(UIView*) view
2222
{
23+
NSString* className = NSStringFromClass(view.class);
2324
return (
2425
[view isKindOfClass:[UIImageView class]] ||
25-
[NSStringFromClass(view.class) isEqualToString:@"RCTImageView"]
26+
[className isEqualToString:@"RCTImageView"] ||
27+
[className isEqualToString:@"ExpoImage.ImageView"]
2628
);
2729
}
2830

2931
+ (UIImageView*) imageViewFromView:(UIView*) view
3032
{
3133
if ([view isKindOfClass:[UIImageView class]]) {
3234
return (UIImageView*) view;
33-
} else if ([NSStringFromClass(view.class) isEqualToString:@"RCTImageView"]) {
34-
// As of react-native 0.60, RCTImageView is no longer inherited from
35-
// UIImageView, but has a UIImageView as child. That will cause this code-path
36-
// to be executed, where the first child view is returned.
35+
} else if ([RNSharedElementContent isKindOfImageView:view]) {
36+
// Both react-native and expo-image have a UIImageView
37+
// as the first child.
3738
return (UIImageView*) view.subviews.firstObject;
3839
} else {
3940
// Error

0 commit comments

Comments
 (0)