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
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: During RN's startup, libfbjs-slow.so file is loaded when it is injected into FBReactInstanceHolder. This initialization takes a while, and has usually been showing up as a blank under `FBReactInstanceHolder`. By adding Systrace and QPL, we can estimate how long this takes. Traces will also be useful as we start optimizing this.
Reviewed By: ejanzer
Differential Revision: D5950803
fbshipit-source-id: 711c1d6c16e0f3d5c2dc23606be4e73880152b17
Summary:
There are multiple reports of the NativeViewHierarchyManager trying to remove a root view with id -1. This can occur because of a race condition caused by calls to startReactApplication + unmountReactApplication.
We unfortunately overload overload the id field of the ReactRootView to store its react tag. This id is typically set when the view is attached to the react instance, and reset to NO_ID right before an attach occurs or when the react context is tearing down. If the react context has already been initialized, attaching the root view is synchronous and the id is set immediately. If the context has not been initialized, we save the root view in a mAttachedRootViews list and wait until setupReactContext (where the context is created) to finish attaching the root views.
There were two issues:
1) In setupReactContext, synchronizing on mReactContextLock is not enough to ensure that the root views in mAttachedRootViews have been initialized already
2) In detachRootView, removing the root view from mAttachedRootViews immediately will cause mAttachedRootViews to be out of sync when it is accessed by the time it is accessed in setupReactContext
To address these, the mReactContextLock will synchronize both the creation of the react context AND the initialization of the root views and detachRootView will synchronize on the mReactContextLock before mutating the mAttachedRootViews list.
Reviewed By: mmmulani
Differential Revision: D12829677
fbshipit-source-id: 3f3b0669e5be2b570c9d534503d04e5d0816196b
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:
Changed gradle repo list to have consistent priority. mavenLocal is top priority because it requires manual setup, also won't conflict with other repos.
Pull Request resolved: https://github.com/facebook/react-native/pull/22041
Differential Revision: D12871549
Pulled By: hramos
fbshipit-source-id: c86730fde956dca77174c6454fdcb005a5eec8a9
Summary:
When we use product flavor (e.g. develop/production) with Android Gradle Plugin 3.2,
javascript bundle is not copied due to that merged asset path point to incorrect location.
related #21408
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.
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!_
-->
Pull Request resolved: https://github.com/facebook/react-native/pull/21782
Differential Revision: D12854056
Pulled By: hramos
fbshipit-source-id: d1e6a395e762cc4a4f133977d54d0f469fa66b8c
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