Summary:
* Adds parent tag as param for createNode in place of explicit appendChild commands.
* Adds version info to bytecode
* Adds native conditional support:
Conditionals are represented in product code with the new `NativeConditional` React
component. It takes params necessary to construct a native function call, and takes
a render prop as a child that passes the value of the native call as an arg. In
prod, the component would actually call the native module and render with that value,
but in jest we render for *both* true and false and set them as children
of a new jest-only primitive/host component which we special-case and generate a
special command with `OP_CODE.conditional`, generate the appropriate bytecode commands
for each branch, and embed them as args in the conditional OP_CODE command. When
evaluating the bytecode, only one set of commands is executed, based on the native
module value (which is evaluated with another new opcode which computes the value
and stuffs it in a "register").
Obviously generating this bytecode is kind of a cludge compared to prepack, but
when I asked @[501709947:Dominic] about it, he said they had no bytecode spec right
now, so I'm running ahead with this prototype. The main thing I'm focused on is
the C++/RN bytecode interpretter - this jest stuff is just a way to generate bytecode
for it to consume which could be replaced or augmented with many other approaches,
such as prepack, server rendering, etc.
Also piggybacked a bunch of other cleanup.
Reviewed By: shergin
Differential Revision: D10277121
fbshipit-source-id: 15d3217a59ef481b574c742d17d8a7dc893cba90
Summary:
Issue in focus: #22100
The only occurrence of `Object` was replaced with the appropriate flow type
A Lint error was encountered in `deepFreezeAndThrowOnMutationInDev-test.js` when running `npm run lint` and was fixed by running `yarn prettier`
Pull Request resolved: https://github.com/facebook/react-native/pull/22152
Differential Revision: D12930872
Pulled By: RSNara
fbshipit-source-id: f9706ed2e49d9ccedfa331594c886d2d3b615db5
Summary:
Related to #22100
Turn on Flow strict mode for StaticContainer.react
This component needed proper Props type definition. I went through the only component (`TabBarItemIOS.ios`) using this to try to know the most appropriate props.
- All flow tests succeed.
[GENERAL] [ENHANCEMENT] [StaticContainer.react.js] - Flow strict mode
Pull Request resolved: https://github.com/facebook/react-native/pull/22121
Differential Revision: D12929646
Pulled By: TheSavior
fbshipit-source-id: 8826aa7bc83c854efdd71cdb4fba3d7ca98f2fce
Summary:
Related to #22100
Enhance Flow types for RefreshControl specifying `onRefresh` props type.
There are still 2 `any` left using `requireNativeComponent` that need to be addressed to turn Flow to strict mode.
I went through `RCTRefreshControl` and `AndroidSwipeRefreshLayout` classes to understand where this method came from.
- All flow tests succeed.
[GENERAL] [ENHANCEMENT] [RefreshControl.js] - Flow onRefresh type
Pull Request resolved: https://github.com/facebook/react-native/pull/22119
Differential Revision: D12919764
Pulled By: TheSavior
fbshipit-source-id: 9ba675be8dbce77d77972acb904fc13c68524831
Summary: The old implementation of folly::none inadvertently allowed disengaging an optional by writing `op = nullptr`. Disallow that and require `op = folly::none`.
Reviewed By: yfeldblum
Differential Revision: D12884724
fbshipit-source-id: b17bcf00b245069d8ea2d9bc3703b0fdcaa85c07
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:
Fixes ESLint warnings in `react-native-cli`. I isolated this PR from other lint fixes because of the top `DO NOT MODIFY THIS FILE` message. Either way I think this issues should be fixed :)
Pull Request resolved: https://github.com/facebook/react-native/pull/22099
Differential Revision: D12920673
Pulled By: TheSavior
fbshipit-source-id: ed1308fe7ef4633b793d85fe8c6ce5d068651e12
Summary:
In the new changelog format, we're following [Keep a Changelog](https://keepachangelog.com/en/1.0.0). This change updates the PR template to follow their change types, plus it simplifies the *CATEGORY* field to follow the changelog's groupings. Some simplified examples have been provided, though I plan to revisit this after 0.58 to add real-world examples. This change is motivated by react-native-community/react-native-releases#47.
Pull Request resolved: https://github.com/facebook/react-native/pull/22117
Differential Revision: D12919271
Pulled By: TheSavior
fbshipit-source-id: 91f063f769357b24383db281545678b924ad3efb
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: This diff fixes a IllegalStateException that can happen because of a race condition when using DialogManager
Reviewed By: fkgozali
Differential Revision: D12899432
fbshipit-source-id: 98fb7c1ee1d292a959628a33c8a2dd5a6d93e328
Summary:
D12904277 was my sad, optimistic attempt to fix this crash.
As @[100006577537606:Slobodan] mentioned on T35879909, the real issue is that moduleRegistry is being created (using _moduleDataByID dict) concurrently while we try to append to this dict.
I added locks around these usage of _moduleDataByID.
Reviewed By: fkgozali
Differential Revision: D12911108
fbshipit-source-id: 2435b7a477c27585898f351c4a0d4c1bd4056756
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:
T35879909 is a UBN caused by a race condition in RN initialization. I haven't been able to repro, but the crash logs point to a bad memory access in this method. Another thread must be deallocating something concurrently.
This is a quick fix to patch into v197.
Reviewed By: fkgozali
Differential Revision: D12904277
fbshipit-source-id: 5740183f9a7c8f2c45ca627662891cb0c1048764
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:
@public
This allows apps to specify custom lazy modules that they need to load during chrome debugging. This is because lazy modules won't be available on start up, hence these modules will be missing in JS land, causing problems.
Reviewed By: shergin
Differential Revision: D12899408
fbshipit-source-id: dca313648e994b22e3ee5afec856ef76470065f9
Summary: Simply changing RCTLogWarn() to RCTLogInfo(), since some modules can be loaded without explicit export (experimental).
Reviewed By: mdvacca
Differential Revision: D12899442
fbshipit-source-id: 524d345265eda4a601101d878d51c244a8441fb5
Summary:
AndroidManifest.xml file in UIManager only defines minimum SDK version for whole namespace "com.facebook". But it is always redefined by build.gradle file because Gradle file has precedence.
https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle#L273
Anyway Gradle is prefered way to define it. So i think it should be removed if it is not used for another purpose.
Pull Request resolved: https://github.com/facebook/react-native/pull/22044
Differential Revision: D12898251
Pulled By: hramos
fbshipit-source-id: 087b5cc45495109b5626c9cb232d0546c53fb709
Summary: Improves the types for Easing and bezier to make them script.
Differential Revision: D10346234
fbshipit-source-id: e941110c62f7dcd17b0d022497cf29e0935db5a3