Skip to content

Commit fefd655

Browse files
Saadnajmitido64
andauthored
Apply suggestions from code review
Co-authored-by: Tommy Nguyen <[email protected]>
1 parent 9d4ed19 commit fefd655

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,7 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
17071707
for (NSString *file in fileNames) {
17081708
NSURL *fileURL = [NSURL fileURLWithPath:file];
17091709
BOOL isDir = NO;
1710-
BOOL isValid = (![[NSFileManager defaultManager] fileExistsAtPath:fileURL.path isDirectory:&isDir] || isDir) ? NO : YES;
1710+
BOOL isValid = [[NSFileManager defaultManager] fileExistsAtPath:fileURL.path isDirectory:&isDir] && !isDir;
17111711
if (isValid) {
17121712

17131713
NSString *MIMETypeString = nil;
@@ -1727,14 +1727,6 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
17271727
forKey:NSURLFileSizeKey
17281728
error:&fileSizeError];
17291729

1730-
NSNumber *width = nil;
1731-
NSNumber *height = nil;
1732-
if ([MIMETypeString hasPrefix:@"image/"]) {
1733-
NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL];
1734-
width = @(image.size.width);
1735-
height = @(image.size.height);
1736-
}
1737-
17381730
DataTransferItem transferItem = {
17391731
.name = fileURL.lastPathComponent.UTF8String,
17401732
.kind = "file",
@@ -1746,12 +1738,10 @@ - (void)buildDataTransferItems:(std::vector<DataTransferItem> &)dataTransferItem
17461738
transferItem.size = fileSizeValue.intValue;
17471739
}
17481740

1749-
if (width != nil) {
1750-
transferItem.width = width.intValue;
1751-
}
1752-
1753-
if (height != nil) {
1754-
transferItem.height = height.intValue;
1741+
if ([MIMETypeString hasPrefix:@"image/"]) {
1742+
NSImage *image = [[NSImage alloc] initWithContentsOfURL:fileURL];
1743+
transferItem.width = @(image.size.width);
1744+
transferItem.height = @(image.size.height);
17551745
}
17561746

17571747
dataTransferItems.push_back(transferItem);

0 commit comments

Comments
 (0)