-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iOS: Exposes the RCTFont size overrides so unit tests can use the sam…
…e values Summary: `RCTFontTests` test in RNTester is broken if the target deployment is <= OS 8.2. This is because RCTFont.mm overrides the OS-defined values, but the override is only visible to RCTFont.mm internals. As the result, when the Unit test tries to create UIFont of the "same" weight, it got a different font - most likely due to internal floating rounding errors. To mitigate, code that wants to test out internals of RCTFont should import RCTFontConstantsOverride.h Reviewed By: mmmulani Differential Revision: D7900954 fbshipit-source-id: e5814ef059a8afdfb5205ca1af46c41b3cfd4318
- Loading branch information
1 parent
820673e
commit 6611fef
Showing
4 changed files
with
37 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// NOTE: Include this header file to ensure consistency of the constants defined here. | ||
// The values are the ones used in RCTFont.mm. | ||
// Example: import it for testing RCTFont internals in a unit test. | ||
|
||
#if !defined(__IPHONE_8_2) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2 | ||
|
||
// These constants are defined in iPhone SDK 8.2, but the app cannot run on | ||
// iOS < 8.2 unless we redefine them here. If you target iOS 8.2 or above | ||
// as a base target, the standard constants will be used instead. | ||
// These constants can only be removed when React Native drops iOS8 support. | ||
|
||
#define UIFontWeightUltraLight -0.8 | ||
#define UIFontWeightThin -0.6 | ||
#define UIFontWeightLight -0.4 | ||
#define UIFontWeightRegular 0 | ||
#define UIFontWeightMedium 0.23 | ||
#define UIFontWeightSemibold 0.3 | ||
#define UIFontWeightBold 0.4 | ||
#define UIFontWeightHeavy 0.56 | ||
#define UIFontWeightBlack 0.62 | ||
|
||
#endif |