mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
897a3a5d5e | ||
|
|
0fea3515a1 | ||
|
|
80e8efe8e7 | ||
|
|
d1888650c5 | ||
|
|
f65b9e883a | ||
|
|
aa0b2ad1cd | ||
|
|
0a319978ff | ||
|
|
29e5deb85f | ||
|
|
031feb6942 | ||
|
|
d82138ff91 |
@@ -76,7 +76,7 @@
|
||||
// Throttle progress events so we don't send more that around 60 per second.
|
||||
CFTimeInterval currentTime = CACurrentMediaTime();
|
||||
|
||||
NSUInteger headersContentLength = headers[@"Content-Length"] != nil ? [headers[@"Content-Length"] unsignedIntValue] : 0;
|
||||
NSInteger headersContentLength = headers[@"Content-Length"] != nil ? [headers[@"Content-Length"] integerValue] : 0;
|
||||
if (callback && (currentTime - _lastDownloadProgress > 0.016 || final)) {
|
||||
_lastDownloadProgress = currentTime;
|
||||
callback(headers, @(headersContentLength), @(contentLength));
|
||||
|
||||
+32
-19
@@ -36,33 +36,46 @@
|
||||
typedef CGFloat RCTFontWeight;
|
||||
static RCTFontWeight weightOfFont(UIFont *font)
|
||||
{
|
||||
static NSDictionary *nameToWeight;
|
||||
static NSArray *fontNames;
|
||||
static NSArray *fontWeights;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
nameToWeight = @{
|
||||
@"normal": @(UIFontWeightRegular),
|
||||
@"bold": @(UIFontWeightBold),
|
||||
@"ultralight": @(UIFontWeightUltraLight),
|
||||
@"thin": @(UIFontWeightThin),
|
||||
@"light": @(UIFontWeightLight),
|
||||
@"regular": @(UIFontWeightRegular),
|
||||
@"medium": @(UIFontWeightMedium),
|
||||
@"semibold": @(UIFontWeightSemibold),
|
||||
@"bold": @(UIFontWeightBold),
|
||||
@"heavy": @(UIFontWeightHeavy),
|
||||
@"black": @(UIFontWeightBlack),
|
||||
};
|
||||
// We use two arrays instead of one map because
|
||||
// the order is important for suffix matching.
|
||||
fontNames = @[
|
||||
@"normal",
|
||||
@"ultralight",
|
||||
@"thin",
|
||||
@"light",
|
||||
@"regular",
|
||||
@"medium",
|
||||
@"semibold",
|
||||
@"bold",
|
||||
@"heavy",
|
||||
@"black"
|
||||
];
|
||||
fontWeights = @[
|
||||
@(UIFontWeightRegular),
|
||||
@(UIFontWeightUltraLight),
|
||||
@(UIFontWeightThin),
|
||||
@(UIFontWeightLight),
|
||||
@(UIFontWeightRegular),
|
||||
@(UIFontWeightMedium),
|
||||
@(UIFontWeightSemibold),
|
||||
@(UIFontWeightBold),
|
||||
@(UIFontWeightHeavy),
|
||||
@(UIFontWeightBlack)
|
||||
];
|
||||
});
|
||||
|
||||
for (NSString *name in nameToWeight) {
|
||||
if ([font.fontName.lowercaseString hasSuffix:name]) {
|
||||
return [nameToWeight[name] doubleValue];
|
||||
for (NSInteger i = 0; i < fontNames.count; i++) {
|
||||
if ([font.fontName.lowercaseString hasSuffix:fontNames[i]]) {
|
||||
return (RCTFontWeight)[fontWeights[i] doubleValue];
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary *traits = [font.fontDescriptor objectForKey:UIFontDescriptorTraitsAttribute];
|
||||
RCTFontWeight weight = [traits[UIFontWeightTrait] doubleValue];
|
||||
return weight;
|
||||
return (RCTFontWeight)[traits[UIFontWeightTrait] doubleValue];
|
||||
}
|
||||
|
||||
static BOOL isItalicFont(UIFont *font)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.49.0-rc.2
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
@@ -27,8 +27,6 @@ public class OnScrollDispatchHelper {
|
||||
|
||||
private long mLastScrollEventTimeMs = -(MIN_EVENT_SEPARATION_MS + 1);
|
||||
|
||||
private static final float THRESHOLD = 0.1f; // Threshold for end fling
|
||||
|
||||
/**
|
||||
* Call from a ScrollView in onScrollChanged, returns true if this onScrollChanged is legit (not a
|
||||
* duplicate) and should be dispatched.
|
||||
@@ -40,11 +38,6 @@ public class OnScrollDispatchHelper {
|
||||
mPrevX != x ||
|
||||
mPrevY != y;
|
||||
|
||||
// Skip the first calculation in each scroll
|
||||
if (Math.abs(mXFlingVelocity) < THRESHOLD && Math.abs(mYFlingVelocity) < THRESHOLD) {
|
||||
shouldDispatch = false;
|
||||
}
|
||||
|
||||
if (eventTime - mLastScrollEventTimeMs != 0) {
|
||||
mXFlingVelocity = (float) (x - mPrevX) / (eventTime - mLastScrollEventTimeMs);
|
||||
mYFlingVelocity = (float) (y - mPrevY) / (eventTime - mLastScrollEventTimeMs);
|
||||
|
||||
+6
-2
@@ -58,7 +58,8 @@ test:
|
||||
- cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
|
||||
- npm run lint
|
||||
# JS tests for dependencies installed with npm3
|
||||
- npm run flow -- check
|
||||
# Commenting out Flow tests
|
||||
# - npm run flow -- check
|
||||
- npm test -- --maxWorkers=1
|
||||
|
||||
# build app
|
||||
@@ -76,8 +77,11 @@ test:
|
||||
# integration tests
|
||||
# build JS bundle for instrumentation tests
|
||||
- node local-cli/cli.js bundle --max-workers 1 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
|
||||
# build test APK
|
||||
- buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
||||
# Commented out due to test failures. Please uncomment the next line once these have been fixed. See Issue #15726.
|
||||
# - buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
||||
|
||||
# run installed apk with tests
|
||||
# - node ./scripts/run-android-ci-instrumentation-tests.js --retries 3 --path ./ReactAndroid/src/androidTest/java/com/facebook/react/tests --package com.facebook.react.tests
|
||||
|
||||
|
||||
@@ -157,9 +157,11 @@ Go to the root directory for your project and create a new `package.json` file w
|
||||
Next, you will install the `react` and `react-native` packages. Open a terminal or command prompt, then navigate to the root directory for your project and type the following commands:
|
||||
|
||||
```
|
||||
$ npm install --save react react-native
|
||||
$ npm install --save react@16.0.0-beta.5 react-native
|
||||
```
|
||||
|
||||
> Make sure you use the same React version as specified in the [React Native `package.json` file](https://github.com/facebook/react-native/blob/0.49-stable/package.json). This will only be necessary as long as React Native depends on a pre-release version of React.
|
||||
|
||||
This will create a new `/node_modules` folder in your project's root directory. This folder stores all the JavaScript dependencies required to build your project.
|
||||
|
||||
<block class="objc swift" />
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"version": "1000.0.0",
|
||||
"version": "0.49.0-rc.2",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
@@ -205,4 +205,4 @@
|
||||
"shelljs": "0.6.0",
|
||||
"sinon": "^2.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user