Skip to content

Commit b7167c2

Browse files
Simekfacebook-github-bot
authored andcommitted
PlatformColors: add missing clearColor for iOS (#30054)
Summary: This small PR adds missing [`clearColor`](https://developer.apple.com/documentation/uikit/uicolor/1621945-clearcolor?language=objc) to the avaiable PlatformColors on iOS. **Please let me know** if you would like to see ["Fixed colors"](https://developer.apple.com/documentation/uikit/uicolor/standard_colors?language=objc) added to the `PlatformColors`. I can address this within this PR or create a separate one. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Added] - PlatformColors: add missing `clearColor` Pull Request resolved: #30054 Test Plan: [(I had to disable the Dark Mode to fix the RNTester readability problems)](https://user-images.githubusercontent.com/719641/94453196-b35cb000-01b0-11eb-8d7d-73d48ceecf53.PNG) Transparent/clear color has been added to the RNTester PlatformColors API example: ![IMG_6782](https://user-images.githubusercontent.com/719641/94453172-ae97fc00-01b0-11eb-9bef-1a1a387ac009.PNG) Reviewed By: shergin Differential Revision: D24241160 Pulled By: sammy-SC fbshipit-source-id: 41fb51677329cc3b3f915d5d08694c07b4ef2cf3
1 parent eb7701c commit b7167c2

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

React/Base/RCTConvert.m

+5
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,11 @@ +(type)type : (id)json \
722722
// iOS 13.0
723723
RCTFallbackARGB : @(0xFFf2f2f7)
724724
},
725+
// Transparent Color
726+
@"clearColor" : @{
727+
// iOS 13.0
728+
RCTFallbackARGB : @(0x00000000)
729+
},
725730
} mutableCopy];
726731
// The color names are the Objective-C UIColor selector names,
727732
// but Swift selector names are valid as well, so make aliases.

packages/rn-tester/RNTesterUnitTests/RCTConvert_UIColorTests.m

+2
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ - (void)testGenerateFallbacks
154154
@"systemGray4Color": @(0xFFd1d1d6),
155155
@"systemGray5Color": @(0xFFe5e5ea),
156156
@"systemGray6Color": @(0xFFf2f2f7),
157+
// Clear Color
158+
@"clearColor": @(0x00000000),
157159
};
158160

159161
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000

packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ function PlatformColorsExample() {
110110
{label: 'systemGray4', color: PlatformColor('systemGray4')},
111111
{label: 'systemGray5', color: PlatformColor('systemGray5')},
112112
{label: 'systemGray6', color: PlatformColor('systemGray6')},
113+
// Transparent Color
114+
{label: 'clear', color: PlatformColor('clear')},
113115
];
114116
} else if (Platform.OS === 'android') {
115117
colors = [

0 commit comments

Comments
 (0)