mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
1
Commits
main
...
export-D81571883
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14bc92cfa7 |
+2
-2
@@ -153,11 +153,11 @@ static UIColor *_Nullable _UIColorFromSemanticString(NSString *semanticString)
|
||||
: semanticString;
|
||||
NSDictionary<NSString *, NSDictionary *> *platformColorSelectorsDict = _PlatformColorSelectorsDict();
|
||||
NSDictionary<NSString *, id> *colorInfo = platformColorSelectorsDict[platformColorString];
|
||||
if (colorInfo) {
|
||||
if (colorInfo != nullptr) {
|
||||
SEL objcColorSelector = NSSelectorFromString([platformColorString stringByAppendingString:kColorSuffix]);
|
||||
if (![UIColor respondsToSelector:objcColorSelector]) {
|
||||
NSNumber *fallbackRGB = colorInfo[kFallbackARGBKey];
|
||||
if (fallbackRGB) {
|
||||
if (fallbackRGB != nullptr) {
|
||||
return _UIColorFromHexValue(fallbackRGB);
|
||||
}
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ inline static NSURL *NSURLFromImageSource(const facebook::react::ImageSource &im
|
||||
|
||||
NSURL *url = [[NSURL alloc] initWithString:urlString];
|
||||
|
||||
if (url.scheme) {
|
||||
if (url.scheme != nullptr) {
|
||||
// Well-formed absolute URL.
|
||||
return url;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ inline static NSURLRequest *NSURLRequestFromImageSource(const facebook::react::I
|
||||
{
|
||||
NSURL *url = NSURLFromImageSource(imageSource);
|
||||
|
||||
if (!url) {
|
||||
if (url == nullptr) {
|
||||
RCTLogError(@"URI parsing error.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ static inline facebook::react::SharedEventEmitter RCTUnwrapEventEmitter(NSData *
|
||||
|
||||
auto weakPtr = dynamic_cast<std::weak_ptr<const facebook::react::EventEmitter> *>(
|
||||
(std::weak_ptr<const facebook::react::EventEmitter> *)data.bytes);
|
||||
if (weakPtr) {
|
||||
if (weakPtr != nullptr) {
|
||||
return weakPtr->lock();
|
||||
}
|
||||
|
||||
|
||||
+33
-33
@@ -36,7 +36,7 @@ static RCTFontProperties RCTResolveFontProperties(
|
||||
RCTFontProperties fontProperties,
|
||||
RCTFontProperties baseFontProperties)
|
||||
{
|
||||
fontProperties.family = fontProperties.family.length ? fontProperties.family : baseFontProperties.family;
|
||||
fontProperties.family = (fontProperties.family.length != 0u) ? fontProperties.family : baseFontProperties.family;
|
||||
fontProperties.size = !isnan(fontProperties.size) ? fontProperties.size : baseFontProperties.size;
|
||||
fontProperties.weight = !isnan(fontProperties.weight) ? fontProperties.weight : baseFontProperties.weight;
|
||||
fontProperties.style =
|
||||
@@ -50,7 +50,7 @@ static RCTFontStyle RCTGetFontStyle(UIFont *font)
|
||||
{
|
||||
NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute];
|
||||
UIFontDescriptorSymbolicTraits symbolicTraits = [traits[UIFontSymbolicTrait] unsignedIntValue];
|
||||
if (symbolicTraits & UIFontDescriptorTraitItalic) {
|
||||
if ((symbolicTraits & UIFontDescriptorTraitItalic) != 0u) {
|
||||
return RCTFontStyleItalic;
|
||||
}
|
||||
|
||||
@@ -167,79 +167,79 @@ static NSArray *RCTFontFeatures(RCTFontVariant fontVariant)
|
||||
};
|
||||
});
|
||||
|
||||
if (fontVariant & RCTFontVariantSmallCaps) {
|
||||
if ((fontVariant & RCTFontVariantSmallCaps) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantSmallCaps]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantOldstyleNums) {
|
||||
if ((fontVariant & RCTFontVariantOldstyleNums) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantOldstyleNums]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantLiningNums) {
|
||||
if ((fontVariant & RCTFontVariantLiningNums) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantLiningNums]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantTabularNums) {
|
||||
if ((fontVariant & RCTFontVariantTabularNums) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantTabularNums]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantProportionalNums) {
|
||||
if ((fontVariant & RCTFontVariantProportionalNums) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantProportionalNums]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticOne) {
|
||||
if ((fontVariant & RCTFontVariantStylisticOne) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticOne]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticTwo) {
|
||||
if ((fontVariant & RCTFontVariantStylisticTwo) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticTwo]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticThree) {
|
||||
if ((fontVariant & RCTFontVariantStylisticThree) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticThree]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticFour) {
|
||||
if ((fontVariant & RCTFontVariantStylisticFour) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticFour]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticFive) {
|
||||
if ((fontVariant & RCTFontVariantStylisticFive) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticFive]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticSix) {
|
||||
if ((fontVariant & RCTFontVariantStylisticSix) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticSix]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticSeven) {
|
||||
if ((fontVariant & RCTFontVariantStylisticSeven) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticSeven]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticEight) {
|
||||
if ((fontVariant & RCTFontVariantStylisticEight) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticEight]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticNine) {
|
||||
if ((fontVariant & RCTFontVariantStylisticNine) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticNine]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticTen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticTen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticTen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticEleven) {
|
||||
if ((fontVariant & RCTFontVariantStylisticEleven) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticEleven]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticTwelve) {
|
||||
if ((fontVariant & RCTFontVariantStylisticTwelve) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticTwelve]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticThirteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticThirteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticThirteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticFourteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticFourteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticFourteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticFifteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticFifteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticFifteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticSixteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticSixteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticSixteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticSeventeen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticSeventeen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticSeventeen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticEighteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticEighteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticEighteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticNineteen) {
|
||||
if ((fontVariant & RCTFontVariantStylisticNineteen) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticNineteen]];
|
||||
}
|
||||
if (fontVariant & RCTFontVariantStylisticTwenty) {
|
||||
if ((fontVariant & RCTFontVariantStylisticTwenty) != 0) {
|
||||
[fontFeatures addObject:mapping[RCTFontVariantStylisticTwenty]];
|
||||
}
|
||||
|
||||
@@ -258,13 +258,13 @@ static UIFont *RCTDefaultFontWithFontProperties(RCTFontProperties fontProperties
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(fontCacheMutex);
|
||||
if (!fontCache) {
|
||||
if (fontCache == nullptr) {
|
||||
fontCache = [NSCache new];
|
||||
}
|
||||
font = [fontCache objectForKey:cacheKey];
|
||||
}
|
||||
|
||||
if (!font) {
|
||||
if (font == nullptr) {
|
||||
font = [UIFont systemFontOfSize:effectiveFontSize weight:fontProperties.weight];
|
||||
|
||||
if (fontProperties.style == RCTFontStyleItalic) {
|
||||
@@ -308,7 +308,7 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
||||
CGFloat effectiveFontSize = fontProperties.sizeMultiplier * fontProperties.size;
|
||||
UIFont *font;
|
||||
UIFontDescriptorSystemDesign design = RCTGetFontDescriptorSystemDesign([fontProperties.family lowercaseString]);
|
||||
if (design) {
|
||||
if (design != nullptr) {
|
||||
// Create a system font which `-fontDescriptorWithDesign:` asks for
|
||||
// (see:
|
||||
// https://developer.apple.com/documentation/uikit/uifontdescriptor/3151797-fontdescriptorwithdesign?language=objc)
|
||||
@@ -328,9 +328,9 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
||||
// Gracefully handle being given a font name rather than font family, for
|
||||
// example: "Helvetica Light Oblique" rather than just "Helvetica".
|
||||
font = [UIFont fontWithName:fontProperties.family size:effectiveFontSize];
|
||||
if (font) {
|
||||
if (font != nullptr) {
|
||||
fontNames = [UIFont fontNamesForFamilyName:font.familyName];
|
||||
fontWeight = fontWeight ?: RCTGetFontWeight(font);
|
||||
fontWeight = (fontWeight != 0.0) ?: RCTGetFontWeight(font);
|
||||
} else {
|
||||
// Failback to system font.
|
||||
font = [UIFont systemFontOfSize:effectiveFontSize weight:fontProperties.weight];
|
||||
@@ -354,7 +354,7 @@ UIFont *RCTFontWithFontProperties(RCTFontProperties fontProperties)
|
||||
}
|
||||
}
|
||||
|
||||
if (!font) {
|
||||
if (font == nullptr) {
|
||||
// If we still don't have a match at least return the first font in the
|
||||
// fontFamily This is to support built-in font Zapfino and other custom
|
||||
// single font families like Impact
|
||||
|
||||
+4
-4
@@ -116,7 +116,7 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||
UIBezierPath *path = [UIBezierPath
|
||||
bezierPathWithRoundedRect:CGRectInset(enclosingRect, -2, -2)
|
||||
cornerRadius:2];
|
||||
if (highlightPath) {
|
||||
if (highlightPath != nullptr) {
|
||||
[highlightPath appendPath:path];
|
||||
} else {
|
||||
highlightPath = path;
|
||||
@@ -159,7 +159,7 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||
id attribute = [textStorage attribute:key
|
||||
atIndex:characterRange.location - 1
|
||||
effectiveRange:nil];
|
||||
if (attribute) {
|
||||
if (attribute != nullptr) {
|
||||
[textStorage addAttribute:key value:attribute range:characterRange];
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||
inRange:characterRange
|
||||
options:0
|
||||
usingBlock:^(NSString *value, NSRange range, BOOL *pause) {
|
||||
if (!value) {
|
||||
if (value == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
|
||||
inRange:NSMakeRange(0, textStorage.length)
|
||||
options:0
|
||||
usingBlock:^(NSTextAttachment *attachment, NSRange range, BOOL *stop) {
|
||||
if (!attachment) {
|
||||
if (attachment == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ TextMeasurement TextLayoutManager::measure(
|
||||
(NSAttributedString *)unwrapManagedObject(attributedStringBox.getOpaquePointer());
|
||||
|
||||
auto telemetry = TransactionTelemetry::threadLocalTelemetry();
|
||||
if (telemetry) {
|
||||
if (telemetry != nullptr) {
|
||||
telemetry->willMeasureText();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ TextMeasurement TextLayoutManager::measure(
|
||||
layoutContext:layoutContext
|
||||
layoutConstraints:layoutConstraints];
|
||||
|
||||
if (telemetry) {
|
||||
if (telemetry != nullptr) {
|
||||
telemetry->didMeasureText();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ id convertFollyDynamicToId(const folly::dynamic &dyn)
|
||||
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:dyn.size()];
|
||||
for (const auto &elem : dyn) {
|
||||
id value = convertFollyDynamicToId(elem);
|
||||
if (value) {
|
||||
if (value != nullptr) {
|
||||
[array addObject:value];
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ id convertFollyDynamicToId(const folly::dynamic &dyn)
|
||||
for (const auto &elem : dyn.items()) {
|
||||
id key = convertFollyDynamicToId(elem.first);
|
||||
id value = convertFollyDynamicToId(elem.second);
|
||||
if (key && value) {
|
||||
if ((key != nullptr) && (value != nullptr)) {
|
||||
dict[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
- (void)emitEvent
|
||||
{
|
||||
if (!self.onColorChanged) {
|
||||
if (self.onColorChanged == nullptr) {
|
||||
return;
|
||||
}
|
||||
CGFloat hue = 0.0;
|
||||
|
||||
@@ -68,7 +68,7 @@ RCT_EXPORT_METHOD(removeOverlays : (nonnull NSNumber *)reactTag)
|
||||
+ (UIView *)getViewByTag:(NSDictionary<NSNumber *, UIView *> *)viewRegistry reactTag:(nonnull NSNumber *)reactTag
|
||||
{
|
||||
UIView *view = viewRegistry[reactTag];
|
||||
if (!view || ![view isKindOfClass:[RNTLegacyView class]]) {
|
||||
if ((view == nullptr) || ![view isKindOfClass:[RNTLegacyView class]]) {
|
||||
RCTLogError(@"Cannot find RNTLegacyView with tag #%@", reactTag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ RCT_EXPORT_METHOD(callNativeMethodToChangeBackgroundColor : (nonnull NSNumber *)
|
||||
{
|
||||
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
UIView *view = viewRegistry[reactTag];
|
||||
if (!view || ![view isKindOfClass:[UIView class]]) {
|
||||
if ((view == nullptr) || ![view isKindOfClass:[UIView class]]) {
|
||||
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user