Commit Graph

34 Commits

Author SHA1 Message Date
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
Kyle Corbitt 2d921eeb70 Resolve react flow definitions
Summary:Currently, we're not taking advantage of Flow's built-in type definitions for the React library in all cases because Flow's definition uses `declare module react` and this file uses `import('React')`, which Flow thinks is a different library. After this change, the following starts working which didn't before:

```js
import { Component } from 'react-native';

class MyText extends Component<void, {text: string}, void> {
  render() { return <Text>{this.props.text}</Text> }
}

// Correctly throws a Flow error for the missing "text" prop
const renderedText = <MyText />;
```
Closes https://github.com/facebook/react-native/pull/5489

Differential Revision: D2856176

fb-gh-sync-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
shipit-source-id: 473ca188ad7d990c3e765526c4b33caf49ad9ffd
2016-02-25 02:45:34 -08:00
Adam Miskiewicz 28116ec3db Reverted commit D2803288
Summary:
As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm.

This PR does several things:

1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`.
2. Removes the modules that were previously being used in lieu of their `fbjs` eq
Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2803288

Pulled By: javache

fb-gh-sync-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1
shipit-source-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1
2016-02-11 02:45:34 -08:00
Adam Miskiewicz 98e5e2b427 Remove knowledge of fbjs from the packager
Summary:
As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm.

This PR does several things:

1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`.
2. Removes the modules that were previously being used in lieu of their `fbjs` eq
Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2803288

Pulled By: davidaurelio

fb-gh-sync-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2
shipit-source-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2
2016-02-11 02:21:37 -08:00
Nick Lockwood 81fb985335 Support non-image assets in packager
Summary:
public
The packager currently assumes that all assets that are not JSON or JS files must be images. Although it is possible to add other extension types, they crash the packager if you try to require them, because it attempts to get their dimensions, assuming that they are an image.

This is a crude workaround for that problem, which skips the image-specific processing for non-image assets, but really it would be better if the packager was properly aware of different asset types and treated them differently (e.g. for sounds it could include the duration, for HTML pages it could parse and include linked CSS files, etc).

I've also added an example of using `require('...')` to load a packager-managed HTML page in the UIExplorer WebView example. In future I anticipate that all static asset types (sounds, fonts, etc.) could be handled in this way, which allows them to be edited or added/removed on the fly instead of needing to restart the app.

Reviewed By: martinbigio

Differential Revision: D2895619

fb-gh-sync-id: cd93794ca66bad838621cd7df3ff3c62b5645e85
2016-02-03 17:30:39 -08:00
glevi@fb.com 5ec1d354c2 Deploy v0.21.0
Reviewed By: jeffmo

Differential Revision: D2888689

fb-gh-sync-id: fe94e50c7872b9a1344a054acccab365d385f6ed
2016-02-01 17:13:35 -08:00
Ben Alpert 6a838a4201 Consume react, fbjs from npm
Summary:
We don't (yet) treat these the same as any other modules because we still have special resolution rules for them in the packager allowing the use of `providesModule`, but I believe this allows people to use npm react in their RN projects and not have duplicate copies of React. Fixes facebook/react-native#2985.

This relies on fbjs 0.6, which includes `.flow` files alongside the `.js` files to allow them to be typechecked without additional configuration. This also uses react 0.14.5, which shims a couple of files (as `.native.js`) to avoid DOM-specific bits. Once we fix these in React, we will use the same code on web and native. Hopefully we can also remove the packager support I'm adding here for `.native.js`.

This diff is not the desired end state for us – ideally the packager would know nothing of react or fbjs, and we'll get there eventually by not relying on `providesModule` in order to load react and fbjs modules. (fbjs change posted here but not merged yet: https://github.com/facebook/fbjs/pull/84.)

This should also allow relay to work seamlessly with RN, but I haven't verified this.

public

Reviewed By: sebmarkbage

Differential Revision: D2786197

fb-gh-sync-id: ff50f28445e949edc9501f4b599df7970813870d
2015-12-30 11:41: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
Gabe Levi c11dce36e6 Deploy 0.19.0
Reviewed By: mroch

Differential Revision: D2711202

fb-gh-sync-id: b889cc9fe13f676aa4e7a5672556174792ece365
2015-12-01 20:11:38 -08:00
glevi@fb.com f166e6ccb2 Bandaid for babel 6 flow errors
Reviewed By: tadeuzagallo

Differential Revision: D2638234

fb-gh-sync-id: 493931966d7d3ae5cdc4a5d0d31fd1a7d3af70da
2015-11-10 13:15:29 -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
Jeff Morrison d4eb8201f1 Deploy Flow 0.18.1 to fbobjc
Reviewed By: gabelevi

Differential Revision: D2575778

fb-gh-sync-id: 2cf610959db6a493d1813455b17f66bc997a9ef3
2015-10-26 15:36:14 -07:00
gabe@fb.com 49a0ae7c32 Deploy v0.17.0
Reviewed By: @jeffmo

Differential Revision: D2512723

fb-gh-sync-id: d16ef34ae727123fbc5b833e828b04faf19b350f
2015-10-07 12:24:21 -07:00
Jeff Morrison 18a7e363b5 Deploy to fbobjc
Reviewed By: @gabelevi

Differential Revision: D2457704
2015-09-18 14:25:27 -07:00
Gabe Levi c03dad19e7 Deploy 0.15.0
Reviewed By: @jeffmo

Differential Revision: D2421222
2015-09-11 17:01:38 -07:00
Alex Kotliarskyi 5b25f208c5 [ReactNative] Teach flow how to deal with images 2015-08-26 18:26:09 -08:00
Gabe Levi d8a13ec3d5 [Flow] Deploy v0.14.0 2015-07-29 20:29:44 -08:00
Ben Alpert e0ea046092 [ReactNative] Fix ResponderEventPlugin after React upgrade 2015-07-29 02:47:55 -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
Jeff Morrison 9f22f67599 [flow 0.13.1] Deploy to 2015-06-29 20:49:05 -08:00
Gabe Levi 972b546fc6 [Flow] Fix or suppress errors in react-native for Flow v0.13.0 2015-06-22 09:48:15 -08:00
Marshall Roch c87158d5ee [Flow] Deploy v0.12.0 2015-06-11 15:40:55 -08:00
Tadeu Zagallo 6075cef070 [ReactNative] Relax flow jest-cli regex 2015-05-28 01:48:16 -08:00
Tadeu Zagallo 626e435c12 [ReactNative] Update flow commoner tests regex 2015-05-27 16:33:31 -08:00
Gabe Levi 1e42fea0af Bump the react-native .flowconfig Flow version to v0.11.0 2015-05-13 13:38:54 -07:00
Alex Kotliarskyi 4bd07f9b5e Fix flow errors 2015-05-08 11:04:22 -07:00
Gabe Levi 4cbd7ceb81 [Flow] Add versions to fbobjc .flowconfigs 2015-04-24 22:49:51 -08:00
Amjad Masad c94f7c3656 [React Native] Sync from github 2015-03-27 22:09:11 -08:00
Marshall Roch 7ffa7942aa flowify Libraries/ReactIOS 2015-03-25 17:09:51 -08:00
Marshall Roch 0315719507 Flowify ReactIOSEventEmitter 2015-03-25 10:10:47 -08:00
Basil Hosmer 6daf7d2634 last batch of UIExplorer flowification 2015-03-24 13:17:41 -08:00
Basil Hosmer c43d1458c7 clean flow errors in react-native-github 2015-03-18 11:44:13 -08:00
Spencer Ahrens efae175a8e [react-packager][streamline oss] Move open sourced JS source to react-native-github 2015-02-19 21:25:11 -08:00