mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 10:45:04 +00:00
6611fefef7
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
30 lines
1.0 KiB
C
30 lines
1.0 KiB
C
/**
|
|
* 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
|