Commit Graph

83 Commits

Author SHA1 Message Date
Valentin Shergin e9a090fd9b Enabling `flashScrollIndicators` example for all platforms
Summary: ... because it was recently implemented for Android.

Reviewed By: mmmulani

Differential Revision: D5916305

fbshipit-source-id: b8af0f8712e36aee5c44f7ede41da25fc944134f
2017-09-27 16:16:20 -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
David Vacca b694f96762 adding error message including stacktrace and example
Reviewed By: fkgozali

Differential Revision: D5908789

fbshipit-source-id: 061e414d5105df607b7dcafefb134ad9c94a9a71
2017-09-25 22:03:02 -07:00
Kevin Gozali 3649fce129 Revert D5887667: Adding error message including stacktrace
Differential Revision: D5887667

fbshipit-source-id: 2b3b877317bd4bfddcb5d7886c7399c669d4bbd6
2017-09-25 16:32:02 -07:00
David Vacca eae0241a7d Adding error message including stacktrace
Reviewed By: shergin

Differential Revision: D5887667

fbshipit-source-id: 6c1f1ad74db886a01f76171cdcafa97169fef4c3
2017-09-25 10:17:51 -07:00
Valentin Shergin 7e5d4335ca SafeAreaViewExample inside RNTester
Reviewed By: mmmulani

Differential Revision: D5888672

fbshipit-source-id: 3de827cbbbb71c9d4bfcc8a1830eea962e707bbe
2017-09-24 23:01:25 -07:00
Mehdi Mulani 6ce69dc925 Fix RNTester tests
Reviewed By: fkgozali

Differential Revision: D5881825

fbshipit-source-id: 38debe598830c4cc969b5251cfdfd8941ac36e9d
2017-09-21 12:31:42 -07:00
Adam Miskiewicz 26133beda9 Add closed-form damped harmonic oscillator algorithm to Animated.spring
Summary:
As I was working on mimicking iOS animations for my ongoing work with `react-navigation`, one task I had was to match the "push from right" animation that is common in UINavigationController.

I was able to grab the exact animation values for this animation with some LLDB magic, and found that the screen is animated using a `CASpringAnimation` with the parameters:

- stiffness: 1000
- damping: 500
- mass: 3

After spending a considerable amount of time attempting to replicate the spring created with these values by CASpringAnimation by specifying values for tension and friction in the current `Animated.spring` implementation, I was unable to come up with mathematically equivalent values that could replicate the spring _exactly_.

After doing some research, I ended up disassembling the QuartzCore framework, reading the assembly, and determined that Apple's implementation of `CASpringAnimation` does not use an integrated, numerical animation model as we do in Animated.spring, but instead solved for the closed form of the equations that govern damped harmonic oscillation (the differential equations themselves are [here](https://en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator), and a paper describing the math to arrive at the closed-form solution to the second-order ODE that describes the DHO is [here](http://planetmath.org/sites/default/files/texpdf/39745.pdf)).

Though we can get the currently implemented RK4 integration close by tweaking some values, it is, the current model is at it's core, an approximation. It seemed that if I wanted to implement the `CASpringAnimation` behavior _exactly_, I needed to implement the analytical model (as is implemented in `CASpringAnimation`) in `Animated`.

We add three new optional parameters to `Animated.spring` (to both the JS and native implementations):

- `stiffness`, a value describing the spring's stiffness coefficient
- `damping`, a value defining how the spring's motion should be damped due to the forces of friction (technically called the _viscous damping coefficient_).
- `mass`, a value describing the mass of the object attached to the end of the simulated spring

Just like if a developer were to specify `bounciness`/`speed` and `tension`/`friction` in the same config, specifying any of these new parameters while also specifying the aforementioned config values will cause an error to be thrown.

~Defaults for `Animated.spring` across all three implementations (JS/iOS/Android) stay the same, so this is intended to be *a non-breaking change*.~

~If `stiffness`, `damping`, or `mass` are provided in the config, we switch to animating the spring with the new damped harmonic oscillator model (`DHO` as described in the code).~

We replace the old RK4 integration implementation with our new analytic implementation. Tension/friction nicely correspond directly to stiffness/damping with the mass of the spring locked at 1. This is intended to be *a non-breaking change*, but there may be very slight differences in people's springs (maybe not even noticeable to the naked eye), given the fact that this implementation is more accurate.

The DHO animation algorithm will calculate the _position_ of the spring at time _t_ explicitly and in an analytical fashion, and use this calculation to update the animation's value. It will also analytically calculate the velocity at time _t_, so as to allow animated value tracking to continue to work as expected.

Also, docs have been updated to cover the new configuration options (and also I added docs for Animated configuration options that were missing, such as `restDisplacementThreshold`, etc).

Run tests. Run "Animated Gratuitous App" and "NativeAnimation" example in RNTester.
Closes https://github.com/facebook/react-native/pull/15322

Differential Revision: D5794791

Pulled By: hramos

fbshipit-source-id: 58ed9e134a097e321c85c417a142576f6a8952f8
2017-09-20 23:38:16 -07:00
Valentin Shergin 7efd4fabfd Text to Spannable conversion is now using PRIORITY flag to enforce the order of spans
Summary:
When we convert nested <Text> components to Spannable object we must enforce the order of spans somehow,
otherwise we will have Spannable object with unpredictable order of spans, which will produce unpredictalbe text layout.
We can do it only using `Spannable.SPAN_PRIORITY` feature because Spannable objects do not maintain the order of spans internally.

We also have to fix this to implement autoexpandable <TextInput>.

Reviewed By: achen1

Differential Revision: D5811172

fbshipit-source-id: 5bc68b869e58aba27d6986581af9fe3343d116a7
2017-09-17 22:00:16 -07:00
Joshua Alvarado 915a020fca Proper support of the accessibilityLabel for <Text> components on iOS
Summary:
**PR changes**
The RCTText class originally overrode the accessibilityLabel and returned the raw text of the class ignoring if the accessibilityLabel was set explicitly in code.
Example:
  <Text accessibilityLabel="Example"> Hello World </Text> // returns "Hello World" instead of "Example" for the accessibility label

My update checks if the super's accessibilityLabel is not nil and returns the value else it returns the raw text itself as a default to mirror what a UIKit's UILabel does. The super's accessibilityLabel is nil if the accessibilityLabel is not ever set in code. I don't check the length of the label because if the value was set to an empty purposely then it will respect that and return whatever was set in code.
With the new changes:
  <Text accessibilityLabel="Example"> Hello World </Text> // returns "Example" for the accessibilityLabel

This change doesn't support nested <Text> components with both accessibilityLabel's value set respectively. The parent's value will return.
Example:

  // returns "Example" instead of "Example Test" for the accessibility label
  <Text accessibilityLabel="Example">
    Hello
    <Text accessibilityLabel="Test">
      World
    </Text>
  </Text>

The workaround is just to set the only the parent view's accessibilityLabel with the label desired for it and all its nested views or just not nest the views if possible.
I believe a bigger change would be needed to support accessibility for nested views, for now the changes I have made should satisfy the requirements.

Reviewed By: shergin

Differential Revision: D5806097

fbshipit-source-id: aef2d7cec4657317fcd7dd557448905e4b767f1a
2017-09-12 12:53:59 -07:00
Alex Dvornikov bd723745c1 Allow Cxx references to be used in native module's method signature
Reviewed By: javache

Differential Revision: D5772182

fbshipit-source-id: 21e2f7b8d14ffdcfc0ba969c9a35315863a19b71
2017-09-07 09:17:04 -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
Kevin Gozali 2feb74dbe4 fixed image in RNTester snapshot example
Summary:
The icon size in the test/example cannot be rounded correctly as 3x image, causing redbox like:

```
-[RNTesterSnapshotTests testTabBarExample] : failed: caught "NSInternalInconsistencyException", "RedBox error: Error setting property 'icon' of RCTTabBarItem with tag #14: Image source flux@3x.png size {33, 33} does not match loaded image size {33.333333333333336, 33.333333333333336}."
```
This simply resizes them from 100x100 to 99x99

Reviewed By: javache

Differential Revision: D5747345

fbshipit-source-id: 084b4b028436b18dab324fef1fb0a4365072be75
2017-08-31 15:16:05 -07:00
Wes Johnson a64674375e Alert - allow for hiding alert title on iOS
Summary:
Wanted a "message-only" alert on iOS that doesn't lead to the message being large & bolded via the title field (current state).

Before:

![screen shot 2017-08-28 at 9 22 04 pm](https://user-images.githubusercontent.com/1047502/29801514-fc3629d2-8c3d-11e7-86d5-f0a866301814.png)

After:

![screen shot 2017-08-28 at 9 26 56 pm](https://user-images.githubusercontent.com/1047502/29801521-071aa1ca-8c3e-11e7-9bd0-0a4682d81979.png)

It also aligns iOS with Android's current behaviour.

The above screenhots were generated from the `RNTester` example added herein.

Allowed for passing an empty string through to `UIAlertController.alertControllerWithTitle` so that the message could be rendered in its expected place on iOS (not as the title).

* Ran RNTester & compared example alerts before & after (below default with titles, for example)
* Ran end-to-end manual test suite (it's the only one I could get through without unrelated failures)

Before

![screen shot 2017-08-28 at 9 21 53 pm](https://user-images.githubusercontent.com/1047502/29801775-6e249ff0-8c3f-11e7-888b-2c4d5177a7d7.png)

After

![screen shot 2017-08-28 at 9 26 40 pm](https://user-images.githubusercontent.com/1047502/29801781-7270c4a8-8c3f-11e7-8b9b-59b2649646f2.png)
Closes https://github.com/facebook/react-native/pull/15685

Differential Revision: D5729420

Pulled By: hramos

fbshipit-source-id: 4866b0b24473ae35e9ebae09f2cee13a49d7717e
2017-08-30 17:16:17 -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
Eli White 2d0fe109d7 Fix Prettier
Reviewed By: hramos

Differential Revision: D5720486

fbshipit-source-id: 374c0c264a714276c39c357aa3fc0737a822a8db
2017-08-29 11:00:59 -07:00
Jan Kassens 128a856d3e fix missing @providesModule
Reviewed By: fkgozali

Differential Revision: D5707577

fbshipit-source-id: 5506d1b4a13d44a61530da824c2b0c646ee3287c
2017-08-25 11:00:00 -07:00
Becky Van Bussel 84b11dd518 Add Android React Native Checkbox
Reviewed By: achen1

Differential Revision: D5281736

fbshipit-source-id: 9a3c93eeace2d80be4ddbd4ffc3258c1d3637480
2017-08-25 10:30:54 -07:00
Jacob Parker b48149ed94 Expose barStyle for NavigatorIOS and TabBarIOS
Summary:
Exposes barStyle property. Code already existed in RCTConvert, so that’s why there’s no conversion code here.
Closes https://github.com/facebook/react-native/pull/10936

Differential Revision: D4224759

Pulled By: shergin

fbshipit-source-id: b6346940e69933d42a21cd38b9a2fa75d049f8e6
2017-08-25 00:14:46 -07:00
Valentin Shergin 6493a85754 RCTShadowView have got `rootView` property
Summary:
We have to have a way to track ownership of shadow view.
Previous solution with traversing the hierarchy to figure out the root view does not actually work in some cases when the view is temporary detached from hierarchy.
This is also how it work on Andorid.

Reviewed By: mmmulani

Differential Revision: D5686112

fbshipit-source-id: a23a10e8c29c7572ac69403289db136c9d5176a9
2017-08-24 00:05:48 -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
Eli White 36f2d18b10 Disallow trailing commas in react-native-github
Reviewed By: cpojer

Differential Revision: D5645043

fbshipit-source-id: 7378cc96ce39d3d18da7fba51d48db84cfdfa08f
2017-08-17 16:20:04 -07:00
Caleb Meredith 30d9c3d279 Add suppressions for Flow v0.53.0 before React changes
Reviewed By: avikchaudhuri

Differential Revision: D5648801

fbshipit-source-id: c4eb1bee198a177b69b6e9414111ce957b4d27ff
2017-08-17 05:18:33 -07:00
David Vacca 6f60f2bf67 Expose StatusBar height and fix StatusBar example - T13591448
Reviewed By: achen1

Differential Revision: D5624514

fbshipit-source-id: edc1ebe9758bd6a67e79a60128553414fb1424d3
2017-08-15 11:11:39 -07:00
Janic Duplessis ef23d2bdcf Show bundle download progress on iOS
Summary:
This shows progress for the download of the JS bundle (different from the packager transform progress that we show already). This is useful especially when loading the JS bundle from a remote source or when developing on device (on simulator + localhost it pretty much just downloads instantly). This will be nice for the expo client since all bundles are loaded over the network and can take several seconds to load.

This depends on https://github.com/facebook/metro-bundler/pull/28 to work but won't crash or anything without it, it just won't show the progress percentage.

![img_05070155d2cc-1](https://user-images.githubusercontent.com/2677334/28293828-2c08d974-6b24-11e7-9334-e106ef3326d9.jpeg)

**Test plan**
Tested that bundle download progress is shown properly in RNTester on both localhost + simulator and on real device with network conditionner to simulate a slow loading bundle.

Tested that it doesn't cause issues if the packager doesn't send the Content-Length header.
Closes https://github.com/facebook/react-native/pull/15066

Differential Revision: D5449073

Pulled By: shergin

fbshipit-source-id: 43a8fb559393bbdc04f77916500e21898695bac5
2017-08-14 11:05:35 -07:00
Alex Dvornikov 6783694158 Add support for Cxx objects as arguments to native modules
Reviewed By: fkgozali

Differential Revision: D5589269

fbshipit-source-id: 1bd7004adc397241cabfb1dc59ba1aebad943bf8
2017-08-14 05:22:17 -07:00
Pieter De Baets b1bb0a71d5 Wait for bridge to disappear when running tests
Reviewed By: fkgozali

Differential Revision: D5592347

fbshipit-source-id: c9a672f2d79c8656b72f585aac7c6f5fec6e72b0
2017-08-09 09:50:44 -07:00
Pieter De Baets c984d04f11 Merge fishhook.xcodeproj in RCTWebSocket
Reviewed By: emilsjolander

Differential Revision: D5592235

fbshipit-source-id: dce70c337080041d3660a521359151218c504dd8
2017-08-09 07:48:09 -07:00
Emil Sjolander 878b7e42fa fishhook nwlog_legacy_v to avoid log spam on websocket reconnect
Reviewed By: mmmulani, javache

Differential Revision: D5570896

fbshipit-source-id: be98f500434bd2a0113b9abca20c9f21102c09d1
2017-08-08 08:20:08 -07:00
Pieter De Baets 220034c4d4 Configure requiresMainQueueSetup for core modules
Reviewed By: fkgozali

Differential Revision: D5528305

fbshipit-source-id: f17cad933685be09784b2246f44baf252bfa5a26
2017-08-07 07:04:36 -07:00
Maxime Goovaerts 546a43bda0 Expose offset parameters for ToastAndroid
Reviewed By: brosenfeld

Differential Revision: D5560628

fbshipit-source-id: b1457493e8429958fbd7bc9c490cffaa33b4a95a
2017-08-04 09:07:21 -07:00
Adlai Holler 0f440130b6 Standardize project indentation settings on 2 spaces
Summary:
Hi React Native folks! Love your work!

To make contributing easier, this sets the indentation settings of all the Xcode projects to 2 spaces to match their contents.
Closes https://github.com/facebook/react-native/pull/15275

Differential Revision: D5526462

Pulled By: javache

fbshipit-source-id: cbf0a8a87a1dbe31fceed2f0fffc53839cc06e59
2017-07-31 05:20:03 -07:00
Douglas Lowder 75284d3cd4 Apple TV: Enable long presses on TV remote; dev menu on TV device; example code
Summary:
**Motivation**

Properly support long presses on the Apple TV remote, and also enable dev menu functionality on a real Apple TV device (shaking an Apple TV doesn't work 😄 )

**Test plan**

New example added to `RNTester`.
Closes https://github.com/facebook/react-native/pull/15221

Differential Revision: D5526463

Pulled By: javache

fbshipit-source-id: a61051e86bc82a9561eefc1704bed6b1f2617e05
2017-07-31 04:06:32 -07:00
Tom Clarkson 42f7b9e717 Improved window.postMessage implementation
Summary:
Adds a queue to postMessage so that messages sent close together are not lost.

Setting location="a";location="b" results in only "b" reaching shouldStartLoadWithRequest. Making the second update asynchronous with setTimeout does not fix the issue unless a delay is added.

With this update, postMessage queues "b" until it gets a "message:received" event that confirms "a" has already been processed.

The included test sends two messages from a webview and checks that both are received. It fails against the preexisting code with the first message being dropped.
Closes https://github.com/facebook/react-native/pull/11304

Differential Revision: D5481385

Pulled By: hramos

fbshipit-source-id: 9b6af195eeff8f20c820e2fcdac997c90763e840
2017-07-28 11:35:25 -07:00
Pieter De Baets 6ad5e2fa7c Breaking - Remove AdSupportIOS
Summary: We're focusing the React Native core on a set of high quality essential components and will be removing any modules that do not belong in that set. If you're currently using AdSuppportIOS, it will remain available in the react-native-deprecated-modules archive. There's also alternative implementations such as https://github.com/ptomasroos/react-native-idfa/.

Reviewed By: hramos

Differential Revision: D5388632

fbshipit-source-id: ce6204512b61242a0ba8c731836f3b3b7239b4b0
2017-07-26 13:32:41 -07:00
Philipp von Weitershausen ed903099b4 Add blob implementation with WebSocket integration
Summary:
This is the first PR from a series of PRs grabbou and me will make to add blob support to React Native. The next PR will include blob support for XMLHttpRequest.

I'd like to get this merged with minimal changes to preserve the attribution. My next PR can contain bigger changes.

Blobs are used to transfer binary data between server and client. Currently React Native lacks a way to deal with binary data. The only thing that comes close is uploading files through a URI.

Current workarounds to transfer binary data includes encoding and decoding them to base64 and and transferring them as string, which is not ideal, since it increases the payload size and the whole payload needs to be sent via the bridge every time changes are made.

The PR adds a way to deal with blobs via a new native module. The blob is constructed on the native side and the data never needs to pass through the bridge. Currently the only way to create a blob is to receive a blob from the server via websocket.

The PR is largely a direct port of https://github.com/silklabs/silk/tree/master/react-native-blobs by philikon into RN (with changes to integrate with RN), and attributed as such.

> **Note:** This is a breaking change for all people running iOS without CocoaPods. You will have to manually add `RCTBlob.xcodeproj` to your `Libraries` and then, add it to Build Phases. Just follow the process of manual linking. We'll also need to document this process in the release notes.

Related discussion - https://github.com/facebook/react-native/issues/11103

- `Image` can't show image when `URL.createObjectURL` is used with large images on Android

The websocket integration can be tested via a simple server,

```js
const fs = require('fs');
const http = require('http');

const WebSocketServer = require('ws').Server;

const wss = new WebSocketServer({
  server: http.createServer().listen(7232),
});

wss.on('connection', (ws) => {
  ws.on('message', (d) => {
    console.log(d);
  });

  ws.send(fs.readFileSync('./some-file'));
});
```

Then on the client,

```js
var ws = new WebSocket('ws://localhost:7232');

ws.binaryType = 'blob';

ws.onerror = (error) => {
  console.error(error);
};

ws.onmessage = (e) => {
  console.log(e.data);
  ws.send(e.data);
};
```

cc brentvatne ide
Closes https://github.com/facebook/react-native/pull/11417

Reviewed By: sahrens

Differential Revision: D5188484

Pulled By: javache

fbshipit-source-id: 6afcbc4d19aa7a27b0dc9d52701ba400e7d7e98f
2017-07-26 08:23:20 -07:00
Pieter De Baets f9808f07c8 Fix missing files in OSS build
Reviewed By: danzimm, alexeylang

Differential Revision: D5488648

fbshipit-source-id: 63226fecb374d319e9d5976b724c4c1bdc5181f9
2017-07-26 05:47:22 -07:00
Pieter De Baets cb12080179 Replace exported method registration with statically allocated struct
Reviewed By: fromcelticpark

Differential Revision: D5389383

fbshipit-source-id: 9eb29b254b616574966b43ad24aa880d44589652
2017-07-24 07:01:53 -07:00
Nat Mote 8e8fecdcf8 Upgrade to Flow v0.50.0
Reviewed By: gabelevi

Differential Revision: D5438335

fbshipit-source-id: 7a96f68e7147e984c6f0cb84f957e639d36ca6b3
2017-07-20 14:48:56 -07:00
Miguel Jimenez Esun 737abe3b76 Revert D5388655: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5388655

fbshipit-source-id: 2f92d6ae69f4772195aeca7493f53209388b3ad0
2017-07-19 12:08:38 -07:00
Miguel Jimenez Esun 3103258ca0 BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5388655

fbshipit-source-id: dc403f3d5e2d807529eb8569a85c45fec36a6a3e
2017-07-19 11:04:33 -07:00
Valentin Shergin 603cc48ceb TextInput: Refined contentSize calculation
Summary: This fixes pretty bad issue when contentSize is calculated based on an intrinsic horizontal (width) limitation, not on a real/current horizontal (width) one.

Reviewed By: mmmulani

Differential Revision: D5422114

fbshipit-source-id: 0eb582aeb59d29530990d4faabf2f41baa79c058
2017-07-18 14:46:22 -07:00
Valentin Shergin cb96f1d5d2 TextInput: Unified support of `clearsOnBeginEditing` prop
Summary: The implementation of `clearsOnBeginEditing` was unified and moved to superclass.

Reviewed By: javache

Differential Revision: D5299396

fbshipit-source-id: 98c5494a782cbe4df5b2d6021828eb7b2012f6dc
2017-07-18 14:46:22 -07:00
Felix Oghina 999851a389 Update OSS Fresco dependency
Reviewed By: oprisnik

Differential Revision: D5406106

fbshipit-source-id: 3d928f431701b783fa0862d0dff818ec61d8b737
2017-07-12 07:54:09 -07:00
Adam Miskiewicz 8ea6cea39a MaskedViewIOS -- A way to apply alpha masks to views on iOS
Summary:
It's very important in complex UIs to be able to apply alpha channel-based masks to arbitrary content. Common use cases include adding gradient masks at the top or bottom of scroll views, creating masked text effects, feathering images, and generally just masking views while still allowing transparency of those views.

The original motivation for creating this component stemmed from work on `react-navigation`. As I tried to mimic behavior in the native iOS header, I needed to be able to achieve the effect pictured here (this is a screenshot from a native iOS application):

![iOS native navbar animation](https://slack-imgs.com/?c=1&url=https%3A%2F%2Fd3vv6lp55qjaqc.cloudfront.net%2Fitems%2F0N3g1Q3H423P3m1c1z3E%2FScreen%2520Shot%25202017-07-06%2520at%252011.57.29%2520AM.png)

In this image, there are two masks:

- A mask on the back button chevron
- A gradient mask on the right button

In addition, the underlying view in the navigation bar is intended to be a UIBlurView. Thus, alpha masking is the only way to achieve this effect.

Behind the scenes, the `maskView` property on `UIView` is used. This is a shortcut to setting the mask on the CALayer directly.

This gives us the ability to mask any view with any other view. While building this component (and testing in the context of an Expo app), I was able to use a `GLView` (a view that renders an OpenGL context) to mask a `Video` component!

I chose to implement this only on iOS right now, as the Android implementation is a) significantly more complicated and b) will most likely not be as performant (especially when trying to mask more complex views).

Review the `<MaskedViewIOS>` section in the RNTester app, observe that views are masked appropriately.

![example](https://d3vv6lp55qjaqc.cloudfront.net/items/250X092v2k3f212f3O16/Screen%20Recording%202017-07-07%20at%2012.18%20PM.gif?X-CloudApp-Visitor-Id=abb33b3e3769bbe2f7b26d13dc5d1442&v=5f9e2d4c)
Closes https://github.com/facebook/react-native/pull/14898

Differential Revision: D5398721

Pulled By: javache

fbshipit-source-id: 343af874e2d664541aca1fefe922cf7d82aea701
2017-07-11 15:05:57 -07:00
Seth Fitzsimmons 9afb71fde8 Replace React.createClass with create-react-class
Summary:
This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style.

Fixes #14620
Refs #14712
Closes https://github.com/facebook/react-native/pull/14729

Differential Revision: D5321810

Pulled By: hramos

fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
2017-07-07 14:36:01 -07:00
Christoph Nakazawa e0eee0bb49 Revert D5321193: BREAKING: Add regenerator-runtime on demand, based on the files
Differential Revision: D5321193

fbshipit-source-id: 9113ed78e59ae9e9f3f86ca2fda2db3bd8c0dd7c
2017-07-07 10:48:37 -07:00
Miguel Jimenez Esun 361f03badb BREAKING: Add regenerator-runtime on demand, based on the files
Summary:
Adding a Babel plugin that will analyze the file looking for any potential candidate to use `regenerator-runtime`, and if so, will inject dynamically the module. The module is injected per file, so we avoid polluting the global environment. The plugin is also able to inject the `require` call beforehand, so that the inliner can pick them and inline them.

The Babel plugin is part of `react-native-babel-preset`, so as long as you are using this preset you are safe. If not, you should include the specific transformer into your list of plugins, as `react-native-babel-preset/transforms/transform-regenerator-runtime-insertion.js`.

Reviewed By: davidaurelio

Differential Revision: D5321193

fbshipit-source-id: fd4805b28c8a2b986842e23570a64003370d2067
2017-07-07 07:47:13 -07:00
Pieter De Baets 9108f98ca7 Add type for onLayout
Reviewed By: sahrens

Differential Revision: D5364203

fbshipit-source-id: ad87179422b0e595fc78db21a3108d50ba31564c
2017-07-07 03:06:21 -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