Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
Michael Bolin 0b9ea60b4f Back out "Upgrade Prettier from 1.17 to 2.0.2."
Differential Revision: D20639755

fbshipit-source-id: 5028563f9cf0527a30b4259daac50cdc03934bfd
2020-03-24 21:47:35 -07:00
Michael Bolin cf44650b3f Upgrade Prettier from 1.17 to 2.0.2.
Summary:
This gets us on the latest Prettier 2.x:
https://prettier.io/blog/2020/03/21/2.0.0.html

Notably, this adds support for TypeScript 3.8,
which introduces new syntax, such as `import type`.

Reviewed By: zertosh

Differential Revision: D20636268

fbshipit-source-id: fca5833d003804333a05ba16325bbbe0e06d6c8a
2020-03-24 20:24:47 -07:00
Riley Dulin ce1703a84d Change stringifySafe to have limits on larger objects
Summary:
In heap snapshots, it was found that really large (20 MB) strings representing network data
were being logged as part of `Systrace.beginEvent` strings from `MessageQueue` in DEV mode.

To combat this, use `JSON.stringify` with limits to keep the depth, strings, arrays, and objects
in check.

Changelog: [Internal] Change `stringifySafe` to have max limits on string size

Reviewed By: yungsters

Differential Revision: D20016501

fbshipit-source-id: e123016557bc154e4210e0b4df44360570da8016
2020-03-02 17:28:21 -08:00
Jorge Bernal a6fc0898de Add support for native pseudo-OS to Platform.select (#26966)
Summary:
When you write platform-specific code using [file extensions](https://facebook.github.io/react-native/docs/platform-specific-code#platform-specific-extensions), you can specify `.ios.js`, `.android.js`, or the catch-all `.native.js` when you are sharing code with a web project.

This `native` shortcut is missing for the `Platform.select` method, and this PR is adding support for that.

## Changelog

[General] [Added] - Platform.select now supports native as an option.
Pull Request resolved: https://github.com/facebook/react-native/pull/26966

Test Plan: Added relevant passing unit tests for Platform module.

Differential Revision: D18323670

Pulled By: cpojer

fbshipit-source-id: 7524c1914beab4f86041dcf8e60875380ebf7e02
2019-11-05 05:39:20 -08:00
Rick Hanlon 2e8ecab583 Add tests for codegenNativeComponent
Summary: Adds tests for codegenNativeComponent

Reviewed By: TheSavior

Differential Revision: D16582627

fbshipit-source-id: 3527126c7838f3e2c0c56b19956c618f0a7fb9f9
2019-08-07 06:00:23 -07:00
Min ho Kim 84f5ebe4f9 Fix typos (#25770)
Summary:
Fix typos mostly in comments and some string literals.

## Changelog

[General] [Fixed] - Fix typos
Pull Request resolved: https://github.com/facebook/react-native/pull/25770

Differential Revision: D16437857

Pulled By: cpojer

fbshipit-source-id: ffeb4d6b175e341381352091134f7c97d78c679f
2019-07-23 03:23:11 -07:00
Dan Reynolds d544fa20b7 add support for stringifying error object messages to stringifySafe (#25723)
Summary:
Error objects logged as part of the arguments to `console.error` such as from [rejected es6 promises](https://github.com/zloirock/core-js/blob/v2/modules/es6.promise.js#L110) contain the error that the user would want to see as the error object's message, but is not captured by `stringifySafe`. Here we modify it to if the logged value is an error object print the error similar to chrome:

```
const error = new Error('error');
stringifySafe(error); // Error: error
```

Versus the current behavior which does not recognize the error type and instead tries to stringify the it as an object:

```
JSON.stringify(new Error('error')) // "{}"
```

## Changelog

[JavaScript] [Changed] - Add support for stringifying error object messages to safeStringify
Pull Request resolved: https://github.com/facebook/react-native/pull/25723

Test Plan:
Tests:
<img width="802" alt="Screen Shot 2019-07-18 at 8 39 52 PM" src="https://user-images.githubusercontent.com/2192930/61501171-39218080-a99c-11e9-8e87-48ea413b3d01.png">

Lint:
<img width="406" alt="Screen Shot 2019-07-18 at 8 43 35 PM" src="https://user-images.githubusercontent.com/2192930/61501318-dc729580-a99c-11e9-9264-c0232515352c.png">

Differential Revision: D16437956

Pulled By: cpojer

fbshipit-source-id: ca3ce9c98ad585beb29c2bfeb81bbd14b2b1c700
2019-07-23 02:46:19 -07:00
Rick Hanlon d8bacc28f6 Add test screen for generating view configs
Summary:
This diff adds a testing screen dev route to the facebook app for testing generated view configs

It's not pretty (i have 0 tetra experiance) but it gets the job done

There are three cases handled:
- No generated config �
- Invalid generated config (useful for dev) �
- Valid generated config �

On the description page we:
- Redbox it it's invalid (this could be used to redbox test all host components)
- Show diffs of the view config properties
- List all of the generated config properties
- List all of the native config properties

Using this tool, it's easy to see what the current config on native is, add correct flow types for the generated config, and validate the generated config

Coming later: adding all of the native configs to the list (will probably need filtering)

Reviewed By: cpojer

Differential Revision: D15683033

fbshipit-source-id: 5a566a56bef4f3f0bac3ea581c2e6acb2b9984e3
2019-06-11 05:06:42 -07:00
Emily Janzer 96a5001024 Add spec for DeviceInfo module
Summary: Adding flow types for DeviceInfo module and migrating our codebase over to using `DeviceInfo.getConstants()`

Reviewed By: fkgozali

Differential Revision: D14645744

fbshipit-source-id: e30a060c6dc92938cd1420ba11a1d837c79d1e32
2019-05-29 16:37:15 -07:00
Rick Hanlon ac62274e56 Use generated view config for ActivityIndicatorView
Summary: This diff moves ActivityIndicatorView to the generated view config

Reviewed By: shergin

Differential Revision: D15392561

fbshipit-source-id: 67a2fa0dbbb884af9e9c02b9062d3a610a023240
2019-05-24 09:21:27 -07:00
James Ide a7a7970e54 Replace more Haste imports with path-based imports (#25001)
Summary:
This is another step in moving RN towards standard path-based requires, updating more code to use path-based requires. See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

## Changelog

[General] [Changed] - Replace more Haste imports with path-based imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25001

Differential Revision: D15467829

Pulled By: cpojer

fbshipit-source-id: 58c364bb4c1c757689907d5ed0d0f3fac0e22f3f
2019-05-23 00:51:31 -07:00
Rick Hanlon 382846aefd Add viewconfig verification
Summary: This diff adds a line to the codegen'd view configs which will check that all of the properties in the native view config are also in the JS view config we generate (note that the JS view config may have more properties than one native platform because it includes a union of both platforms)

Reviewed By: TheSavior

Differential Revision: D15278478

fbshipit-source-id: 0fef20c12265b952c69aca4e4c070a7d036db05a
2019-05-16 10:51:06 -07:00
James Ide 0ee5f68929 Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary:
This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change.

See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail.

[General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires
Pull Request resolved: https://github.com/facebook/react-native/pull/24749

Differential Revision: D15258017

Pulled By: cpojer

fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
2019-05-08 08:48:59 -07:00
Alexey Lang c3475419a9 Add removeExtra()
Reviewed By: bestander

Differential Revision: D14386282

fbshipit-source-id: 045dd0f12cc462da694d20da52f3a591b538dc57
2019-03-19 10:24:52 -07:00
Casper Boone f541c34067 Add tests for utilities (#23989)
Summary:
This PR add tests for several utilities in `Libraries/Utilities`, as a follow-up of #23903.

The following utilities are now tested:
* `clamp.js`
* `binareToBase64.js`
* `DeviceInfo.js`
* `mergeIntoFast.js`
* `PixelRatio.js`
* `infoLog.js`
* `logError.js`
* `warnOnce.js`
* `mapWithSeparator` (added a missing test)

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23989

Differential Revision: D14502806

Pulled By: cpojer

fbshipit-source-id: e2c3b3a35f4f765d5336b998ab92dba14eeac7bc
2019-03-18 07:40:55 -07:00
Georgios Andreadis 47e061549f Add tests for utility functions of library (#23903)
Summary:
I was looking at the coverage report of the JavaScript code in the `Libraries` folder, and found some of the modules and functions to be (partially) untested. I believe that adding tests to them would formally capture their behaviour and avoid future regressions. In this PR, I've added some unit tests for 3 utility components.

Perhaps a more general question: Are these kinds of PRs appreciated? I'd be interested in submitting more of them in the future.

Not applicable, since it only adds tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/23903

Differential Revision: D14477601

Pulled By: cpojer

fbshipit-source-id: c0700c5b514cd0df983fecfd91c93fc2bd049f5d
2019-03-15 04:46:48 -07:00
Alexey Lang 1aabbf5dce Allow to create local performance loggers
Reviewed By: bestander

Differential Revision: D14159631

fbshipit-source-id: 62830f67060e575841cbc864dde30c7bee7e7c4c
2019-02-28 03:39:40 -08:00
glevi@fb.com 24f8d4d3db Deploy v0.89
Reviewed By: jbrown215

Differential Revision: D13457087

fbshipit-source-id: 9f01371ae3515990c5595f1eb2361174050066b8
2018-12-14 13:57:50 -08:00
Panagiotis Vekris ef2084c6bd 0.87.0 in xplat/js
Summary: allow-large-files

Reviewed By: samwgoldman

Differential Revision: D13230018

fbshipit-source-id: f07e2371a3b7382de0592cc7c7b20e7f4faa6889
2018-11-28 17:32:50 -08:00
flowkraD f9050e0908 Flow strict DrawerLayout (#22152)
Summary:
Issue in focus: #22100

The only occurrence of `Object` was replaced with the appropriate flow type
A Lint error was encountered in `deepFreezeAndThrowOnMutationInDev-test.js` when running `npm run lint` and was fixed by running `yarn prettier`
Pull Request resolved: https://github.com/facebook/react-native/pull/22152

Differential Revision: D12930872

Pulled By: RSNara

fbshipit-source-id: f9706ed2e49d9ccedfa331594c886d2d3b615db5
2018-11-05 15:05:25 -08:00
watanabeyu e835c6dc50 Replace var to const in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev-test.js (#22110)
Summary:
Replaces the keywords var to const in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js

- [x]  Check npm run flow
- [x]  Check npm run flow-check-ios
- [x]  Check npm run flow-check-android

[GENERAL] [ENHANCEMENT] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js] - replace var
Pull Request resolved: https://github.com/facebook/react-native/pull/22110

Differential Revision: D12919284

Pulled By: TheSavior

fbshipit-source-id: 4a3a3f4c49665c538ed5f38f3cc2142d40ac4d55
2018-11-04 10:52:09 -08:00
empyrical d6c8f189e7 Introduce 'setAndForwardRef' helper function (#21823)
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
2018-10-17 22:00:21 -07:00
Héctor Ramos 1151c096da Update copyright headers to yearless format
Summary: This change drops the year from the copyright headers and the LICENSE file.

Reviewed By: yungsters

Differential Revision: D9727774

fbshipit-source-id: df4fc1e4390733fe774b1a160dd41b4a3d83302a
2018-09-11 15:33:07 -07:00
Keith Brown 02d1bcc047 Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… (#19598)
Summary:
This PR fixes a bug in `deepFreezeAndThrowOnMutationInDev` which did not take into account that objects passed to it may have been created with `Object.create(null)` and thus may not have a prototype. Such objects don't have the methods `hasOwnProperty`, `__defineGetter__`, or `__defineSetter__` on the instance.

I ran into an unrecoverable error in React Native when passing this type of object across the bridge because `deepFreezeAndThrowOnMutationInDev` attempts to call `object.hasOwnProperty(key)`, `object.__defineGetter__` and `object__defineSetter__` on objects passed to it. But my object instance does not have these prototype methods.

Changes:
* Defined `Object.prototype.hasOwnProperty` as a `const` (pattern used elsewhere in React Native)
* Modified calls to `object.hasOwnProperty(key)` to use `hasOwnProperty.call(object, key)` (Per ESLint rule [here](https://eslint.org/docs/rules/no-prototype-builtins))
* Modified calls to deprecated methods `object.__defineGetter__` and `object.__defineSetter__` to instead use `Object.defineProperty` to define get and set methods on the object. (Per guidance on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__))
* Added a new test to `deepFreezeAndThrowOnMutationInDev-test` to verify the fix.

I tried to create a reproducible example to post to Snack by passing prototype-less objects to a `Text` component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error.

However, I was able to create a new test to reproduce the issue. I added the following test to `deepFreezeAndThrowOnMutationInDev-test`:

```JavaScript
it('should not throw on object without prototype', () => {
    __DEV__ = true;
    var o = Object.create(null);
    o.key = 'Value';
    expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow();
  });
```

The changes in this PR include this new test.

ESLint test produced no change in Error count (3) or Warnings (671)

N/A
Other areas with _possibly_ the same issue:
c6b96c0df7/Libraries/vendor/core/mergeInto.js (L50)
8dc3ba0444/Libraries/ReactNative/requireNativeComponent.js (L134)

 [GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype.
Closes https://github.com/facebook/react-native/pull/19598

Differential Revision: D8310845

Pulled By: TheSavior

fbshipit-source-id: 020c414a1062a637e97f9ee99bf8e5ba2d1fcf4f
2018-06-07 02:44:27 -07:00
Peter van der Zee 29fb2a8e90 Bump Prettier to 1.13.4 on xplat
Summary:
Bump Prettier to use version 1.13.4
All code changes are caused by running Prettier and should only affect files that have an `format` header.
All other changes caused by yarn.

Reviewed By: ryanmce

Differential Revision: D8251255

fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914
2018-06-06 05:32:06 -07:00
Eli White d01ab66b47 Prettier React Native Libraries
Reviewed By: sahrens

Differential Revision: D7961488

fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
2018-05-10 19:10:38 -07:00
Eli White 8f5ebe5952 Convert react-native-github/Libraries to let/const
Reviewed By: sahrens

Differential Revision: D7956042

fbshipit-source-id: 221851aa311f3cdd6326497352b366048db0a1bb
2018-05-10 16:16:35 -07:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Mathias Bynens 431670f908 Remove internal `utf8` utility
Summary:
As requested by davidaurelio in https://github.com/mathiasbynens/utf8.js/issues/17#issuecomment-312500535, this makes it possible for developers to use the `utf8` package from npm in combination with React Native.

Ref. https://github.com/mathiasbynens/utf8.js/issues/17
Closes https://github.com/facebook/react-native/pull/17146

Differential Revision: D6765030

Pulled By: hramos

fbshipit-source-id: dda9b3255618470aea2e32c5ba3cf1325e2ec997
2018-01-19 16:18:32 -08:00
Miguel Jimenez Esun 834b9d4e6e Adding @email tags to most of the tests
Reviewed By: rafeca

Differential Revision: D6185623

fbshipit-source-id: 30df83288fe85516d8d5a1617a4fb8fea826ed6f
2017-11-02 06:25:03 -07:00
Daniel Andersson 3e31038301 Extend unit test for buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D5950672

fbshipit-source-id: 921ed6ae6a2b307b050c721cedd4b51e880695ae
2017-10-02 17:05:28 -07:00
James Burnett 51c0e81557 remove disableAutomock from jest tests (new default) @bypass-lint
Reviewed By: cpojer

Differential Revision: D5237192

fbshipit-source-id: dccca52a91259d7fea27931f92bca94184a82d4a
2017-06-13 15:04:09 -07:00
Tim Yung 82edc131b0 RN: Fix deepFreezeAndThrowOnMutationInDev-test for Node v8.1.0
Reviewed By: raluca-elena

Differential Revision: D5222219

fbshipit-source-id: e34903a506b8e6e0c81e1c21fd9e8e015b25b2d7
2017-06-09 16:04:18 -07:00
James Burnett 3360999431 disable automock by default in as many places as possible @bypass-lint
Reviewed By: cpojer

Differential Revision: D5190858

fbshipit-source-id: d3125cf81427dbbe3362ef1f958413394a6dc51d
2017-06-08 07:45:54 -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
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
Pieter De Baets 76c54847bb Extract native module logic from BatchedBridge
Reviewed By: lexs

Differential Revision: D3901630

fbshipit-source-id: c119ffe54a4d1e716e6ae98895e5a3a48b16cf43
2016-09-23 11:14:11 -07:00
Pieter De Baets acdd08aef7 Add flow-typing to MessageQueue
Reviewed By: majak

Differential Revision: D3901545

fbshipit-source-id: a9ccc3d11794830e21c778df0ae7100d79f7ee73
2016-09-23 11:14:10 -07:00
Pieter De Baets 5f381fd357 Move buildStyleInterpolator-test to open-source, remove unused files
Reviewed By: bestander

Differential Revision: D3820939

fbshipit-source-id: 2ff114326642b522f162c6cce7853c8b3f0c138b
2016-09-09 10:58:59 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
David Aurelio 2426b3b5ec Prevent tests with invalid UTF-8 from failing when jest reads them from the cache
Summary: The utf-8 test was failing when run from Jest’s cache, because it contained unicode escape sequences for stray high and low surrogates. Somewhere in the process of transpiling, caching on disk, and reading from the cache, those stray surrogates are changed to U+FFFD (REPLACEMENT CHARACTER / �). This diffs changes the method of creating these strings from literals to `String.fromCharCode`, which survives the process as intended.

Reviewed By: bestander

Differential Revision: D3534711

fbshipit-source-id: 365bace77a1f914e6e2fbb3430b3e0ea6cec5e83
2016-07-08 12:35:53 -07:00
Christoph Pojer 89a9ca6688 Update some JS in preparation for some Jest updates.
Summary:
* Next version of Jest doesn't allow non test files in __tests__ folders.
* I'm trying to switch all tests off of jsdom on react-native. This should save 500ms of time when running a single test because jsdom is slow to load and react-native is also not supposed to run in a DOM environment, so let's not pretend we are providing the DOM in tests.
* Make the bridge config configurable so that when we disable automocking and we reset the registry we can redefine the value.

Oh also, stop using lodash in Server.js. First off, lodash 3 doesn't work in Jest's node env because it does some crazy stuff, second because we don't need to load all of lodash for debounce.

Reviewed By: davidaurelio

Differential Revision: D3502886

fbshipit-source-id: 1da1cfba9ed12264d81945b702e7a429d5f84424
2016-06-30 01:58:40 -07:00
Pieter De Baets 2151dfbb24 Open source jest tests for open source components
Reviewed By: bestander

Differential Revision: D3424368

fbshipit-source-id: 116229b64ecc7d8846e803e29fad377a4fb800bb
2016-06-13 08:28:50 -07:00
Sean Kinsey a96fcc7ce1 Optimize and flowify mapWithSeparator
Summary:
Update mapWithSeparator so that Flow can reason about the arguments and return
type. For simplicity, it is expected that the type of the separator will be the
same as that of the mapped item.

Reviewed By: vjeux

Differential Revision: D3323557

fbshipit-source-id: 75b59e928d4e8c309b5933499a14744370ee5660
2016-05-26 12:28:55 -07:00
Alexander Blom 097f59112f Make MessageQueue.RemoteModules lazy
Reviewed By: javache

Differential Revision: D3252400

fb-gh-sync-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
fbshipit-source-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
2016-05-06 04:14:23 -07:00
Alexander Blom 041185edfd Let JS modules use strings instead of ids on Android
Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
2016-05-04 10:29:26 -07:00
Christoph Pojer d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Mike Grabowski edf8888fb9 Platform.select method
Summary:
Kudos to frantic for this amazing idea! Works really well (yet so simple!)

Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way.

There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful.

Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value.

It works with styles:
`Platform.select({ ios: {}, android: {} })`

with messages:
`<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>`

and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff.
Closes https://github.com/facebook/react-native/pull/7220

Differential Revision: D3221709

Pulled By: vjeux

fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
2016-04-25 16:32:20 -07:00
David Aurelio fcc89e9d92 Add support for missing XHR response types
Summary:Fixes #6679

This adds support for the missing response types to XMLHttpRequest.
Don?t ship this yet. This is completely untested. yolo and stuff.
Closes https://github.com/facebook/react-native/pull/6870

Reviewed By: bestander

Differential Revision: D3153628

Pulled By: davidaurelio

fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac
fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
2016-04-11 05:54:28 -07: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