Summary: This change expands the limits to support a greater variety of scenarios.
Reviewed By: PeteTheHeat
Differential Revision: D12911841
fbshipit-source-id: a7c8eb6fece49dfe47b3ada98f55a02b43396ce8
Summary:
This PR increases the speed at which cached images are loaded and displayed on the screen. Images are currently cached in memory using RCTImageCache, but each time they are loaded, a round trip through RCTNetworking happens before RCTImageCache is even checked. This is likely so that RCTNetworking can handle the caching behavior required by the HTTP headers. However, this means that at the very least, images are read from disk each time they're loaded.
This PR makes RCTImageLoader check RCTImageCache _before_ sending a request to RCTNetworking. RCTImageCache stores a bit of information about the response headers so that it can respect Cache-Control fields without needing a roundtrip through RCTNetworking.
Here are a couple of graphs showing improved loading times before this change (blue) and after (red) with SDWebImage (yellow) as a baseline comparison. The increase is most evident when loading especially large (hi-res photo size) images, or loading multiple images at a time.
https://imgur.com/a/cnL47Z0
More performance gains can potentially be had by increasing the size limit of RCTImageCache: 1a6666a116/Libraries/Image/RCTImageCache.m (L39) but this comes at the tradeoff of being more likely to run into OOM crashes.
Pull Request resolved: https://github.com/facebook/react-native/pull/20356
Reviewed By: PeteTheHeat
Differential Revision: D12909121
Pulled By: alsun2001
fbshipit-source-id: 7f5e21928c53d7aa53f293b7f1b4ec5c99b5f0c2
Summary:
Replaces the keywords var with const in Libraries/merge.js
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!
- [x] Check npm run flow
- [x] Check npm run flow-check-ios
- [x] Check npm run flow-check-android
[GENERAL] [ENHANCEMENT] [Libraries/core] - remove var
Pull Request resolved: https://github.com/facebook/react-native/pull/22108
Differential Revision: D12919282
Pulled By: TheSavior
fbshipit-source-id: e3c8569c47c95ad3d1a061917c90185c2694c78f
Summary:
Flow is broken for a bunch of people and has been for the last few days. For some reason this isn't causing any builds to fail which we will need to look into. For now, this stops the bleeding.
I *think* this is because of case sensitivity differenes between Mac and where all of our CI machines run.
```
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ Libraries/Core/polyfillPromise.js:21:33
Importing from an untyped module makes it any and is not safe! Did you mean to add // flow to the top of Promise?
(untyped-import)
18│ * If you don't need these polyfills, don't use InitializeCore; just directly
19│ * require the modules you need from InitializeCore for setup.
20│ */
21│ polyfillGlobal('Promise', () => require('Promise'));
22│
```
Pull Request resolved: https://github.com/facebook/react-native/pull/22048
Reviewed By: shergin
Differential Revision: D12918418
Pulled By: TheSavior
fbshipit-source-id: 9d9db1b3686eab906244180325c12ffcce92be8c
Summary:
There are some critical bugs that require further investigation in the most recent upgrade to React 16.6 (and ReactNativeRenderer changes).
This revision reverts the sync until these issues have been resolved.
Reviewed By: mdvacca
Differential Revision: D12918541
fbshipit-source-id: 5c1ada185851ba599f3c86387158a2b41f3dcf3e
Summary:
Replaces the keywords var with const in Libraries/emitter/EventValidator.js
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
- [x] Check npm run flow
- [x] Check npm run flow-check-ios
- [x] Check npm run flow-check-android
[GENERAL] [ENHANCEMENT] [Libraries/emitter] - remove `var`
Pull Request resolved: https://github.com/facebook/react-native/pull/22087
Differential Revision: D12918444
Pulled By: TheSavior
fbshipit-source-id: 630ccb283fd6c3118a22124a656038eac4a88599
Summary:
Related to #22100
Turn Flow strict mode on for ScrollViewMock.
This file used to declare jest var as `any` but jest module is already typed in root flow folder.
Note: I had to use a quick fix for polyfillPromise. See here #22101
- All flow tests succeed.
[GENERAL] [ENHANCEMENT] [ScrollViewMock.js] - Flow strict mode
Pull Request resolved: https://github.com/facebook/react-native/pull/22103
Differential Revision: D12918380
Pulled By: TheSavior
fbshipit-source-id: cd3aba47b1a43e76a7da09e15cc2d9cfcdf7f56d
Summary:
Changing the the this.props.visible if to be ` if (!!this.props.visible === false)` . So passing undefined, or other values wont set the modal to be visible. Granting that anything that is not true, will set the modal to null on the render.
I make this this PR, because on the company that im working, we used a lot of RN. At the moment, we arent using anything like flow or TS. But to grant that the modals will only show if they are set visible to true i have changed the if made.
_Pull requests that expand test coverage are more likely to get reviewed. Add a test case whenever possible!_
Pull Request resolved: https://github.com/facebook/react-native/pull/22072
Differential Revision: D12918086
Pulled By: TheSavior
fbshipit-source-id: 8f9c63ac6fd56d83949bb8428ad7c5b7bf805c49
Summary:
Fixes the only ESLint error pending to resolve. It was a duplicate `get` declaration.
Pull Request resolved: https://github.com/facebook/react-native/pull/22098
Differential Revision: D12918078
Pulled By: TheSavior
fbshipit-source-id: c738d6880241dbc1f1ddc06c2d4e52443c00768a
Summary:
A minor change to the comment in the Image.android.js file.
Pull Request resolved: https://github.com/facebook/react-native/pull/22092
Differential Revision: D12918066
Pulled By: TheSavior
fbshipit-source-id: f27c63241c9dde780c037edcbcdf4cc10d55d33e
Summary:
Related to #21581
This PR was already opened here https://github.com/facebook/react-native/pull/21600 but seems to be inactive.
Remove createReactClass from ProgressBarAndroidExample.
- `yarn run flow` && `yarn run flow-check-android` succeed.
- RNTester app ProgressBarAndroidExample on Android.
[GENERAL] [ENHANCEMENT] [ProgressBarAndroidExample.android.js] - rm createReactClass
Pull Request resolved: https://github.com/facebook/react-native/pull/21874
Reviewed By: TheSavior
Differential Revision: D12827689
Pulled By: RSNara
fbshipit-source-id: 46c70ea67dddf5d928fe936a28ef4a0a929d127f
Summary:
This PR converts the use of `NativeMethodsMixin` in `CheckBox.android.js`, and converts it to an ES6-style class.
Pull Request resolved: https://github.com/facebook/react-native/pull/21585
Reviewed By: TheSavior
Differential Revision: D12827768
Pulled By: RSNara
fbshipit-source-id: c113c221335e61e015a20bbb6bcff5f9837f9022
Summary: Improves the types for Easing and bezier to make them script.
Differential Revision: D10346234
fbshipit-source-id: e941110c62f7dcd17b0d022497cf29e0935db5a3
Summary:
Fixes lots of ESLint warnings. Many of them where in PR #20877 by janicduplessis which requested to split the linting fixes from configuration and package changes.
I solved only the issues that I was most certain about but I would love to get hands on all of them with a little bit of input.
Pull Request resolved: https://github.com/facebook/react-native/pull/22062
Differential Revision: D12889447
Pulled By: TheSavior
fbshipit-source-id: 35f7a08104a5b859c860afdde4af2b32c0685c50
Summary:
If a view inside of an inline view became dirty (e.g. its top/left prop changed), its position would not update on screen. This is because Yoga didn't know the view needed to be relaid out because Yoga's dirty signal didn't propagate all the way up to the root.
The problem is that inline views don't have a parent in the Yoga tree causing Yoga's dirtiness signal propagation to get cut off early. The fix is, when an inline views gets dirty, mark the parent Text's Yoga node as dirty. This will cause Yoga's dirtiness signal to propagate all the way up to the root node.
Yoga has a hook to inform you when your node is marked as dirty: `YGNodeSetDirtiedFunc`. We leverage this to find out when an inline view's Yoga node gets dirtied.
React Native almost handled this case. Everything worked fine as long as the inline view was nested inside of a virtual text node like this:
```
<Text>
<Text>
<InlineView />
</Text>
</Text>
```
However, the bug repros when the inline view is nested in a non-virtual text node:
```
<Text>
<InlineView />
</Text>
```
The fix is to move the special dirtiness propagation logic from `RCTVirtualTextShadowView` to `RCTBaseTextShadowView`.
**Test Plan**
Created an inline view. Tested the following kinds of updates on the inline view's content:
- Moved the content
- Removed the content
- Added the content
Tested this for an inline view that is directly inside of a text node as well as one that is nested under a virtual text node.
Here's the code I used for the inline view that moved its content after 2 seconds:
```
const RN = require('react-native');
const React = require('react');
export default class InlineView extends React.Component {
constructor(props, context) {
super(props, context);
this.state = { posBottom: false };
}
componentDidMount() {
super.componentDidMount && super.componentDidMount();
setTimeout(() => { this.setState({ posBottom: true }); }, 2000);
}
render() {
const pos = this.state.posBottom ? 25 : 0;
const color = this.state.posBottom ? 'pink' : 'green';
return (
<RN.View style={{ width: 50, height: 50, backgroundColor: 'steelblue'}}>
<RN.View style={{ width: 25, height: 25, top: pos, left: pos, backgroundColor: color }} />
</RN.View>
);
}
}
```
**Release Notes**
[IOS] [BUGFIX] [Text] - Fix case where content of inline views didn't get relaid out
Adam Comella
Microsoft Corp.
Pull Request resolved: https://github.com/facebook/react-native/pull/21968
Differential Revision: D12873795
Pulled By: shergin
fbshipit-source-id: bbc9f5d3ef25063b0015cec8c4aaf2e41ecd60a8
Summary: Adds copyright headers to all files that are missing them.
Reviewed By: hramos
Differential Revision: D12837494
fbshipit-source-id: 6330a18919676dec9ff2c03b7c9329ed9127d930
Summary: This function sometimes causes an "Unable to find node on an unmounted component" crash during pagination for reasons that still need to be investigated; in the meanwhile, wrap this in a try-catch block to mitigate the crash.
Reviewed By: sahrens
Differential Revision: D12829971
fbshipit-source-id: bc9fe5b9b8c03430ff890bfbb27c39aa270c9eb7
Summary:
This PR bumps also fbjs-scripts to latest version. Benefit is smaller node_modules and less deps to download as newer version doesn't depend on babel6 anymore.
Pull Request resolved: https://github.com/facebook/react-native/pull/21880
Differential Revision: D12832002
Pulled By: hramos
fbshipit-source-id: fa801aeb70a2f22be6f9c05cd6d981d0af0a0da9
Summary:
Adds the displayName prop to `View` and `Text` components. Because these now use `React.forwardRef`, they were showing as `Component` instead of their actual names.
Thanks to ljharb for helping to pinpoint the source of the issue!
Fixes#21937
Pull Request resolved: https://github.com/facebook/react-native/pull/21950
Differential Revision: D12827060
Pulled By: TheSavior
fbshipit-source-id: d812cae14d53ad821ab5873e737db63ad1a989e3
Summary: Split up InitializeCore into a bunch of modules. The idea here is to make it easier for apps to just get the initialization logic they want and leave behind what they don't; for example, if you don't want the Map/Set polyfills, instead of requiring InitializeCore you can require the modules you want from it.
Reviewed By: yungsters
Differential Revision: D10842564
fbshipit-source-id: 3b12d54fddea8c4ee75886022338c214987a015c
Summary: Instead of having a single point at the top of InitializeCore, let's just create a subspan for it. Initially I just wanted to use this point to track JS start time, but it'll be useful to see how long initializeCore takes, too.
Reviewed By: alexeylang
Differential Revision: D10521595
fbshipit-source-id: 3025c34ffab39b79efc966f0c0eb6f502c91c550
Summary:
This functionality was removed here: 636d01bbd0
This is just a step of cleanup
Reviewed By: yungsters
Differential Revision: D10515512
fbshipit-source-id: 6d24cc9c53c71924a82c67a4058585ee978de2d9
Summary: I did a bit more refactoring to NetworkOverlay.
Reviewed By: TheSavior
Differential Revision: D10476158
fbshipit-source-id: da26251f8dfd12dd592da3ae5367efa37ec07669
Summary: Adding perf marker point to the beginning of InitializeCore.
Reviewed By: TheSavior
Differential Revision: D10496350
fbshipit-source-id: 56c77414e0c31cf918377e95e3b0c236a5672e35
Summary:
This was deleted as part of 774cd73663
I forgot that we normally keep the getter at the bottom of the module with an invariant so that people get clearer messages when they upgrade.
Reviewed By: yungsters
Differential Revision: D10475667
fbshipit-source-id: fcc527cd8117a506096a910a602272e092b8672d
Summary:
This diff fixes an issue that caused the problem with `regeneratorRuntime` last Friday (more info: https://fb.facebook.com/groups/frontendsupport/permalink/2427883350560427/).
The root issue is that both `InitializeCore` and `FBInitializeCore` are included in the same bundle, this fix just prevents the bundle from being invalid once this happens..
*copied from: https://our.intern.facebook.com/intern/diff/D10444264/?transaction_id=595485237532887*
The way that `regeneratorRuntime` is polyfilled is not correct:
```
polyfillGlobal('regeneratorRuntime', () => {
// The require just sets up the global, so make sure when we first
// invoke it the global does not exist
delete global.regeneratorRuntime;
require('regenerator-runtime/runtime');
return global.regeneratorRuntime;
});
```
Since a `require`d module is only evaluated once (no matter how many times it's required), defining (and calling) a getter for `global.regeneratorRuntime` twice will end up storing `undefined` to `global.regeneratorRuntime`.
There were no issues before this diff because the ordering of requires made things work by coincidence, e.g the following code will work:
```
// Set up regenerator for the first time
polyfillGlobal('regeneratorRuntime', () => {
delete global.regeneratorRuntime;
require('regenerator-runtime/runtime');
return global.regeneratorRuntime;
});
// Set up regenerator for the second time. This will just override the previous getter (which has not even got executed so
// the `regenerator-runtime/runtime` module has not been evaluated yet.
polyfillGlobal('regeneratorRuntime', () => {
// The require just sets up the global, so make sure when we first
// invoke it the global does not exist
delete global.regeneratorRuntime;
require('regenerator-runtime/runtime');
return global.regeneratorRuntime;
});
// Now access regenerator
global.regeneratorRuntime;
```
But the following code won't work:
```
// Set up regenerator for the first time
polyfillGlobal('regeneratorRuntime', () => {
delete global.regeneratorRuntime;
require('regenerator-runtime/runtime');
return global.regeneratorRuntime;
});
// Access regenerator. This will cause the previous getter to be called, and the `regenerator-runtime/runtime` module will get evaluated.
// Here, `global.regeneratorRuntime` will have a correct value.
global.regeneratorRuntime;
// Set up regenerator for the second time. This will define a new getter for `global.regeneratorRuntime`, which will delete `delete global.regeneratorRuntime`
// and return undefined (note that `require('regenerator-runtime/runtime');` is a noop since the module has been already evaluated).
polyfillGlobal('regeneratorRuntime', () => {
// The require just sets up the global, so make sure when we first
// invoke it the global does not exist
delete global.regeneratorRuntime;
require('regenerator-runtime/runtime');
return global.regeneratorRuntime;
});
```
Reviewed By: fromcelticpark
Differential Revision: D10483975
fbshipit-source-id: 5b3ef6e11c4fc4f79e3857c1ade9e7bc2beb6a39
Summary: Exports the `ImageLoadEvent` type so that components passing through the `onLoad` callback can be properly typed.
Reviewed By: TheSavior
Differential Revision: D10481050
fbshipit-source-id: f0a48163c6221087b0f9869c033c653316471af9
Summary:
Remove BackAndroid, which has had a deprecation warning and only forwarded to BackHandler since March 2018.
Test Plan
---------
React-native init bundle and RNTester bundle works.
Release Notes:
--------------
[ ANDROID ] [ BREAKING ] [ BackAndroid ] - Deprecate BackAndroid since BackHandler should be used in its place.
Pull Request resolved: https://github.com/facebook/react-native/pull/21866
Differential Revision: D10472419
Pulled By: TheSavior
fbshipit-source-id: 3d76e1ce4c74bb783fee7fd8232bb366f2e7ea12
Summary: Removing explicit requires of Map and Set (since those are polyfilled), and fixing resulting flow errors.
Reviewed By: yungsters
Differential Revision: D10350673
fbshipit-source-id: 2fefe8ed1ae1f2cc9e5b7923ad630e73eda9e856
Summary: ListView is deprecated and SwipeableListView uses ListView. Thus, it is deprecated as well.
Reviewed By: RSNara
Differential Revision: D10437408
fbshipit-source-id: a08391d5b099e74b6ec179cd940ac404b2e702f4