Commit Graph

162 Commits

Author SHA1 Message Date
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
Andrei Coman 6b63afb097 Add invariant for null root ids
Reviewed By: astreet

Differential Revision: D2911414

fb-gh-sync-id: 7d7a4144765e093de18b442f7304693556fdfc2f
2016-02-08 09:16:56 -08:00
Arjun Balaji 7cbad9f530 Add Children.toArray to ReactNative
Summary:
To fix #5769. I believe `ReactNative.Children.toArray` should be accessible now.
Closes https://github.com/facebook/react-native/pull/5780

Reviewed By: svcscm

Differential Revision: D2907876

Pulled By: spicyj

fb-gh-sync-id: 649908843f535a89909425bcdcbc58461854779b
2016-02-05 16:59:09 -08:00
Gabe Levi ca17ed3b50 Deploy v0.20.1
Reviewed By: mroch

Differential Revision: D2775901

fb-gh-sync-id: ef4fa402a930e4b5c82513dc5cc05553fa539116
2015-12-18 17:04:29 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Nick Lockwood 9f48c004ba Added setChildren() function
Summary:
public
Most of the time - especially during app startup - when we call UIManager.manageChildren(), we are actually just adding the first set of children to a newly created view.

This case is already optimized for in the JS code, by memoizing index arrays at various sizes, but this is not especially efficient since it is still sending an array of indices with each call that could be easily inferred on the native side instead.

I've added a hybrid native/JS optimization that improves the performance for this case. It's not a huge win in terms of time saved, but benchmarks show improvements in the ~1% range for several of the app startup metrics.

Reviewed By: tadeuzagallo

Differential Revision: D2757388

fb-gh-sync-id: 74f0cdbba93af2c04d69b192a8c2cc5cf429fa09
2015-12-15 06:56:31 -08:00
Dan Witte 70f0dfc0e6 revert D2707930
Reviewed By: fkgozali

Differential Revision: D2720828

fb-gh-sync-id: 53113fb33150b42a7b597a7dfd04bb9885def029
2015-12-03 18:29:28 -08:00
Nick Lockwood 9a47ca1cc9 Added addChildren() function as a more-optimal replacement for manageChildren for common use cases.
Reviewed By: jspahrsummers

Differential Revision: D2707930

fb-gh-sync-id: c44219bf9af943cad5b57f370656c1bcac732cd9
2015-12-03 11:34:27 -08:00
Huang Yu da0744892c fix Library/ReactNative lint warnings
Summary: fix 2 lint warnings under `Libraries/ReactNative` directory
Closes https://github.com/facebook/react-native/pull/4446

Reviewed By: svcscm

Differential Revision: D2705429

Pulled By: nicklockwood

fb-gh-sync-id: a7318ef9d1d194f077b0879fd041c42da5b2dec3
2015-11-30 16:25:46 -08:00
Nick Lockwood 60db876f66 Wrapped UIManager native module for better abstraction
Summary: public

RCTUIManager is a public module with several useful methods, however, unlike most such modules, it does not have a JS wrapper that would allow it to be required directly.

Besides making it more cumbersome to use, this also makes it impossible to modify the UIManager API, or smooth over differences between platforms in the JS layer without breaking all of the call sites.

This diff adds a simple JS wrapper file for the UIManager module to make it easier to work with.

Reviewed By: tadeuzagallo

Differential Revision: D2700348

fb-gh-sync-id: dd9030eface100b1baf756da11bae355dc0f266f
2015-11-27 07:00:32 -08:00
Andy Street a636ddd9f0 Backout D2677289 [react_native] View recycling in JS
Summary: public

We're seeing related crashes. The diff has no tests, the perf tests weren't conclusive, and the person who'd be supporting it no longer is available to work on it. We can try this again later in a less rushed manner with proper perf testing.

Reviewed By: davidaurelio

Differential Revision: D2696615

fb-gh-sync-id: 3b6814ac12af19516146d5c42d2add8321b10db5
2015-11-26 08:41:27 -08:00
Pieter De Baets bb11e05c33 Default empty view to RCTView with position: absolute
Reviewed By: spicyj, davidaurelio

Differential Revision: D2693494

fb-gh-sync-id: fc00b995d7d4fdaaedf4c3e5382354f0a1f4ac23
2015-11-26 08:12:28 -08:00
Pieter De Baets bba71f146d Defer rendering events popover until required
Reviewed By: davidaurelio

Differential Revision: D2690835

fb-gh-sync-id: 1d17c20b308e364c49f868d8861c6ad93957bffe
2015-11-25 04:15:27 -08:00
Martin Konicek 155a609781 Unbreak tests
Summary: The recent commits for RecyclerViewBackedScrollView introduced a bunch of Flow errors.

Disable Flow for now in `ReactNativeViewPool` as it looks like that file doesn't use Flow :)

public

Reviewed By: gabelevi

Differential Revision: D2679974

fb-gh-sync-id: 71512f403e3fa271f6c0fa1a64e877ca1750f675
2015-11-20 09:53:28 -08:00
Krzysztof Magiera 205a35ad37 View recycling in JS.
Summary: public
Native view recycling implementation based on limited pools of views.

In this diff I introduced new UIManager method: dropViews. Instead of removing views from tag->view maps when they are detached we keep them there until we get a call to dropViews with the appropriate tag. JS may keep a pool of object and selectively decide not to enqueue drop for certain views. Then instead of removing those views it may decide to reuse tag that has been previously allocated for a view that is no longer in use.

Special handling is required for layout-only nodes as they only can transition from layout-only to non-layout-only (reverse transition hasn't been implemented). Because of that we'd loose benefits of view flattening if we decide to recycle existing non-layout-only view as a layout-only one.

This diff provides only a simple and manual method for configuring pools by calling `ReactNativeViewPool.configure` with a dict from native view name to the view count. Note that we may not want recycle all the views (e.g. when we render mapview we don't want to keep it in memory after it's detached)

Reviewed By: davidaurelio

Differential Revision: D2677289

fb-gh-sync-id: 29f44ce5b01db3ec353522af051b6a50924614a2
2015-11-20 08:11:36 -08:00
Ben Alpert 2db10e3e72 Fix open source
Summary: Unfortunately ReactTestUtils requires ReactDOM (for renderIntoDocument), and ReactTestUtils is required by ReactNative. This worked internally because we already shimmed ReactDOM for Relay; now we shim it externally too, at least until we figure out a better solution for this in React.

public

Reviewed By: vjeux

Differential Revision: D2629811

fb-gh-sync-id: 94aac2c4eda39d039fdcedd88295e7afb0f5c5b2
2015-11-07 11:41:20 -08:00
Ben Alpert bbee3c6f60 Update core libraries for React 0.14 final
Summary: All minor changes since we were already on the beta: most notable is that destructors are required in pooling to help prevent memory leaks.

public

Reviewed By: sebmarkbage

Differential Revision: D2608692

fb-gh-sync-id: acdad38768f7f48c0f0e7e44cbff6f0db316f4ca
2015-11-06 19:52:34 -08:00
Spencer Ahrens 99158f0d5a Better error message for RawText outside <Text>
Summary: public

Native iOS has a good error message, but it's in native which makes
things a little harder to track down (can't use Chrome debugger as easily).

Android has no special handling, so a cryptic "Trying to add unknown view tag..."
redbox would come up.

This puts the error handling in JS so it's shared on all platforms and can be
debugged more easily in Chrome.

Reviewed By: vjeux

Differential Revision: D2606064

fb-gh-sync-id: 5295a44a028c7be79d60dbaf0b5d59fd0a56fdde
2015-11-02 10:51:44 -08:00
Bhuwan Khattar 47b124436f require InitializeJavaScriptAppEngine in bundle
Reviewed By: martinbigio

Differential Revision: D2582794

fb-gh-sync-id: d6cfdda81f556ef0cefb2e9dc58f5978b651bd5b
2015-10-28 21:09:24 -07:00
James Ide 6ec4d65aec Set up the RN JS environment before requiring other modules
Summary: Set up the polyfills for console and process before initializing other modules. Some modules do work (e.g. call `invariant`) when they are first required, so requiring the DefaultInjection module at the beginning ensures we have a consistent JS environment.
Closes https://github.com/facebook/react-native/pull/3526

Reviewed By: spicyj

Differential Revision: D2560340

Pulled By: frantic

fb-gh-sync-id: 44c743e3212ff1dcdbe0169041dfd3ea8f1a54f7
2015-10-22 15:48:28 -07:00
Sebastian Markbage 17da325bb4 Add List of Common Cases to AttributePayload Benchmark
Summary: The most common cases is either that nothing changed or that only one part of
an array changed.

@​public

Reviewed By: @spicyj

Differential Revision: D2516385

fb-gh-sync-id: 0cd09b95ebac37ee1b575025d23ae2f2e6e2fb47
2015-10-09 14:31:23 -07:00
Sebastian Markbage 6244fd003d Refactor Attribute Processing (Step 3)
Reviewed By: @spicyj

Differential Revision: D2514193

fb-gh-sync-id: 8ba55014e8d052c69d8e1def327284ec974d6837
2015-10-06 15:36:32 -07:00
Felix Oghina 8f7748748e Revert [React Native] Refactor Attribute Processing (Step 3)
Reviewed By: @kmagiera, @mikearmstrong001

Differential Revision: D2512548

fb-gh-sync-id: bcae3a8c85bfcfa468f2128288a25f406d78cf08
2015-10-06 10:29:18 -07:00
Sebastian Markbage ac5b7548d2 Refactor Attribute Processing (Step 3)
Summary: Decouple processStyle from the main reconciliation. It is now a process
extension to the style attribute `transform`. This effectively decouples a
large portion of special cases and helper dependencies from the reconciler.

The transform attribute becomes translated into the transformMatrix attribute on
the native side so this becomes a little weird in that I have to special case
it. I don't think it is worth while having a general solution for this so I
intend to rename the native attribute to `transform` and just have it accept the
resolved transform. Then I can remove the special cases.

The next step is generalizing the flattenStyle function and optimizing it.

@​public

Reviewed By: @vjeux

Differential Revision: D2460465

fb-gh-sync-id: 243e7fd77d282b401bc2c028aec8d57f24522a8e
2015-10-06 10:28:41 -07:00
Sebastian Markbage 8e3ce0ff98 Refactor Attribute Processing (Step 2)
Summary: Move the ViewAttributes and StyleAttributes configuration into the
Components library since they're coupled and change with the
native component configuration.

This also decouples StyleAttributes from the reconciler by adding it
to the ReactViewAttributes.

To do that, I refactored the property diffing to allow for recursive
configurations. Now an attribute configuration can be a nested object,
a custom configuration (diff/process) or true.

The requireNativeComponent path incorrectly gets its attributes set up
on the root validAttributes instead of the nested style object.
So I also have to add the nested form. Effectively these currently allow
these attributes on props or nested.

@​public

Reviewed By: @vjeux

Differential Revision: D2456842

fb-gh-sync-id: cd5405bd8316c2fcb016d06c61244ce7719c26c0
2015-10-06 10:28:35 -07:00
Sebastian Markbage 6c5024ec58 Refactor Attribute Processing (Step 1)
Summary: Concolidate the creation of the "update payload" into
ReactNativeAttributePayload which now has a create
and a diff version. The create version can be used by
both mountComponent and setNativeProps. This means that
diffRawProperties moves into ReactNativeAttributePayload.

Instead of storing previousFlattenedStyle as memoized
state in the component tree, I recalculate it every
time. This allows better use of the generational GC.
However, it is still probably a fairly expensive
technique so I will follow it up with a diff that
walks both nested array trees to do the diffing in a
follow up.

This is the first diff of several steps.

@​public

Reviewed By: @vjeux

Differential Revision: D2440644

fb-gh-sync-id: 1d0da4f6e2bf716f33e119df947c044abb918471
2015-10-06 10:28:27 -07:00
Madelaine Boyd 62e8ddc205 Revert g90f63f5c6fbbadd3ce6486e65d6fe6f967f56db6: [RN] add allTime vs. perBatch UIManager stats
fb-gh-sync-id: cef98420bcb8e708196bd5e162fa5dc4003b4fa2
2015-10-05 17:34:23 -07:00
Spencer Ahrens 340229303f add allTime vs. perBatch UIManager stats
Summary: @​public

UIManagerStatTracker now provides allTime and perBatch stats so it's easy to see
how bit each batch is.

Reviewed By: @vjeux

Differential Revision: D2506218

fb-gh-sync-id: 635556185245d2bd6cb149497ea60b503b2523ce
2015-10-05 14:19:08 -07:00
Sebastian Markbage 14d2b0e147 Add benchmark for attribute diffing
Summary: Benchmark for testing the attribute diffing algorithm.

@​public

Reviewed By: @vjeux

Differential Revision: D2498078
2015-10-01 15:05:38 -07:00
Alexsander Akers 9a2d05d9b2 Move color processing to JS
Reviewed By: @vjeux

Differential Revision: D2346353
2015-09-17 17:20:45 -07:00
Spencer Ahrens 4dca06b238 UIManagerStatTracker
Reviewed By: @astreet

Differential Revision: D2442406
2015-09-15 13:11:58 -07:00
Andy Street a9115bcbb3 [ReactNative][SyncDiff] Add parameter to allow turning on/off off screen rendering for alpha compositing 2015-08-26 15:15:36 -08:00
Andy Street 162d12cfa4 [ReactNative][SyncDiff] Allow renderToHardwareTextureAndroid to be used outside of setNativeProps 2015-08-25 16:55:51 -08:00
Tim Yung af8a6a44b2 RN: Expose React.unstable_batchedUpdates
Summary:
Per @spicyj in facebook/relay#127, this exposes `unstable_batchedUpdates` in React Native the same way it is exposed in `ReactDOM`.
2015-08-21 15:24:56 -08:00
Ben Alpert 0f3ea9fb8c [ReactNative] Fix switching to null event listener 2015-08-19 15:02:25 -07:00
Dorota Kapturkiewicz a2c51b3b28 [ReactNative] expose importantForAccessibility to JS 2015-08-14 03:28:22 -08:00
James Ide d4eac3ddca [RFC][Rendering] Add shouldRasterizeIOS to View components
Summary:
Exposes the `shouldRasterize` property. Fixes #1986.
Closes https://github.com/facebook/react-native/pull/2226
Github Author: James Ide <ide@jameside.com>
2015-08-04 15:37:38 -08:00
Philipp von Weitershausen 3e79838a31 [React Native] sync JS for D2287297 2015-07-31 21:31:46 -08:00
Dorota Kapturkiewicz 8a272bc873 [ReactNative] implement accessibilityLiveRegion and accessibilityComponentType 2015-07-30 01:40:37 -08:00
Gabe Levi d8a13ec3d5 [Flow] Deploy v0.14.0 2015-07-29 20:29:44 -08:00
Dorota Kapturkiewicz e073fdc4c7 [ReactNative] add accessibilityComponentType 2015-07-29 09:20:23 -08:00
Ben Alpert e0ea046092 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -08:00
Spencer Ahrens f1bd1cbc94 [ReactNative] cleanup native components 2015-07-24 18:54:35 -08:00
Ben Alpert e01f90784f [ReactNative] Update core RN modules to work with React 0.14-beta1 2015-07-23 18:07:59 -08:00
Spencer Ahrens c43e93d1b4 Reverted ca9d1b3bf5a6f46ec29babe8685634690ff9a2bc to unbreak groups 2015-07-17 04:03:01 -08:00
Jared Forsyth a43987309d [react native] prepare the react native inspector for the new react devtools
Summary:
These are the changes needed for full interop with the (as yet unreleased) new
version of React Devtools.

- the on-device inspector is minimized when devtools is open
- devtools highlight -> device and device touch -> devtools select works
- editing react native styles :)
2015-07-14 12:35:43 -08:00
Alex Akers eb06659711 [React Native] Update code comments about layout-only view 2015-07-14 02:52:45 -08:00
Alexsander Akers 02db374e50 [React Native] Remove layout-only nodes (Take 2!)
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.

This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.

The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.
2015-07-07 05:06:50 -08:00
chaceliang 7159a4e947 Revert "[React Native] Remove layout-only nodes" 2015-06-25 13:30:06 -08:00
Alex Akers 3c5b4b0a9f [React Native] Remove layout-only nodes
Summary:
Remove layout-only views. Works by checking properties against a list of known properties that only affect layout. The `RCTShadowView` hierarchy still has a 1:1 correlation with the JS nodes.

This works by adjusting the tags and indices in `manageChildren`. For example, if JS told us to insert tag 1 at index 0 and tag 1 is layout-only with children whose tags are 2 and 3, we adjust it so we insert tags 2 and 3 at indices 0 and 1. This keeps changes out of `RCTView` and `RCTScrollView`. In order to simplify this logic, view moves are now processed as view removals followed by additions. A move from index 0 to 1 is recorded as a removal of view at indices 0 and 1 and an insertion of tags 1 and 2 at indices 0 and 1. Of course, the remaining indices have to be offset to take account for this.

The `collapsible` attribute is a bit of a hack to force `RCTScrollView` to always have one child. This was easier than rethinking out the logic there, but we could change this later.

@public

Test Plan: There are tests in `RCTUIManagerTests.m` that test the tag- and index-manipulation logic works. There are various scenarios including add-only, remove-only, and move. In addition, two scenario tests verify that the optimization works by checking the number of views and shadow views after various situations happen.
2015-06-25 09:12:00 -08:00
Andrei Coman 5c1ac2a753 [ReactNative] Block native from becoming js responder 2015-06-19 16:30:15 -08:00
Andy Street 3029511ce4 [react_native] JS files from D2163804: [react_native] Add native root tag to createView calls 2015-06-18 05:26:41 -08:00
Tadeu Zagallo c30365acba [ReactNative] Remove RCTJSTimers
Summary:
@public

Remove `RCTJSTimers.js`, the file was just an alias to `JSTimersExecution`.

Test Plan: Still builds.
2015-06-15 10:50:28 -08:00
Gabe Levi b05e99a531 [Flow] Fix or suppress react-native github errors for Flow v0.12.0 2015-06-10 13:34:19 -08:00