Commit Graph

162 Commits

Author SHA1 Message Date
Matt Hargett 84affbd6a3 Loosen Platform check to allow better code sharing for out-of-tree platforms
Summary:
Don't lock out other non-iOS platforms (e.g. Windows) with an overly
specific check. This change allows this JS file to be re-used instead of copied and modified. There was one other instance of this pattern, but I'll submit it separate for easier cherry-picking.

Tested Android and iOS playground on simulators.

 [GENERAL] [ENHANCEMENT] - some core ReactNative JS library files will be easier to re-use across RN platforms.
Closes https://github.com/facebook/react-native/pull/18308

Differential Revision: D7230803

Pulled By: hramos

fbshipit-source-id: 11e03183535a7453cee00dc1e795c27f2fd2bf5d
2018-03-12 08:43:05 -07:00
Eli White dbdf43b428 propTypes are optional for native components
Summary:
We plan to migrate native components like View, Text, and Image to be typed with Flow instead of propTypes so that we can better enforce our usages.

This change makes it so that *if* propTypes are defined they must cover the native props. However, if they aren't specified, the validation doesn't occur.

Eventually, the prop validation should occur via codegen that generates an interface the native component must implement from the flow types defined in JS.

Reviewed By: yungsters

Differential Revision: D7203649

fbshipit-source-id: a8095aa46807ce03272e2962289e8f5705b422b9
2018-03-08 15:56:09 -08:00
Kevin Gozali 486ac9dc82 update FabricUIManager to call the right JS object
Reviewed By: sebmarkbage

Differential Revision: D7037275

fbshipit-source-id: 6a1d13227910d0cdb99dde4b6c98ed7a20ef9911
2018-02-23 17:04:40 -08:00
Brian Vaughn 9dd7608c97 Replaced unstable_AsyncComponent with unstable_AsyncMode
Reviewed By: gaearon

Differential Revision: D7025510

fbshipit-source-id: 1aff984ce7479e5fdff71259d0f552193a6cdcea
2018-02-20 17:46:53 -08:00
Caleb Meredith da3424c929 @allow-large-files Upgrade xplat/js to Flow v0.66
Reviewed By: gabelevi

Differential Revision: D7016717

fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9
2018-02-16 20:24:57 -08: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
Brian Vaughn e7010348d8 Removed ReactNativeFeatureFlags
Reviewed By: flarnie

Differential Revision: D6938455

fbshipit-source-id: 1ad08ebf01dcae76f50b26fb993425233da1ae16
2018-02-09 10:58:55 -08:00
Kevin Gozali fa0ac92b2c call into native FabricUIManager from JS
Reviewed By: mdvacca

Differential Revision: D6945104

fbshipit-source-id: ac66c6105c0d18bef003cdd08d06dbb49c61e669
2018-02-08 19:31:25 -08:00
Kevin Gozali 94dac23583 Added ReactFabric shim
Summary:
A simple shim just like ReactNative.js
Plus a fork of renderApplication that exclusively will call ReactFabric.

Reviewed By: mdvacca

Differential Revision: D6919080

fbshipit-source-id: 5807105a6c45dd99584eb92a5570c6076e2d56b9
2018-02-06 21:49:37 -08:00
Brian Vaughn c7ed03a95c Synced ReactFabric render
Reviewed By: fkgozali, sebmarkbage

Differential Revision: D6839001

fbshipit-source-id: 47b8278e883c33ca1f359dd16614f86c292e972d
2018-01-30 09:01:17 -08:00
Valentin Shergin 2afe7d4765 Support for inherited events in view managers
Summary:
We currently support inherited view props but not event handlers,
this diff fixes it.
This change will allow to unify set of supported events for single- and multli-line <TextInput>s and avoid code duplication.

Reviewed By: sahrens

Differential Revision: D6690281

fbshipit-source-id: f142828bd7deae92fb306914b7cefd10da8b43f7
2018-01-11 19:04:14 -08:00
Adam Ernst 9f33fe2583 Upgrade to 1.9.1
Reviewed By: vjeux

Differential Revision: D6497877

fbshipit-source-id: 3b88b96e375ddf1fbe039a0593569bbdde40a2dc
2017-12-06 17:34:26 -08:00
Brian Vaughn c91d87213e Replace fburl.com link with public fb.me link
Summary:
Follow up from [this comment](1b22d49ae8 (commitcomment-25699227)).
Closes https://github.com/facebook/react-native/pull/16892

Differential Revision: D6374118

Pulled By: bvaughn

fbshipit-source-id: e692985d6736986acc073fa036d413121ce51f41
2017-11-20 13:56:15 -08:00
Héctor Ramos 79e24ede40 Migrate additional docs to the new format
Summary:
[DOCS]
Closes https://github.com/facebook/react-native/pull/16874

Differential Revision: D6375515

Pulled By: hramos

fbshipit-source-id: 64359b45a37c7b478919121573ca04dbb1ce6609
2017-11-20 13:16:12 -08:00
Brian Vaughn 1b22d49ae8 renderApplication() supports async initial render
Reviewed By: sahrens

Differential Revision: D6339469

fbshipit-source-id: d832de936c50edcdc6953b72b5ad18ce1b652187
2017-11-17 13:33:03 -08:00
Dmitry Zakharov 1b71e03932 Make RN Events registered disregarding ViewManager use pattern.
Reviewed By: fromcelticpark

Differential Revision: D6260009

fbshipit-source-id: f3d00162f8473976264ebef040d01163950f2170
2017-11-07 11:32:34 -08:00
Omri Gindi a6465d1c17 Backed out changeset 322626be193e
Reviewed By: wutalman

Differential Revision: D6258856

fbshipit-source-id: 392dc91f87148c70817f13858a7fcd368f028b2d
2017-11-07 04:53:40 -08:00
Dmitry Zakharov fdf04953c0 Make RN Events registered disregarding ViewManager use pattern.
Reviewed By: bvaughn

Differential Revision: D6223864

fbshipit-source-id: 322626be193e5fa840d3e5477e86adaa90f2726d
2017-11-06 06:40:19 -08:00
Ramanpreet Nara efa4d3c222 Rename I18nManager Left/Right swap methods
Reviewed By: fkgozali

Differential Revision: D6140072

fbshipit-source-id: 282dc614c036de8f217a729f21a1bbe92b8afd7d
2017-10-24 20:45:59 -07:00
Ramanpreet Nara 98547d4bcf Implement gating support for direction-aware API changes
Reviewed By: achen1

Differential Revision: D6045083

fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
2017-10-18 19:33:31 -07:00
Janic Duplessis eae4fe810f Improve YellowBox output format
Summary:
YellowBox currently assumes the first arg is a printf like format string, this adds support for any arguments so it works more like console in the browser. This also adds `stringifySafe` to format arguments when using printf style.

The main annoyance that this fixes is when trying to log a single object it will currently print [object Object] instead of the fully stringified version.

**Test plan**

Tested a bunch of different log combinations.

```js
console.warn({test: 'a'}); // {"test":"a"} (was [object Object] before this patch)
console.warn('test %s %s', 1, {}); // test 1 {}
console.warn('test %s', 1, {}); // test 1 {}
console.warn({}, {}, {}, {}); // {} {} {} {}
```
Closes https://github.com/facebook/react-native/pull/16132

Differential Revision: D5973125

Pulled By: yungsters

fbshipit-source-id: fc17105a79473a11c9b1c4728d435fc54fb094bb
2017-10-04 00:00:36 -07:00
Dmitry Zakharov 346af557c3 Fix regression in Java->C++->JS ViewManagers interaction.
Reviewed By: bvaughn

Differential Revision: D5953937

fbshipit-source-id: 8bc5dd8a483054ab9830ab653f2a3b41cad6c791
2017-10-03 05:30:42 -07:00
Dmitry Zakharov da30b04703 Implement lazy discovery for ViewManagers.
Reviewed By: kathryngray

Differential Revision: D5865095

fbshipit-source-id: c94970e4cd7aafb20cf844c48feea053ac8b6b0f
2017-09-28 09:55:59 -07:00
Christopher Chedeau 70c6700be8 Codemod to 1.7.0
Differential Revision: D5763302

fbshipit-source-id: a91ca1786c7ac8eb9aa3dd43555a7a223dc6f9cf
2017-09-26 23:45:48 -07:00
Valentin Shergin c70ac24966 Using SafeAreaView in YellowBox (2nd attempt)
Summary: Now it does not clipped on iPhone X.

Reviewed By: yungsters

Differential Revision: D5907527

fbshipit-source-id: 10d05e4ac5d16a9e257efa78795bff9f14f4c0bb
2017-09-25 23:30:19 -07:00
Valentin Shergin 5536252376 Revert D5894101: [RN] Using SafeAreaView in YellowBox
Differential Revision: D5894101

fbshipit-source-id: b18b09572c2362d4867ed94a406f56206cdfe6d5
2017-09-25 11:51:23 -07:00
Valentin Shergin e10f7788c4 Using SafeAreaView in YellowBox
Summary:
Now it does not clipped on iPhone X.
{F74889000}

Reviewed By: mmmulani

Differential Revision: D5894101

fbshipit-source-id: 5dc91583aa38bb14607421e5afc2ae796e35cce0
2017-09-24 23:01:25 -07:00
Valentin Shergin 8606e04c5d Enabled pretier (@format) for all files in ReactNative folder
Reviewed By: mmmulani

Differential Revision: D5894100

fbshipit-source-id: fae0d02547c0f049fc77f87f209b2ae4f2a298fd
2017-09-24 23:01:25 -07:00
Brian Vaughn 75c94a8907 Native view manager event types exposed to JS via view config
Differential Revision: D5814210

fbshipit-source-id: 41291f0d6b39af77f66173f6a699d88f9f4ccc74
2017-09-14 18:17:17 -07:00
Brian Vaughn e9780bdc0f ReactNative sync (c3718c4...abce30f): the one about the Prepack optimizations
Reviewed By: sophiebits

Differential Revision: D5626312

fbshipit-source-id: f8158ccb14f991b681fba34fb23933042266939d
2017-09-14 18:17:17 -07:00
Marshall Roch 91b6b4efb9 @allow-large-files Flow v0.54.0
Reviewed By: leebyron

Differential Revision: D5773490

fbshipit-source-id: 2c54bb6326f23edbe9a969f3010f79da8189923e
2017-09-06 03:33:43 -07:00
Caleb Meredith 63f990121a Fix React Native open source
Reviewed By: hramos, TheSavior

Differential Revision: D5728356

fbshipit-source-id: fb751d67c16ba9273de93d9b6d5acd65b1555dca
2017-08-29 15:01:05 -07:00
Caleb Meredith 90eaeb019b Upgrade fbsource/xplat/js to Flow v0.53.0
Reviewed By: avikchaudhuri

Differential Revision:
D5648819
Ninja: T20988071

fbshipit-source-id: 66e5b6747c79ae66b6eb69d40ede5e982c26174f
2017-08-17 18:45:01 -07:00
Kevin Gozali 66da0d27da move the ReactNativeFeatureFlags outside of sync dir
Reviewed By: bvaughn

Differential Revision: D5627037

fbshipit-source-id: 0544b822ba03090a74695911b6951e91262478a0
2017-08-15 10:48:43 -07:00
Pieter De Baets e697ed75d1 Report native warnings to YellowBox
Reviewed By: fkgozali

Differential Revision: D5553601

fbshipit-source-id: b80f019b11d02865a17a25cbff61edf65173cd84
2017-08-04 07:56:14 -07:00
Christian Brevik 684e03590b Support native ViewManager inheritance on iOS
Summary:
**Motivation**
This is a re-worked version of #14260, by shergin's suggestion.

For iOS, if you want to inherit from a native ViewManagers, your custom ViewManager will not automatically export the parents' props. So the only way to do this today, is to basically copy/paste the parent ViewManager-file, and add your own custom logic.

With this PR, this is made more extensible by exporting the `baseModuleName` (i.e. the iOS `superclass` of the ViewManager), and then using that value to re-establish the inheritance relationship in `requireNativeComponent`.

**Test plan**
I've run this with a test project, and it works fine there. But needs more testing.

Opened this PR as [per shergin's suggestion](https://github.com/facebook/react-native/pull/10946#issuecomment-311860545) though, so we can discuss approach.

**Discussion**
* Android already supports inheritance, so this change should be compatible with that. But, not every prop available on `UIManager.RCTView.NativeProps` is actually exported by every ViewManager. So should `UIManager.RCTView.NativeProps` still be merged with `viewConfig.NativeProps`, even if the individual ViewManager does not export/use them to begin with?
* Does this break other platforms? [UWP](https://github.com/Microsoft/react-native-windows)?
Closes https://github.com/facebook/react-native/pull/14775

Differential Revision: D5392953

Pulled By: shergin

fbshipit-source-id: 5212da616acfba50cc285e2997d183cf8b2cd09f
2017-07-10 16:01:12 -07:00
Christopher Chedeau c848c3820b Codemod prettier to 1.5.2
Differential Revision: D5339725

fbshipit-source-id: 631338436a7d69b0ab0721507bdab4ae4e207065
2017-06-28 12:50:30 -07:00
Summer Kitahara 937568b472 Fixing typo in AppContainer
Summary: Fixed a typo. Adding an optional wrapper component to AppContainer.

Reviewed By: fkgozali

Differential Revision: D5330056

fbshipit-source-id: 8e33fcbfb21168c641abbd54b79d272a7c361889
2017-06-27 18:15:58 -07:00
Summer Kitahara 162d92da0e Adding an optional wrapper component to app components
Summary: Changing AppContainer to render a wrapper component in it, if it exists. This wrapper is NOT a required property of AppContainer. Now, app-wide properties can be passed down via context to the container's children.

Reviewed By: sahrens, fkgozali

Differential Revision: D5283895

fbshipit-source-id: 8595e22c4b5ebf5d0e57f358152fba8a80cb2723
2017-06-26 16:33:05 -07:00
Seth Fitzsimmons 8e9322c65e react@16 did away with PropTypes; require prop-types instead
Summary:
react@16 (a peerDependency) did away with the PropTypes export in favor of the prop-types module.

This updates all of the remaining references to `React.PropTypes`.
Closes https://github.com/facebook/react-native/pull/14641

Differential Revision: D5287167

Pulled By: javache

fbshipit-source-id: a917e29aa0e5470260568995dfe97f5528ec265e
2017-06-22 13:49:57 -07:00
Pieter De Baets 2c85490aa2 Update and synchronize preloaded modules config
Reviewed By: davidaurelio

Differential Revision: D5154657

fbshipit-source-id: cdf752d4a358ee6d4ff06aee74a71052a615c33e
2017-06-06 04:04:44 -07:00
Pieter De Baets f7ebf0c64e Cleanup perf logging in FacebookAppRouteHandler
Reviewed By: sahrens

Differential Revision: D5154561

fbshipit-source-id: 5a3a495bbb910153833bc910864b6d5c7dca6432
2017-06-01 04:15:57 -07:00
Aaron Chiu 28c07f8698 allow inspector to show if not Systrace profiling
Reviewed By: gaearon

Differential Revision: D5060716

fbshipit-source-id: 9a00f80be8ef28da37d7aa672a4c0805182c1582
2017-05-15 05:16:48 -07:00
Aaron Chiu d334cdd590 remove yellow box from systrace
Reviewed By: alexeylang

Differential Revision: D5024794

fbshipit-source-id: 5551135c16adb6f93d2f5957171f41d63b9a6bf9
2017-05-11 21:00:50 -07:00
周中原 f5056f844d Update AppRegistry.registerComponent's parameter.
Summary:
Update AppRegistry.registerComponent's second parameter name from "component" to "getComponentFunc".
Because the second parameter is NOT a component , it is like ` () => ReactClass<any>;`.

Using 'component' will mislead people who use this function.

- react-native 4.2 docs: [static registerComponent(appKey, getComponentFunc) ](http://facebook.github.io/react-native/releases/0.42/docs/appregistry.html#registercomponent)
- react-native 4.4 docs: [static registerComponent(appKey, component, section?) ](http://facebook.github.io/react-native/docs/appregistry.html#registercomponent)

No need to test. Update the parameter name will not mislead the people who use registerComponent.
Closes https://github.com/facebook/react-native/pull/13747

Differential Revision: D4994037

Pulled By: javache

fbshipit-source-id: 1609d6ff7d63bdc15d7e8e5a94cbf4e029ab427c
2017-05-03 18:01:32 -07:00
Blair Vanderhoof a974c140db Add method on YellowBox to ignore warnings
Reviewed By: yungsters

Differential Revision: D4979460

fbshipit-source-id: 090a29009a1256809bd975184ad4957b2f6fc36d
2017-05-02 12:16:00 -07:00
Adam Perry 0c9b41f2c0 Include Create React Native App in Getting Started
Summary:
cc hramos

Create React Native App was designed to reduce "time to hello world" to 5-10 minutes for React Native apps. This PR would make CRNA the first way to get started that new users encounter. Included also is some text to help advanced users navigate the question of whether to use CRNA or whether to go straight to `react-native init`. It also includes a new banner for the iOS and Android guides, since they do not apply to CRNA users.

Changes are only to the website, screenshots below. This branch was created from the last CI-passing master commit this morning, dependencies were freshly installed and these screenshots are from a clean build.

[The Getting Started page](https://www.dropbox.com/s/1s7f3wu3oxr6gpo/Screenshot%202017-04-04%2015.12.29.png?dl=0)

[The "native builds only" banner](https://www.dropbox.com/s/nyv51xdiibdkn57/Screenshot%202017-04-04%2015.13.25.png?dl=0)

[Pages which still apply to CRNApps have no banner](https://www.dropbox.com/s/qgl0h6uzynqkmy2/Screenshot%202017-04-04%2015.14.10.png?dl=0)

<details>

* [x] Decide how to handle native code & react-native-cli references outside of the `banner: ejected` guides
  * [x] [Debugging: Accessing Console Logs](https://facebook.github.io/react-native/docs/debugging.html#accessing-console-logs) isn't needed in CRNA (logs are forwarded alongside packager output)
  * [x] [Debugging: With Stetho](https://facebook.github.io/react-native/docs/debugging.html#debugging-with-stetho-http-facebook-github-io-stetho-on-android) requires native code
  * [x] [Debugging: Debugging Native Code](https://facebook.github.io/react-native/docs/debugging.html#debugging-native-code) is native-only
  * [x] [AppRegistry](https://facebook.github.io/react-native/docs/appregistry.html) only applies to ejected apps, since this is generated from code, I don't think we can set `banner: ejected`?
  * [x] [Linking](https://facebook.github.io/react-native/docs/linking.html) involves changing Android manifests and other native-side things
  * [x] [PermissionsAndroid](https://facebook.github.io/react-native/docs/permissionsandroid.html) may be flaky in the Expo client, I can't recall (cc jesseruder)
  * [x] [PushNotificationIOS](https://facebook.github.io/react-native/docs/pushnotificationios.html) won't work inside Expo, as it has to [handle its own push notifs](https://docs.expo.io/versions/v15.0.0/guides/push-notifications.html)
  * [x] [Geolocation](https://facebook.github.io/react-native/docs/geolocation.html) requires a polyfill that will most likely ship with next week's release, but that won't have any manifest changes necessary
* [ ] Figure out a strategy to handle the fact that CRNA will lag stable RN releases by ~1 week
* [x] Confirm linking out to CRNA docs is an OK strategy as opposed to moving ejecting, etc. docs in-tree
* [ ] Answer questions (I'll add some review comments to call out a few things)

</details>
Closes https://github.com/facebook/react-native/pull/13303

Differential Revision: D4950661

Pulled By: hramos

fbshipit-source-id: 3dd43828f38ca6ede3f2b0683608c56420dc6525
2017-04-26 07:16:18 -07:00
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