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
Summary:
@public
If you call NetInfo.getCurrentConnectivity multiple times in succession, we'll create a bunch of callbacks but lose them in the ether.
With this fix, we'll unschedule them before creating a new one, which should resolve some crashes we're seeing.
Reviewed By: PeteTheHeat
Differential Revision: D10409486
fbshipit-source-id: 6065b09fa626f7f06aed9bf0e278c0a6a6169f58
Summary: The only thing extra that we need to do is to include `JavaScriptCore.framework` inside the HelloWorld.xcodeproj file.
Reviewed By: hramos
Differential Revision: D9893035
fbshipit-source-id: 2a29d1fd645eafa2e09109ad14d09f812dfa2601
Summary:
This PR introduces a new helper function called `setAndForwardRef`. It is intended to help with moving components that depend on `NativeMethodsMixin` off of `createReactClass`.
It allows for classes that depend on having a ref to a native component to be able to also forward the native component ref to user code.
Usage is like this:
```js
class MyView extends React.Component {
_nativeRef = null;
_setNativeRef = setAndForwardRef({
getForwardedRef: () => this.props.forwardedRef,
setLocalRef: ref => {
this._nativeRef = ref;
},
});
render() {
return <View ref={this._setNativeRef} />;
}
}
const MyViewWithRef = React.forwardRef((props, ref) => (
<MyView {...props} forwardedRef={ref} />
));
module.exports = MyViewWithRef;
```
Pull Request resolved: https://github.com/facebook/react-native/pull/21823
Differential Revision: D10436673
Pulled By: TheSavior
fbshipit-source-id: 32e167bb3ea3234f08d5715168b0e61e4e035a7c
Summary:
1. The user inserts a character ('0') at index 0. Because the range matches 0, 0, predictedText is set to that character that was inserted.
2. In textInputDidChange, it discovers a mismatch between the rendered text ('1234') and predicted text ('0')
3. This triggers textInputShouldChangeTextInRange to be called again with the 'new' text that it thinks was just added ('1234')
4. It goes to insert this text, but runs into the maxLength limit, so it gets truncated and then inserted.
(I'm not totally sure why only happens if maxLength is set - I need to look into that.)
One fix for this is to just get rid of the range check, but that'll regress #18374. I decided to just check and see if the rendered text is empty instead of checking the range where text could be inserted, since that seems like it should properly handle both cases.
Reviewed By: shergin
Differential Revision: D10392176
fbshipit-source-id: 84fb3b6cac9b0aa25b3c1a127d43f9cdc5a1c6a8
Summary:
Related to https://github.com/facebook/react-native/pull/21488
Disclaimer: I made this PR.
I think there's some requestAnimationFrame events that are not cleared on unmount because of bad use of `splice` method.
- All flow tests succeed.
- RNTester: iOS (this change should only affect iOS because calculateChildFrames is iOS only)
Show perf monitor, show ListView* screen, start scrolling. UI frame Rate is used at the beginning. When scrolling there is no drop in FPS rate.
- TODO: I'll write a load test for ListView
[GENERAL] [ENHANCEMENT] [ListView.js] - rm TimerMixin
Pull Request resolved: https://github.com/facebook/react-native/pull/21802
Differential Revision: D10391812
Pulled By: RSNara
fbshipit-source-id: 49f0b0a4641ec29bcb4cc04bd3bafb42b3842b69
Summary: Currently the pull to refresh icon on browse feed is super cut off on Android. Expose the progressViewOffset prop from FBPullToRefresh to support offsetting the PTR component to make the component more visible.
Reviewed By: yungsters
Differential Revision: D10274679
fbshipit-source-id: 1735c4d2d98523ccc3d1ec3733465028ae33df7b
Summary:
This PR converts `ProgressViewIOS` from a `createReactClass` component to a functional component, and removes the remaining proptypes. Its use of `NativeMethodsMixin` has been ported to a `forwardRef` to the native component.
Pull Request resolved: https://github.com/facebook/react-native/pull/21588
Reviewed By: hramos
Differential Revision: D10338888
Pulled By: RSNara
fbshipit-source-id: c49807e97a0e2cf774971d9aa5a8426f15a3e48d
Summary:
@public
The Chrome debugger can't handle synchronous method calls, so we should avoid doing them.
Double wrapped the if with a DEV check so that it's removed when bundling in non-dev mode.
Reviewed By: fkgozali
Differential Revision: D10345056
fbshipit-source-id: 7a7a2c73f089693da5edafdf3ecf7a3e5d767e52
Summary: This change updates the comments and warning to match the function name.
Reviewed By: achen1
Differential Revision: D10345724
fbshipit-source-id: 05b1c60703da97ed083d7de492559bafb46ad813
Summary: There are no longer any callsites to this in React Native so we can remove it from the repo!
Reviewed By: RSNara
Differential Revision: D10316313
fbshipit-source-id: bd63c823c56bb1914e4249d972e0ce503aa189f8
Summary:
`legacyImplementation` has caused a warning in FlatList for a long time. FlatList supports the use cases of the legacy implementation and should be adopted.
We will be removing the deprecated MetroListView and ListView components to reduce bundle sizes and the complexity of the codebase.
Reviewed By: yungsters
Differential Revision: D10245824
fbshipit-source-id: 60ff0d54974649b57bac9f9f29b769f34ca2701c
Summary: This component has long been deprecated in the docs. Adding a warning to the code.
Reviewed By: sahrens
Differential Revision: D10261155
fbshipit-source-id: 462ce30a97f35e52477cfc135fb50c976b56e9cb
Summary:
This adds a synchronous method that JS can call to load view managers.
Notably, we don't have an exact way to go from a JS name to the native view manager, so this naively adds 'Manager' to the end.
After lazily loading the view, it makes sure to cache all its values in native and JS, as further calls from JS will fail.
Reviewed By: PeteTheHeat
Differential Revision: D10204314
fbshipit-source-id: ebf42a85dcc467f3b4c5d6e18e49e04f9e8aa4f9
Summary:
Updated Button component inspiration. Refactored code takes advantage of Platform Specific Code, as we want to re-use as much code as possible.
1. Import Button component
2. Button should work the same
https://github.com/facebook/react-native/pull/19752
[GENERAL] [ENHANCEMENT] [Button] - Uses spread operator for platform specific code in creating styles
Pull Request resolved: https://github.com/facebook/react-native/pull/21535
Differential Revision: D10248048
Pulled By: TheSavior
fbshipit-source-id: 7260fa56f15b70b7c9499c8da418db7b2214b0dd
Summary:
Related to #21485.
Removed TimerMixin from the SwipeableRow component since it is currently not used.
Added a test case for `SwipeableRow` animation in the `SwipeableListViewSimpleExample`, by adding the `bounceFirstRowOnMount` prop, to check for any runtime issues with the setTimeout method.
- [x] `npm run prettier`
- [x] `npm run flow-check-ios`
- [x] `npm run flow-check-android`
- [x] runtime tests using `SwipeableFlatListExample` on Android and iOS
- [x] runtime tests using `SwipeableListViewSimpleExample` on Android and iOS
**RNTester steps**
- [x] Run RNTester.
- [x] Navigate to `SwipeableFlatListExample` and check if the `_animateBounceBack` animation executes when the `shouldBounceOnMount` props is passed.
- [x] Swipe the row and check if the events ran correctly
- [x] Navigate to `SwipeableListViewSimpleExample` and check if the `_animateBounceBack` animation executes when the `shouldBounceOnMount` props is passed.
- [x] Swipe the row and check if the events ran correctly
[GENERAL] [ENHANCEMENT] [Libraries/Experimental/SwipeableRow/SwipeableRow.js] - remove TimerMixin dependency
[GENERAL] [ENHANCEMENT] [RNTester/js/SwipeableListViewSimpleExample.js] - Add bounceFirstRowOnMount to guarantee the SwipeableRow correct behavior.
Pull Request resolved: https://github.com/facebook/react-native/pull/21499
Reviewed By: TheSavior
Differential Revision: D10218361
Pulled By: RSNara
fbshipit-source-id: c8e6d5ced4c1237e48bb4c43592016684b2c6360
Summary: Also add an optional timestamp param to PerformanceLogger.markPoint() so you can backdate a point
Reviewed By: alexeylang
Differential Revision: D10149337
fbshipit-source-id: 6cc5f95b34b3293589e7cb41b99cee17bf128163
Summary:
This test is disabled internally and flaky in open source causing CI to fail. Skipping it for now.
Related to: https://github.com/facebook/react-native/issues/21517
Reviewed By: RSNara
Differential Revision: D10223498
fbshipit-source-id: 37a3798c0abb7de829bc5b59e02f23d8943da882
Summary:
Related to #21485.
Removed `TimerMixin` from the `TouchableWithoutFeedback` component since it is currently not used.
Added tests cases for `TouchableWithoutFeedback` to check for any runtime issues.
Pull Request resolved: https://github.com/facebook/react-native/pull/21493
Differential Revision: D10219098
Pulled By: RSNara
fbshipit-source-id: d9517b2bd5b72b0450fa864f3556673ae3181552
Summary:
Related to #21485
- Remove TimerMixin from ListView
- All flow tests succeed.
- RNTester: <ListView> iOS (this change should only affect iOS because calculateChildFrames is iOS only)
Show perf monitor, show ListView* screen, start scrolling. UI frame Rate is used at the beginning. When scrolling there is no drop in FPS rate.
TODO: I think a load test would be more relevant:
- Update props multiple times and scroll
[GENERAL] [ENHANCEMENT] [ListView.js] - rm TimerMixin
Pull Request resolved: https://github.com/facebook/react-native/pull/21488
Differential Revision: D10219088
Pulled By: RSNara
fbshipit-source-id: 946e4fc1319324c5bf4947a2060b18bebb6fc493
Summary: The legacy implementation doesn't provide additional functionality and has a negative impact on performance and user experience. The legacyImplementation prop is deprecated and will be removed in a future release.
Reviewed By: yungsters
Differential Revision: D10212762
fbshipit-source-id: 9b3416434ba392827b538c984c7ab4bcbe156e60
Summary:
This PR splits and renames all references of ViewAccessibility to DeprecatedViewAccessibility
Related to #21342
Pull Request resolved: https://github.com/facebook/react-native/pull/21422
Reviewed By: yungsters
Differential Revision: D10132659
Pulled By: RSNara
fbshipit-source-id: 68c371230c69ed37c3e44bf8a36043adb04afc78