Commit Graph

115 Commits

Author SHA1 Message Date
Ben Roth 09e7dbc9cb Protect against fatal YellowBox error when stack frame has no file
Summary:
Motivation: When viewing a stack trace in YellowBox where one or more of the stack frames has no `file`, JS will encounter the fatal error `null is not an object (evaluating 'file.split')`. This can happen, for example, when running a bundle for which no source maps were generated.
Closes https://github.com/facebook/react-native/pull/13512

Differential Revision: D4896480

Pulled By: javache

fbshipit-source-id: 202c793a47abb83a4700a5778a92b0b5828b01a3
2017-04-18 09:39:31 -07:00
Spencer Ahrens f72d9dd08b Add option to track when we're showing blankness during fast scrolling
Summary:
If tracking is enabled and the sampling check passes on a scroll or layout event,
we compare the scroll offset to the layout of the rendered items. If the items don't cover
the visible area of the list, we fire an `onFillRateExceeded` call with relevant stats for
logging the event through an analytics pipeline.

The measurement methodology is a little jank because everything is async, but it seems directionally
useful for getting ballpark numbers, catching regressions, and tracking improvements.

Benchmark testing shows a ~2014 MotoX starts hitting the fill rate limit at about 2500 px / sec,
which is pretty fast scrolling.

This also reworks our frame rate stuff so we can use a shared `SceneTracking` thing and track blankness
globally.

Reviewed By: bvaughn

Differential Revision: D4806867

fbshipit-source-id: 119bf177463c8c3aa51fa13d1a9d03b1a96042aa
2017-04-07 01:00:39 -07:00
Spencer Ahrens 7ff18f290b Fix Warning/Yellow Box so it does not mess up app layout when opened.
Reviewed By: fkgozali

Differential Revision: D4808601

fbshipit-source-id: c15a7aa4514ea21798ceabca075189478596e0a2
2017-03-31 18:34:21 -07:00
Brian Vaughn 1129c6096d Replaced View.propTypes with a static getter that warned about deprecation
Reviewed By: spicyj

Differential Revision: D4766860

fbshipit-source-id: c0ef46df58b6167178e801d9dbe481101c0dc773
2017-03-28 11:32:09 -07:00
Brian Vaughn 848593c0f0 Moved takeSnapshot method from UIManager to ReactNative
Reviewed By: spicyj

Differential Revision: D4767428

fbshipit-source-id: 77c80c0135641ab46f9dce2763f27499a96373a0
2017-03-25 00:46:54 -07:00
Spencer Ahrens 27c3e32abf FrameRateLogger JS module
Summary:
This adds a flowified JS module for the FrameRateLogger native module and plugs
it into `ScrollResponder` and `AppRegistry`.

If there is no `FrameRateLogger` native module, then the function calls will be no-ops.

One major limitation is that we can't track animated/programatic scrolls because we don't
have reliable end events. Would be generally useful to add those in a followup though.

Reviewed By: fkgozali

Differential Revision: D4765694

fbshipit-source-id: f3bec771df6ac918200c1afd1a7d8b6da540a4e2
2017-03-24 18:30:59 -07:00
Alexey Lang e22898bcff Refactor measuring app require time
Reviewed By: javache

Differential Revision: D4746020

fbshipit-source-id: cfc9de286feeac49b4b569560dc29c7a1c25eee1
2017-03-22 08:00:27 -07:00
Brian Vaughn 9344f3a95b Support string return type from RN createReactNativeFiberComponentClass()
Reviewed By: sebmarkbage

Differential Revision: D4607283

fbshipit-source-id: 466d2373dd570f77ebcced306d2f20a3f72d79c6
2017-03-20 13:07:06 -07:00
cailenmusselman dd5ac841d2 YellowBox" Only provide elevation style prop when running on Android
Summary:
For unknown reasons, setting elevation: Number.MAX_VALUE causes remote debugging to hang on iOS (some sort of overflow maybe). Setting it to Number.MAX_SAFE_INTEGER fixes the iOS issue, but since elevation is an android-only style property we might as well remove it altogether for iOS.

See: https://github.com/facebook/react-native/issues/12223
Closes https://github.com/facebook/react-native/pull/12744

Differential Revision: D4684524

Pulled By: mkonicek

fbshipit-source-id: 7fb4f6da1c5c0cb437beff0e75122523e7233b72
2017-03-09 15:30:29 -08:00
Douglas Lowder b7e9374c64 Move BackAndroid -> BackHandler, add Apple TV support for back nav
Summary:
Enable back navigation on Apple TV (with the remote's menu button) in code making use of BackAndroid.  The module is renamed to BackHandler.  BackAndroid is still exported to ReactNative for now, until external projects switch to using the new name for the module.  The navigation in https://github.com/react-community/react-navigation makes use of this module.

**Test plan**: Manual testing with an example app (https://github.com/dlowder-salesforce/react-nav-example).
Closes https://github.com/facebook/react-native/pull/12571

Differential Revision: D4665152

Pulled By: ericvicenti

fbshipit-source-id: 925400ce216379267e014457be6f5eedbe4453ec
2017-03-06 21:51:40 -08:00
Martin Konicek a6adc501e8 Add a hint to a very common AppRegistry error
Summary:
**Motivation (why should we merge this?)**

I see the following error very often when working on multiple apps and switching between them. In fact, switching between apps is the only reason why I ever saw the error. However, the error message is very unhelpful:

![screenshot 2017-02-22 16 15 29](https://cloud.githubusercontent.com/assets/346214/23221214/5f6bc7ba-f91c-11e6-9482-9183c27c5e9d.png)

**Test plan (required)**

![screenshot 2017-02-22 19 44 54](https://cloud.githubusercontent.com/assets/346214/23229247/830f7142-f937-11e6-9657-bad83563f3b0.png)
Closes https://github.com/facebook/react-native/pull/12517

Differential Revision: D4600082

Pulled By: mkonicek

fbshipit-source-id: 011c71dbac9e294348fd06c8e6d651228fac3288
2017-02-22 14:16:06 -08:00
Aaron Chiu 1fa95ed390 inline a bunch of NativeModule requires
Reviewed By: shergin

Differential Revision: D4578180

fbshipit-source-id: 3764ffd32eb7e4698e928740bc72bbad02876894
2017-02-17 16:49:38 -08:00
Kevin Gozali 222856ea3a expose types off AppRegistry and do custom handling
Reviewed By: shergin

Differential Revision: D4557948

fbshipit-source-id: 439e486d1ef9e29c81cabf608943f7c62098a14b
2017-02-15 02:17:17 -08:00
Kevin Gozali a86559ffb5 expose AppRegistry.getRegistry() for app specific handling
Summary: Add simple `getRegistry()` so that add can do some custom handling of the registered components, if appropriate.

Reviewed By: shergin

Differential Revision: D4550600

fbshipit-source-id: 367c66b9fddfe4cc81cbc32a7a6043215e0df666
2017-02-14 15:33:15 -08:00
Kevin Gozali c7c3e4c5d8 modernize AppRegistry.js and introduce app-specific 'sections'
Summary:
Simple cleanup for AppRegistry.

Also added `registerSection()` helper to mark registered components as app-specific sections. Sections can be treated in many custom ways, e.g. they could just indicate the top level tabs, or something else. A bunch of helpers are also added.

Reviewed By: yungsters

Differential Revision: D4542788

fbshipit-source-id: 07addecb78a7514e973335bca24414fd8db40997
2017-02-10 12:56:08 -08:00
Kevin Gozali 3ca719072f RN: Fix YellowBox Layout Bug
Summary:
Looks like a recent change in Yoga causes the height of an absolutely positioned fullscreen view to break.

This works around the issue by using the newly introduced percentage `height` instead.

Reviewed By: jingc

Differential Revision: D4530240

fbshipit-source-id: 86d758576c6984686f30d7504e11f9ec3ce469bd
2017-02-08 19:17:08 -08:00
rh389 7a4166c31d Deal with 0.38 'FlowFixMe's
Summary:
Largely typing fixes to deal with the glut of new `FlowFixMe` suppressions introduced with flow 0.38 in a4bfac907e

Tested with flow itself. CC gabelevi
Closes https://github.com/facebook/react-native/pull/11985

Differential Revision: D4452045

Pulled By: ericvicenti

fbshipit-source-id: acc46c4c406ae706a679e396be1d40ae2f4ce5a1
2017-01-31 13:13:32 -08:00
Valentin Shergin 64041669ee The warning 'cannot calculate shadow efficiently' is not a warning anymore
Reviewed By: fkgozali, yungsters

Differential Revision: D4445304

fbshipit-source-id: 3a37150ae2beaf44b505dc36b575b7d44619e071
2017-01-25 12:28:50 -08:00
Pieter De Baets 7412340175 Fix passThroughTouches
Reviewed By: mmmulani

Differential Revision: D4438390

fbshipit-source-id: 4e1ec4eaf80ffb48ac7b65ed092402c51d9227d3
2017-01-23 11:28:51 -08:00
Aaron Chiu 5e9db574ee access view managers as Native Modules
Reviewed By: achen1

Differential Revision: D4338782

fbshipit-source-id: 1573e45ee3af5a44d033a166424e556b2c091fb6
2017-01-20 15:58:27 -08:00
Gabe Levi e2ce98b7c6 Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Mehdi Mulani 81c33b542d Switch out DISABLE_YELLOW_BOX for IS_TESTING
Summary: Switch to using IS_TESTING on the Platform module. While IS_TESTING has to be explicitly set in the test harness, this makes it more usable and stops people from relying on brittle variables in the (larger) environment.

Reviewed By: fkgozali

Differential Revision: D4423661

fbshipit-source-id: 27a80867778b9374bcba67b69f9c93d32c0a74b0
2017-01-18 12:28:42 -08:00
Gabe Levi a4bfac907e Deploy v0.38.0
Reviewed By: jeffmo

Differential Revision: D4428858

fbshipit-source-id: 10dc69349a2b563e1fa444a8b0612e3b2d4ccd1c
2017-01-18 11:13:30 -08:00
Sokovikov 8159b2cd2a return stacktrace button in yellow box
Summary:
**motivation**

return button which shows stacktrace in yellow box.

**Test plan (required)**

<img src="https://cloud.githubusercontent.com/assets/1488195/21954896/fd3b0078-da77-11e6-8eeb-e6fe16ad9939.png" width="300"/>
Closes https://github.com/facebook/react-native/pull/11908

Differential Revision: D4424824

Pulled By: mmmulani

fbshipit-source-id: db4b33423fd839216286adb40a65417949c0073a
2017-01-17 17:43:28 -08:00
Mehdi Mulani 49d7c00500 Disable yellow box warnings based on environment variable
Summary:
This adds a hook to let you disable yellow box warnings. It's useful for native engineers who don't want to mess with JS but also for CI/testing, where the app operates mostly as a blackbox.

Depends on D4395091

Reviewed By: achen1

Differential Revision: D4395552

fbshipit-source-id: 4c3a9676caa975c537d1a4711d60aab2f404db15
2017-01-13 12:28:31 -08:00
cailenmusselman 407973ab27 Fix z-index of YellowBox
Summary:
In Android, components using an elevation > 0 are able to hide the YellowBox. Especially bad when they happen to hide the dismiss button of the inspector.
Closes https://github.com/facebook/react-native/pull/11777

Differential Revision: D4392027

Pulled By: ericvicenti

fbshipit-source-id: 96ab98520cd54b9bb683d984f9990bf0e90b9a37
2017-01-09 00:28:37 -08:00
Spencer Ahrens 3b5f04b002 Revert D4385443: [RCT/AppContainer] Don't capture touches
Differential Revision: D4385443

fbshipit-source-id: 87f4c0a19ddf02fb02472de91000cfc5c93bcb52
2017-01-07 16:28:29 -08:00
Sean Kinsey 3d1bdcc2e3 Don't capture touches
Summary:
RCTRootView supports a property `passThroughTouches` which when set, allows
touches to propagate to sibling views. To allow touches to reach RCTRootView,
we also need to set `pointerEvents` on the RCTViews wrapping the child views.

Reviewed By: javache

Differential Revision: D4385443

fbshipit-source-id: 6291d8614870168f1c4cdf0ef5ff6e42e4a8ef63
2017-01-06 18:58:30 -08:00
pedramsaleh 20938ae88c Fixed typo in docs.
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/11459

Differential Revision: D4339946

Pulled By: lacker

fbshipit-source-id: d95e7c62dbf7bf6fd2ab3739b3d64bfcbe83e24a
2016-12-16 10:28:34 -08:00
Janic Duplessis 552c601921 Don't dismiss keyboard when tapping another text input
Summary:
When using text inputs inside a ScrollView with `keyboardShouldPersistTaps=false` (default behavior) tapping another text input dismisses the keyboard instead of keeping it open and focusing the new text input which I think is the better and expected behavior.

See #10628 for more discussion about that. Note that this affects nothing but the behavior with text inputs unlike #10628.

cc satya164 MaxLap ericvicenti
Closes https://github.com/facebook/react-native/pull/10887

Differential Revision: D4178474

Pulled By: ericvicenti

fbshipit-source-id: 0c62ea2fac0017d559d1f8674b0a686a5e1b3d2d
2016-11-25 05:43:30 -08:00
Kevin Gozali 4530da87e2 make Modal pass rootTag to AppContainer
Summary:
Following up on fb7fe2d4e8: when <Modal> is used in dev mode, it renders `<AppContainer>` to wrap the children so that the element inspector can show up correctly. In that scenario, we need pass the `rootTag` over the `<AppContainer>` so that the children can read the rootTag correctly. Otherwise, the children of <Modal> will see it as undefined.

With this, AppContainer can then declare `rootTag` as a required prop, as it should have been.

Note that this only affects DEV build because there's no AppContainer wrapping otherwise.

Reviewed By: jingc

Differential Revision: D4204011

fbshipit-source-id: 80edbc8d351d983786e6fc3c68dfa65a71b1ed3c
2016-11-18 01:43:26 -08:00
Gabe Levi 61d1a4fb39 Deploy v0.35.0
Reviewed By: davidaurelio

Differential Revision: D4177391

fbshipit-source-id: c02cf98ed275b7032103b11eab6d0e189f8d8f24
2016-11-14 20:45:17 -08:00
Jeff Morrison bd3be5bd24 Update fbsource
Reviewed By: zertosh

Differential Revision: D4111832

fbshipit-source-id: 301969a1c828fb87e7e09c1eea3cd44799b89509
2016-11-08 12:43:48 -08:00
Kevin Gozali fb7fe2d4e8 modernize AppContainer and add rootTag in the child context
Summary:
This does 2 things:
- modernize the component to use ES6 + flow
- assign `rootTag` to the child context

Each view in RN has its own `reactTag`. The reactTag for a root view is called `rootTag`. When there are multiple react root views active within the app (e.g. in a hybrid environment), rootTag is the only reliable "label" to differentiate them. This is especially useful when we want to limit an event/activity on a particular root view, instead of affecting all active root views. This allows components to do:

```
class Foo extends React.Component {
  static contextTypes = {
    rootTag: React.PropTypes.number,
  };

  componentDidMount() {
    // Get the root tag of this component, which is static for all components under the same root view
    console.log(this.context.rootTag);
  }
}
```

In a pure JS RN app environment, there will always be exactly 1 root view, so `rootTag` may usually be ignored.

Reviewed By: yungsters

Differential Revision: D4130376

fbshipit-source-id: 559b67615f487bad754b5832ad4a02bcef05be2a
2016-11-06 20:58:34 -08:00
David Aurelio 3683beb88a RN: Update React (2/2)
Reviewed By: kentaromiura

Differential Revision: D4026114

fbshipit-source-id: 67808af91454d95941fea01eef58a4d9086f46e1
2016-11-04 05:43:44 -07:00
Pieter De Baets 19ab84ffb7 Cleanup and simplify view config generation
Reviewed By: fkgozali

Differential Revision: D4083308

fbshipit-source-id: 42ca797a8faede68bd031e84cf1c33a3e3ade37f
2016-10-27 06:58:52 -07:00
Konstantin Raev 6ea26c01de Reverted commit D4027388
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 8e3341b6f393ccf432c1a4e22a7cbf422284a06f
2016-10-16 04:13:42 -07:00
Jan Kassens e58d17e68b React.Element<any> » React.Element<*>
Reviewed By: yungsters

Differential Revision: D4027388

fbshipit-source-id: 5bc178eab1ab72283622b4b7d418f9fd43ec0792
2016-10-15 17:58:38 -07:00
Tim Yung 331c13d4dc RN: Require {react/lib/ => }ReactNative
Reviewed By: sebmarkbage

Differential Revision: D4024375

fbshipit-source-id: cd2226a3580a7a4ff319d6a93b67b68f2942eb00
2016-10-14 18:59:10 -07:00
Tim Yung b77b760810 RN: Fix Remaining ReactElement References
Summary: Fixes remaining references to `ReactElement` that did not already have `React` in scope.

Reviewed By: bestander, vjeux

Differential Revision: D4022022

fbshipit-source-id: 4aeacee0cdbb2c825feba10282208316d064c578
2016-10-14 10:45:11 -07:00
Pieter De Baets 292cc82d0e Reorganize core JS files
Reviewed By: lexs

Differential Revision: D3987463

fbshipit-source-id: fa8f1d1bea7ed699120b9705ddc1c83767fcf8e4
2016-10-11 10:14:28 -07:00
Sebastian Markbage 47a470a97c Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
Sebastian Markbage a7c8111605 Prefix warning module with fbjs/lib/
Summary:This works internally at FB but not here because mixed mode requires are mandatory. At FB www, only the providesModule version works. In React Core, we only use the providesModule name. I have to remember to change these back again when I do the move so that we can unify. 0f3bd02d0f

We really should pick a single convention per project. In React Core, we translate it in the package/build step to whatever output convention is needed.
Closes https://github.com/facebook/react-native/pull/6891

Differential Revision: D3160811

Pulled By: vjeux

fb-gh-sync-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
fbshipit-source-id: daf1f5e1cfae2a7c33cca88139fb5391d25bfe3e
2016-04-09 13:24:28 -07:00
Sebastian Markbage 2eafcd45db Add deprecation warnings for split of the react and react-native packages
Summary:This adds deprecation warnings that correspond to what React 0.14 did for the web.

I.e. `React.render` -> `ReactNative.render` but also `ReactNative.createClass` -> `React.createClass`.

This hopefully means that it will become easier and more idiomatic to write components that are decoupled from the react-native package.

It will be clear when you take on react-native as a dependency such as when using findNodeHandle.

This codemod is a little more invasive for React Native because the common stuff often used the `react-native` package. For web only the uncommon stuff needed to move.

Reviewed By: spicyj

Differential Revision: D3148860

fb-gh-sync-id: d87628d2089a2e012ad6ad50dd0a20ccec5e6c45
fbshipit-source-id: d87628d2089a2e012ad6ad50dd0a20ccec5e6c45
2016-04-09 04:18:25 -07:00
Paul O’Shannessy cb5d37713f Remove use of Object.assign module
Summary:I'm [getting rid of it from React](https://github.com/facebook/react/pull/6376) and so I'd like to get this in before we accidentally break RN. There are a bunch of other uses of Object.assign directly so this should be perfectly safe.
Closes https://github.com/facebook/react-native/pull/6766

Differential Revision: D3128135

Pulled By: vjeux

fb-gh-sync-id: 675913ba457abcd8c194facb9ff58255c9dceda5
fbshipit-source-id: 675913ba457abcd8c194facb9ff58255c9dceda5
2016-04-01 13:50:22 -07:00
Sebastian Markbage 433fb336af Refactor Attribute Processing (Step 4)
Summary:This avoids flattening styles in most common cases. It diffs against the nested
arrays. The special case is when a property gets removed, it creates an object
that stores the removed keys which then gets resolved using a second pass
through the nested array.

You can conceptually think of this algorithm as:
1) Diff and store changes as you go
2) If something was removed, flatten as necessary

I also merged in another commit that renames the StyleSheetRegistry to ReactNativePropRegistry. There is nothing in here that makes it specific to styles anymore. That's just a decoupled view attribute configuration option. This registry can be used for any set of nested props, if we even want to keep this feature at all.

Reviewed By: vjeux

Differential Revision: D2492885

fb-gh-sync-id: c976ac28b7e63545132c36da0ee0c1c562e7c9e5
shipit-source-id: c976ac28b7e63545132c36da0ee0c1c562e7c9e5
2016-03-24 15:13:24 -07:00
Jeff Morrison b473d496c4 Update FBSource to use Flow 0.22
Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
2016-03-08 12:39:29 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Matthew Dapena-Tretter ecf6981093 Only freeze valid attributes in `mountComponent`
Reviewed By: spicyj

Differential Revision: D2939910

fb-gh-sync-id: 2efe6ecd6d888d4185a8cc74ba9adbe7c68bcd3b
shipit-source-id: 2efe6ecd6d888d4185a8cc74ba9adbe7c68bcd3b
2016-02-16 13:58:33 -08:00
Matthew Dapena-Tretter bb3d8d5350 Ensure recursion is terminated on objects with cyclical references
Reviewed By: spicyj

Differential Revision: D2922542

fb-gh-sync-id: 3820569027a5906ff844f1cda5e2e65c2692e235
shipit-source-id: 3820569027a5906ff844f1cda5e2e65c2692e235
2016-02-12 14:56:00 -08:00