Commit Graph

3828 Commits

Author SHA1 Message Date
Eli White 61d046be3c Flow Type ActionSheetIOS
Reviewed By: sahrens

Differential Revision: D6548474

fbshipit-source-id: dac0cb2cdd85bc49d4302b4382142fd70ab4ecc4
2017-12-13 16:19:21 -08:00
Andrew Imm 71751e9cc7 Allow extending props supported by native animations
Reviewed By: sahrens

Differential Revision: D6523618

fbshipit-source-id: 547ed7ab1a92f01a18006241d7a74af9cac25c58
2017-12-13 13:53:07 -08:00
Spencer Ahrens 2d4bedba0f add CoreEventTypes with LayoutEvent
Reviewed By: mhollweck

Differential Revision: D6554426

fbshipit-source-id: 856fcb8017682bc203fd69f5f4c93704816046ac
2017-12-13 12:02:32 -08:00
Rafael Oleza fbf0aed3ac Implement changes needed to HMRClient to handle wrapped modules from metro
Reviewed By: cpojer

Differential Revision: D6550532

fbshipit-source-id: 606f536cc22df15b248b6a435587e9d2cc7cda57
2017-12-13 04:27:51 -08:00
Valentin Shergin 0a8721c340 Renaming uiManagerWillFlushUIBlocks -> uiManagerWillPerformMounting
Summary:
Because it is not simply flushing, it (in the future) is more complex process. And the names should represent logical meaning of the process, not particular implementation details.
It also nice to have unified terminology across our reactive UI frameworks.

See the next diffs.

Reviewed By: rsnara

Differential Revision: D6436770

fbshipit-source-id: 0a0b686e8ace89e30f6787a37c0a7965c5af757b
2017-12-11 17:10:48 -08:00
Oleg Lokhvitsky dab313a0de Revert D6437807: [react-native][PR] Generalize ActionSheetManager items URL
Differential Revision: D6437807

fbshipit-source-id: 2d859c7e4d88950ec070813ec40f08685a5d6b44
2017-12-11 11:07:43 -08:00
Paco Estevez Garcia 1d16923063 Add remote API to uninstall the global error handler in RN
Reviewed By: fromcelticpark

Differential Revision: D6426209

fbshipit-source-id: 804e73e0dc4e4b85b336e3627c00840d2ff3c9d6
2017-12-11 08:06:24 -08:00
Spencer Ahrens 3bcb912786 Report all errors from running tests
Reviewed By: jingc

Differential Revision: D6526057

fbshipit-source-id: 00ebbb42aab17295350a24b92773c04593452608
2017-12-08 16:46:55 -08:00
Yujie Liu 8f9b291224 Providing an API to load assets from a different directory
Differential Revision: D6368586

fbshipit-source-id: 2a79ba45de3d9c95d0b1b296c9e1ae35cbd33c36
2017-12-08 15:01:40 -08:00
Brian Shin 5ee27ff755 Fork Platform with a modified API
Reviewed By: sahrens

Differential Revision: D6501208

fbshipit-source-id: c4dbe9d5491f2d42e1a84a61758025e5b2dfa0fe
2017-12-08 14:17:19 -08:00
Jean Lauliac a7b231a327 metro: introduce asyncRequire function
Reviewed By: davidaurelio

Differential Revision: D6498107

fbshipit-source-id: a9c4ab634e60f19b7058205eddcd248f57f63500
2017-12-07 10:53:20 -08:00
Gustavo Gard 8547b7e111 Correct logo URL
Summary:
Added static files to remove dependency with `react` website, related PR https://github.com/facebook/react-native/pull/16204

After is merged to master, check if all the URLs are working correctly.

TheSavior
Closes https://github.com/facebook/react-native/pull/16207

Differential Revision: D6509133

Pulled By: hramos

fbshipit-source-id: a31dcc07742211dc17046e7e98d805c2282f2a82
2017-12-07 08:31:38 -08:00
David Buchan-Swanson 76a2ca4c9c Fix some flow errors that appear
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

There are some errors I noticed after upgrading my flow version.  I had them in my project, and they were also reported in #11655.  These errors were ignored on master, but I went through and fixed them so the static analysis will work still.

After these changes, I receive no errors using flow `0.60.1` on latest master, or using `0.59` in my local project (which does not have the requisite ignores included).

- init a new project
     `react-native init --version <path-to-repo> helloworld`
- add the flow binary
     `yarn add -D flow-bin`
- run flow
     `yarn flow`
- make sure there are no errors in the project.
     ```
     No errors!
       Done in 23.60s.
     ```

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[GENERAL][BUGFIX][./Libraries] - Fix up some flow definitions
Closes https://github.com/facebook/react-native/pull/17086

Differential Revision: D6509112

Pulled By: hramos

fbshipit-source-id: a61145b5306c666ab6510ccb9eea02d96f3decb3
2017-12-07 08:31:37 -08:00
Jean Lauliac 1988ba1d79 react-native: BundleSegments: remove async/await
Reviewed By: fromcelticpark

Differential Revision: D6508646

fbshipit-source-id: 9e5c05bde5420cb030912eb187f6333af4b580f9
2017-12-07 07:16:27 -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 a99f0d6100 Temporarily patched Map/Set non-extensible check into RN dev renderer
Reviewed By: jingc

Differential Revision: D6461125

fbshipit-source-id: 8b30a22db4e357717f1c4f4e21a85ddef02d97d1
2017-12-05 12:27:12 -08:00
Eric Davison 36ad813899 Adding support for custom accessibility actions on iOS.
Summary:
This feature has been requested by customers.  Our previous (pre-react) application had support for custom accessibility actions.

This feature allows UI elements to provide a list of custom actions that can be read when VoiceOver is enabled.  UI elements expose one accessibility action by default.  Some UI elements may support multiple actions though other mechanisms like tap and hold.  To expose these actions in an accessible way iOS provides custom accessibility actions.

Feature was tested in the iOS simulator using the Accessibility Inspector.  Custom actions were added to a button and observed in the tool.  Custom actions were also invoked using the tool and then stepped through in the debugger.

The feature was also tested on an iPhone.  VoiceOver was enabled on the device and custom actions were observed for controls that exposed them.

We have been using this feature in our app for some time as well.

[IOS] [ENHANCEMENT] [Accessibility] - Added support for custom accessibility actions

Eric Davison
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/17020

Differential Revision: D6472283

Pulled By: shergin

fbshipit-source-id: 4ac4697dca07028e87ffe71b70c00280e7f2043c
2017-12-04 23:31:50 -08:00
Marshall Roch c8e72bb8b8 @allow-large-files [flow] deploy flow 0.60
Reviewed By: gabelevi

Differential Revision: D6466441

fbshipit-source-id: c51eeb53a2465498ad77b3865b5f8c03758d1d35
2017-12-04 13:31:21 -08:00
Mehdi Mulani 1e1e491246 Avoid memory leak in RCTWebSocketModule
Summary: Though this module is dev-only, if not connected to the packager it will collect websockets forever. Some estimate it'll take up 200MB after like 20 minutes.

Reviewed By: shergin

Differential Revision: D6464304

fbshipit-source-id: bef1ce967e4c13dd29e3c7ab4228e9c88d02c157
2017-12-04 09:34:19 -08:00
Koen Punt ad4450ac13 prevent scheduling unnecessary layoutanimation
Summary:
when a hardware keyboard is connected, the virtual keyboard can be hidden (this can easily be demonstrated in the simulator), which means the height of the keyboard is 0. When in this case a `LayoutAnimation` is scheduled, the `KeyboardAvoidingView` won't be affected, but the next layout change will be animated, which can have unintended side-effects. This can also trigger the `Overriding previous layout animation with new one before the first began` warning.

<details>
<summary>Screenshot</summary>

![image](https://user-images.githubusercontent.com/351038/33261130-22cf2e0c-d362-11e7-8629-0cc70cda67d8.png)

</details>

Open the `KeyboardAvoidingView` example in the `RNTester` project, import `LayoutAnimation` and add something rendered conditionally to the content of the `Modal`, e.g.;

```jsx
{this.state.behavior === 'position' &&
  <Text>We're using position now</Text>
}
```

Then update the `onSegmentChange` handler with a `LayoutAnimation`;

```js
onSegmentChange = (segment: String) => {
  LayoutAnimation.easeInEaseOut();
  this.setState({behavior: segment.toLowerCase()});
};
```

Now open the example in the simulator and play with the "Toggle Software Keyboard" option;

![image](https://user-images.githubusercontent.com/351038/33262149-9ba182fa-d365-11e7-9491-890928656f5d.png)

Now when you focus the input, no keyboard should appear, and when you then press an option of the segmented control, you should get the beforementioned warning.

After this change this warning will no longer appear, but the component still behaves the same as before.

[IOS] [BUGFIX] [KeyboardAvoidingView] - prevent scheduling unnecessary `LayoutAnimation`
Closes https://github.com/facebook/react-native/pull/16984

Differential Revision: D6472300

Pulled By: shergin

fbshipit-source-id: c4041dfdd846cdc88b2e9d281517ed79da99dfe7
2017-12-03 21:15:29 -08:00
Valentin Shergin e9e0cd7ab8 RCTSurface: Couple helper functions for Stage
Summary: We need this trivial funcs to unify spinner appearance logic.

Reviewed By: rsnara

Differential Revision: D6367072

fbshipit-source-id: 70e288bc1fed5911828a5f6deaa829597bf8ebff
2017-12-03 20:16:35 -08:00
garlic-rice-with-butter 6e1db1f1ee Change doc link to point to AnimatedValueXY
Summary:
Currently goes to the same page

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Online doc was not helpful because the link kept going to the wrong page. Someone told me to make a pull request

Documentation change
Go to original link https://facebook.github.io/react-native/docs/animated.html#animatedvaluexy
See that it does not have any info on valuexy

Go to https://facebook.github.io/react-native/releases/next/docs/animatedvaluexy.html
See that the page loads and has information about valuexy

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Closes https://github.com/facebook/react-native/pull/16999

Differential Revision: D6467512

Pulled By: shergin

fbshipit-source-id: 69887e34446c3ea57ad831ed870be4e1a8a7a514
2017-12-01 23:32:35 -08:00
Alexey Lang dfebcb70a5 Don't set global.performance to undefined if it was initialized already
Reviewed By: gaearon

Differential Revision: D6448731

fbshipit-source-id: 8c8c6ff393e452c863f54c83c2e4394fd535dfc5
2017-12-01 02:46:18 -08:00
Edgar Aroutiounian 554e873f58 Implement deletion of asset-library files
Summary:
WIP: Starting point insofar as I'm not sure if there should be an Android equivalent.

My application needs me to delete photos from the photos in iOS.

I have tested this in my application and it works, have a screenshot from iOS asking as well and it does successfully delete the photos from the global Photos app.

Related to https://github.com/facebook/react-native/issues/15253, it kind of continues using the deprecated assets-library framework, but that does need (and will be an bigger and bigger issue coming up) of assets-library URLs being used.

I also assume RN prefers error handling at the JS level? Are the URLs starting with `asset-library`, etc.
Closes https://github.com/facebook/react-native/pull/15481

Differential Revision: D6438016

Pulled By: hramos

fbshipit-source-id: 47512140f62f458c14ad2ade2b358846e168c964
2017-11-29 12:18:08 -08:00
Edgar Aroutiounian 2e424fb113 Generalize ActionSheetManager items URL
Summary:
Not ready but want to start conversation.  (i.e. not sure if to change key name to `urls` from `url`)

I want to be able to share more than 1 image at a time, the current code only lets one use one url, but the API allows for much more.

Some places already make this an issue:

https://github.com/EstebanFuentealba/react-native-share/issues/85

And I also need to be able to email/send on iMessage, etc with multiple URL resources.
Closes https://github.com/facebook/react-native/pull/15475

Differential Revision: D6437807

Pulled By: hramos

fbshipit-source-id: 336c696c5633c0080904ca9306a38120e27f9173
2017-11-29 12:01:48 -08:00
Spencer Ahrens c6fe101cdc export SeparatorsObj type for re-use in ListItems etc.
Differential Revision: D6354300

fbshipit-source-id: 3fd4c86ef1d190fb544f2c6fccb638ffe3ced378
2017-11-29 10:53:51 -08:00
Brian Vaughn cd938d731c React sync for revisions 2d23a45...9491dee
Reviewed By: flarnie

Differential Revision: D6436328

fbshipit-source-id: 370b862c23c9804bd6df72812d08baceaebfca78
2017-11-29 10:16:58 -08:00
Chris Lewis 22a1419900 Fix $FlowFixMe in Flatlist
Summary:
$FlowFixMe suppressed type validation on _listRef. Add appropriate typing to let Flow succeed when $FlowFixMe is removed.

Not sure what this project's philosophy around ref types is. In some places I've seen them annotated as any rather than trying to get a more granular type to match. I'm open to suggestions.

`yarn flow`

[INTERNAL] [ENHANCEMENT] [FlatList.js] - Remove $FlowFixMe from FlatList
Closes https://github.com/facebook/react-native/pull/16882

Differential Revision: D6386479

Pulled By: hramos

fbshipit-source-id: bed14f2c7071525cb46425ab14214771de0277f3
2017-11-29 09:15:50 -08:00
Christoph Nakazawa 654fed46f4 Rename metro-bundler to metro
Reviewed By: davidaurelio

Differential Revision: D6413420

fbshipit-source-id: f13184b8157de2c3aeaa7f2647becc175f62cdbb
2017-11-29 03:35:29 -08:00
Yujie Liu d1fc8ef3a3 Fix embeddedBundleURL update situation
Reviewed By: zahanm

Differential Revision: D6432397

fbshipit-source-id: 163319c3c02976bcb49be3f0a54ce2928d0395f3
2017-11-28 19:46:20 -08:00
Álvaro Medina Ballester 0c8a3e4f79 closes #13034 Fixes the ScrollViewMock methods
Summary:
Solves https://github.com/facebook/react-native/issues/13034

Now the `ScrollView` mock has all the methods available.

React Native tests pass.

To test this specific part of the code,

```sh
$ react-native init Test
$ cd Test/
$ yarn add react-navigation
```

Then, add a simple project that uses `react-navigation`:

```js
import React from 'react';
import { Text } from 'react-native';
import { StackNavigator } from 'react-navigation';

class HomeScreen extends React.Component {
  static navigationOptions = {
    title: 'Welcome',
  };
  render() {
    return <Text>Hello, Navigation!</Text>;
  }
}

const SimpleApp = StackNavigator({
  Home: { screen: HomeScreen },
});

export default SimpleApp
```

Run the default render tests:

```js
$ npm run test
```
Closes https://github.com/facebook/react-native/pull/13048

Differential Revision: D4746028

Pulled By: shergin

fbshipit-source-id: cb1791978d15be7f5d14b7b22979388066ad6caa
2017-11-28 12:32:37 -08:00
David Detlefs 05e862d48d Add Systrace-based telemetry to Hermes GC.
Reviewed By: amnn

Differential Revision: D6393879

fbshipit-source-id: d35a4647d000356dc99bce3187acc50d3a69ddeb
2017-11-23 15:15:54 -08:00
Leland Richardson b6f1a6085f Increase prepare js timeout
Summary:
We run into this timeout virtually every live-reload now, which I believe is just a function of the size of our React Native code base. Looking at the code, right now the prepare JS call is run and retried 3 times, with a wait/timeout of 1s each. On android, it's done 3 times with a wait/timeout of 5s on each. For consistency, I've updated it to be the same timeout as on android. Trying this with our project, we no longer get red-boxes when we live-reload for the first time.

I've run this on our project locally, and it fixed the issue. It's a very simple change, so I don't believe any additional testing should be needed.

[IOS][BUGFIX][RCTWebsocketExecutor] - Increased timeout to prevent false-positive redbox during development of large RN code base
Closes https://github.com/facebook/react-native/pull/16794

Differential Revision: D6387545

Pulled By: shergin

fbshipit-source-id: c6e58fb82e072c01f9e1277a58d2640d6140a8c7
2017-11-21 14:01:20 -08:00
Adam Ernst 9180d4eb82 Make RCTPackagerConnection a singleton
Reviewed By: fromcelticpark

Differential Revision: D6361741

fbshipit-source-id: 96e92dff5dd3d7aa1f7555442b0eba90e7dbf47c
2017-11-20 18:36:27 -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
Kevin Brown 0ff576081b Corrected types of page_info return value in documentation.
Summary:
I was confused by the current documentation, as it was requesting me to pass the previously received `end_cursor` into the next fetch but it was declared as a boolean. I checked in the debugger and it's just mislabeled in the docs, so this PR fixes the docs.

I tried to push this change back in #15472 but wasn't able to undo the borked rebase, so I'm submitting a new PR.

This is a change to documentation only.

[DOCS] [BUGFIX] [Libraries/CameralRoll/CameraRoll.js] - Corrected return type in the documentation for the `start_cursor` and `end_cursor` values.
Closes https://github.com/facebook/react-native/pull/16830

Differential Revision: D6371585

Pulled By: hramos

fbshipit-source-id: 5038041e95a04ea4c2de8d2b535a8a4e019289f6
2017-11-19 17:45:55 -08:00
Nathan Brown 44c16499fd Mention <ImageBackground> when error is thrown
Summary:
Improve the error message shown when you try to nest components in an
`<Image>` component by referencing the `<ImageBackground>` component.

It would be helpful if the error message displayed when you try to nest components in an `<Image>` component mentioned the `<ImageBackground>` component. Especially since this component is not yet well documented.

[IOS][MINOR][Libraries/Image/Image.ios.js] - Surfaced `<ImageBackground>` in error message
[ANDROID][MINOR][Libraries/Image/Image.android.js] - Surfaced `<ImageBackground>` in error message
Closes https://github.com/facebook/react-native/pull/16880

Differential Revision: D6369396

Pulled By: shergin

fbshipit-source-id: c4ae4dbb77d0fce6cbd7a42d1957d16112b24549
2017-11-18 17:27:58 -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
Rafael Oleza 231c7a0304 Add end to end Delta support to Android devices
Reviewed By: davidaurelio

Differential Revision: D6338677

fbshipit-source-id: 8fa8f618bf8d6cb2291ce4405093cad23bd47fc3
2017-11-17 07:47:38 -08:00
Logan Daniels d19d137cc1 Fix minimumViewTime in ViewabilityHelper
Reviewed By: sahrens

Differential Revision: D6350352

fbshipit-source-id: e909600875156127eb3144726981ab62e0015e6e
2017-11-16 20:15:46 -08:00
Héctor Ramos 64d80b13db Migrate to new documentation format
Summary:
Now that the Component and API docs are no longer auto-generated, we need to consolidate on a new format for our jsdoc comments. Any help from the community will be appreciated.

In this initial pull request, we'll be tackling the following docs:

- `AccessibilityInfo`, an API doc.
- `ActivityIndicator`, a Component doc.
- `View`, a Component doc.

This top comment will serve as a style guide, and when in doubt, please refer to the individual commits in this PR.

Each commit should update a single component or API, along with any relevant markdown files.

- Documentation in the JavaScript source files should be succinct. Any verbosity should be moved over to the markdown docs in the website...
- ...by adding a link to the relevant method/prop on the website to every comment block.
- Avoid markdown style links in JavaScript source files, opt for plain old URIs.

Let code document itself:

- If a method is Flow typed, the comment block does not need to repeat this information.
- If a param can be one of several values, and the type definition is easily determined from the code, the values should not be repeated in the comment block. Again, move this to the markdown doc if not present already.
Closes https://github.com/facebook/react-native/pull/16790

Differential Revision: D6353840

Pulled By: hramos

fbshipit-source-id: 9712c459acc33092aae9909f3dd0b58a00b26afc
2017-11-16 17:04:45 -08:00
Ashok Menon 52e3ae9063 Unify Systrace native hook argument passing.
Reviewed By: javache

Differential Revision: D6316024

fbshipit-source-id: c1b315fac2c3cf8558d0c9eb0eb2c7d3efe5c64f
2017-11-16 08:01:06 -08:00
Brian Vaughn c7f37074ac React sync for revisions 589c0a2...2d23a45
Reviewed By: acdlite

Differential Revision: D6328351

fbshipit-source-id: 88dc0f6ec9947e4a908c21f3a3df46bca5a7fdbc
2017-11-15 09:16:18 -08:00
Naman Goel da047966e4 Improve types for React Native styles.
Reviewed By: TheSavior

Differential Revision: D6226807

fbshipit-source-id: b64a77383e6e685f4017c47fc9a5095ed63b062c
2017-11-14 13:18:33 -08:00
Wei Yeh 58edf024a1 Fix typo in SafeArea documentation
Reviewed By: shergin

Differential Revision: D6316656

fbshipit-source-id: 12d37f9d8ad2481b7f6685c8d675ce84234bd814
2017-11-14 10:32:15 -08:00
Kevin Gozali 28d5d6baf1 Fix asset resolver url handling
Summary:
1. file:// may get prepended to an http:// source URL during dev mode, making an invalid URL
2. the logic to detect `isLoadedFromFileSystem()` should've checked for file:// protocol to not get confused by http:// URL

Reviewed By: zahanm

Differential Revision: D6307187

fbshipit-source-id: e7e7a41bf721dd0601b0c1877e278e1e435ef5e2
2017-11-12 23:01:40 -08:00
Chris Zheng 266ab7a006 Pass scriptURL to RCTTestRunner
Summary:
Pass scriptURL to RCTTestRunner.
If the scriptURL passed to RCTTestRunner is not nil, then RCTTestRunner will use it.
else, RCTTestRunner will use whatever it has before.

Differential Revision: D6215186

fbshipit-source-id: c3a5643021d60579fc8e60a69de150f6a4a39237
2017-11-12 13:36:22 -08:00
Wenjing Wang d79e245d19 AMA changes to support disk cache
Reviewed By: fred2028

Differential Revision: D6295287

fbshipit-source-id: 70ae7dfba2edb36e758ad0e22916015038108d36
2017-11-12 13:03:41 -08:00
Valentin Shergin aa83b5a0ca Introducing RCTSurfaceBackedComponent
Summary:
RCTSurfaceBackedComponent is ComponentKit component represents a React Native Surface created
(and stored in the state) with given `bridge`, `moduleName`, and `properties`.

Differential Revision: D6217103

fbshipit-source-id: 2849f68e1975562cd47851bda232e389705b4229
2017-11-11 21:25:47 -08:00
Valentin Shergin e75bd87a76 Introducing RCTSurfaceHostingComponent
Summary: RCTSurfaceHostingComponent is ComponentKit component represents given Surface instance.

Differential Revision: D6217104

fbshipit-source-id: 50805d97e744de24a188bc97b33de4709e785aae
2017-11-11 21:25:47 -08:00
Caleb Meredith eb0d6470e5 Flow 0.59 xplat/js deploy
Reviewed By: avikchaudhuri

Differential Revision: D6300238

fbshipit-source-id: a6839fa2a9bbc50c3832a3f5b1cac2a6d2bd96b7
2017-11-10 21:15:48 -08:00
Brian Solon 58c3bc4901 Fix typo in Image.android.js & Image.ios.js
Summary:
Fixing a typo.

N/A

[IOS] [MINOR] [Image] - Fixed a typo in an error message
[ANDROID] [MINOR] [Image] - Fixed a typo in an error message
Closes https://github.com/facebook/react-native/pull/16777

Differential Revision: D6295564

Pulled By: shergin

fbshipit-source-id: eb6274701b6406f26b9eda1c35632cb2ce0392d7
2017-11-09 22:30:24 -08:00
Yujie Liu a329e968fc resolve iOS assets from embedded bundle path for iOS platform
Reviewed By: zahanm

Differential Revision: D6193907

fbshipit-source-id: 09c76a5c3d6a7777a9a823c21bfcc0fe344bc83e
2017-11-09 19:02:55 -08:00
Douglas 45185947ee Fix tvOS compile issues; enable TVEventHandler in Modal (fix #15389)
Summary:
**Motivation**

Fix an issue (#15389) where `TVEventHandler` would not work when a modal was visible.  The solution adds the gesture recognizers from the native `RCTTVRemoteHandler` to the native modal view (except for the menu button recognizer, which still needs special handling in modals).  This PR also fixes some breakages in compiling React Native for tvOS.

**Test plan**

Compilation fixes should enable tvOS compile test to pass in Travis CI.

The modal fix can be tested with the following component, modified from the original source in #15389 .

``` javascript
import React, { Component } from 'react';
import ReactNative from 'ReactNative';
import {
    Text,
    View,
    StyleSheet,
    TouchableHighlight,
    TVEventHandler,
    Modal,
} from 'react-native';

export default class Events extends Component {

    constructor(props) {
        super(props);

        this.state = {
            modalVisible: false,
        };
        this._tvEventHandler = new TVEventHandler();
    }

    _enableTVEventHandler() {
        this._tvEventHandler.enable(this, (cmp, evt) => {
            const myTag = ReactNative.findNodeHandle(cmp);
            console.log('Event.js TVEventHandler: ', evt.eventType);
            // if (evt.eventType !== 'blur' && evt.eventType !== 'focus') {
            //  console.log('Event.js TVEventHandler: ', evt.eventType);
            // }
        });
    }

    _disableTVEventHandler() {
        if (this._tvEventHandler) {
            this._tvEventHandler.disable();
            delete this._tvEventHandler;
        }
    }

    componentDidMount() {
        this._enableTVEventHandler();
    }

    componentWillUnmount() {
        this._disableTVEventHandler();
    }

    _renderRow() {
        return (
            <View style={styles.row}>
                {
                    Array.from({ length: 7 }).map((_, index) => {
                        return (
                            <TouchableHighlight
                                key={index}
                                onPress={() => { this.setState({ modalVisible: !this.state.modalVisible }); }}
                            >
                                <View style={styles.item}>
                                    <Text style={styles.itemText}>{ index }</Text>
                                </View>
                            </TouchableHighlight>
                        );
                    })
                }
            </View>
        );
    }

    onTVEvent(cmp, evt) {
      console.log('Modal.js TVEventHandler: ', evt.eventType);
    }

    hideModal() {
      this.setState({
        modalVisible: false
      });
    }

    render() {
        return (
            <View style={styles.container}>
                <Modal visible={this.state.modalVisible}
                       onRequestClose={() => this.hideModal()}>
                    <View style={styles.modal}>
                        { this._renderRow() }
                        { this._renderRow() }
                    </View>
                </Modal>
                { this._renderRow() }
                { this._renderRow() }
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: 'darkslategrey',
    },
    row: {
        flexDirection: 'row',
        padding: 30,
    },
    item: {
        width: 200,
        height: 100,
        borderColor: 'cyan',
        borderWidth: 2,
        margin: 30,
        alignItems: 'center',
        justifyContent: 'center',
    },
    itemText: {
        fontSize: 40,
        color: 'cyan',
    },
    modal: {
        flex: 1,
        backgroundColor: 'steelblue',
    },
});
```
**Release Notes**

After this change, the `onRequestClose` property will be required for a `Modal` in Apple TV.
Closes https://github.com/facebook/react-native/pull/16076

Differential Revision: D6288801

Pulled By: hramos

fbshipit-source-id: 446ae94a060387324aa9e528bd93cdabc9b5b37f
2017-11-09 13:54:54 -08:00
Alexey Lang 1f40c95076 Fix sections that come from React Fiber
Reviewed By: fkgozali

Differential Revision: D6235187

fbshipit-source-id: 55a49da9d81204f7a6199420beca1b096f7ea212
2017-11-09 13:05:07 -08:00
Jessica Cao 780938170b Backed out changeset eadb184eacdf
Reviewed By: fkgozali, hramos

Differential Revision: D6287083

fbshipit-source-id: 43c6e43a9d5411e71f51824f9443559b4e0a47e2
2017-11-09 12:57:14 -08:00
James Isaac 820cfa1f3b Refine StyleSheet Flow types
Summary:
Nice addition of the recent Flow types for style props in 9c29ee1504, however I think there are some slight issues in the definition.

`type Styles = {[key: string]: Object}` makes sense, as it's referring to the set of named style groups a user creates a `StyleSheet` from, e.g.

```javascript
const styles: StyleSheet = StyleSheet.create({
  container: {
    height: 20
  },
  text: {
    color: '#999',
    fontSize: 12,
  },
}: Styles)
```

However `type StyleValue = {[key: string]: Object}` doesn't make sense.  You actually want only the `Object` portion of that definition, presuming it's meant to be used like below:

```javascript
type MyTextProps = {
  style: StyleProp,
}

<MyText style={{ color: '#999', fontSize: 12 }}>Hello</Text>
```

 ---

I've also added `void` to the `StyleValue`, as undefined seems to be handled fine, and can be a useful shorthand in JSX.

 ---

And finally, I've allowed nesting of style prop arrays, by making StyleProp self-referencing, as RN seems to flatten those without issue.  This can be important if you're passing in a style prop quite high up the component tree, and sticking it in an array with other styles at several points while it's passed down.

N/A (These types aren't referenced anywhere else)

[INTERNAL] [MINOR] [StyleSheet] - Refine Flow types
Closes https://github.com/facebook/react-native/pull/16741

Reviewed By: frantic

Differential Revision: D6278010

Pulled By: TheSavior

fbshipit-source-id: 0170a233ab71d29f445786f5e695463f9730db3a
2017-11-09 11:58:15 -08:00
Erik Behrends 354e1cb508 Fix missing return in example
Summary:
Found this minor issue while reading the docs.

n/a

 [DOCS] [BUGFIX] [Libraries/Text/Text.js] - Add return to example
Closes https://github.com/facebook/react-native/pull/16752

Differential Revision: D6274215

Pulled By: hramos

fbshipit-source-id: ef735eb9179ab69d2ed1bc4a8b5e921d42d88fb0
2017-11-08 12:17:44 -08:00
Yujie Liu 1d6ce2311f Rename scaledAssetURLScript function to scaledAssetURLNearBundle
Reviewed By: zahanm

Differential Revision: D6272905

fbshipit-source-id: bff661fcadd73a5400cea422a8a5ac5db34717a8
2017-11-08 12:17:44 -08:00
Alex Dvornikov 963c61d4d5 Rename BundleFetcher to SegmentFetcher
Reviewed By: jeanlauliac

Differential Revision: D6271908

fbshipit-source-id: ed1259148ac5ca44789166e22d519a7a21f4cfd9
2017-11-08 07:46:26 -08:00
Miguel Jimenez Esun 16bbd908e7 Update Jest to 21.3.0-beta.8
Reviewed By: davidaurelio

Differential Revision: D6221784

fbshipit-source-id: 189e895378635dd21d14d6fb1f93510a52c90742
2017-11-08 07:03:30 -08:00
Yujie Liu b0193b098c Rename bundleUrl to jsbundleURL
Reviewed By: fkgozali

Differential Revision: D6236921

fbshipit-source-id: f1018836465ba6cf21679fe9d21c18eec762199d
2017-11-07 17:46:17 -08:00
Garrett McCullough cb6ec7c321 improve docs for KeyboardAvoidingView
Summary:
The documentation for `KeyboardAvoidingView` was pretty thin. Tried to fill it out more and corrected a couple words.

n/a

[DOCS] [ENHANCEMENT] [KeyboardAvoidingView] - Improve the documentation for the props for KeyboardAvoidingView

* **Who does this affect**: Users that are manually calling the methods on KeyboardingAvoidingView.
* **How to migrate**: Add an underscore before the name of the method
* **Why make this breaking change**: These methods are not meant to be public. For example, the exposed `onLayout` function is not a prop that accepts a function like is typical of the rest of React Native but is the internal method that is called when the component's onLayout is triggered.
* **Severity (number of people affected x effort)**: Low
Closes https://github.com/facebook/react-native/pull/16479

Differential Revision: D6261005

Pulled By: hramos

fbshipit-source-id: 7e0bcfb0e7cb6bb419964bd0b02cf52c9347c608
2017-11-07 11:57:22 -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
Adriano Melo e906525e84 Docs: Add example to CheckBox documentation
Summary:
I find it easier to understand the behavior of a component when there is a simple example showing its usage. I recently used the CheckBox component and noticed that it doesn't have a code example. This PR adds an example to the CheckBox documentation.

N/A

[DOCS][ENHANCEMENT][CheckBox] - Added example to documentation
Closes https://github.com/facebook/react-native/pull/16489

Differential Revision: D6260998

Pulled By: hramos

fbshipit-source-id: 7c6f9677741a4c0483eb1f5405cd05f8bbdd83aa
2017-11-07 11:06:44 -08:00
Adriano Melo 45ed142596 Docs: Improve BackHandler documentation (addEventListener and removeEventListener)
Summary:
This commit adds documentation to two methods of BackHandler API, addEventListener and removeEventListener. Despite being a simple change, it helps to keep the documentation consistent.

I have tested the `./website` locally, the changes look similar to some other components such as `NetInfo`.

[DOCS][ENHANCEMENT][BackHandler] - Improve BackHandler documentation (addEventListener and removeEventListener)
Closes https://github.com/facebook/react-native/pull/16618

Differential Revision: D6260935

Pulled By: hramos

fbshipit-source-id: ab04a9fca89ddaa1925844b5754caf1c355a9329
2017-11-07 10:53:59 -08:00
Chris Lewis 1c04ceeb4b Check against integer overflow in RCTNetworking decodeTextData
Summary:
It's currently possible to crash React Native on iOS when using XMLHTTPRequest with onreadystatechange by having the server send a bunch of bad unicode (we found the problem when a bad deploy caused this to happen).

This is due to an integer overflow when handling carryover data in decodeTextData.

Create Express server with mock endpoint:

```js
var express = require('express');
var app = express();

app.get('/', function(req, res) {
  res.writeHead(200, {'content-type': 'text/plain; charset=utf-8'});
  res.flushHeaders();
  res.write(new Buffer(Array(4097).join(0x48).concat(0xC2)));
  res.write(new Buffer([0xA9]));
  res.end();
});

app.listen(3000);
```

Create React Native application which tries to hit the endpoint:

```js
export default class App extends Component<{}> {
  componentDidMount() {
    const xhr = new XMLHttpRequest()
    xhr.open('get', 'http://localhost:3000', true);
    xhr.onreadystatechange = function () {
      if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
        console.warn(xhr.responseText);
      }
    };
    xhr.send();
  }

  render() {
    return null;
  }
}
```

Observe that the application crashes when running master and doesn't when including the changes from this pull request.

[IOS] [BUGFIX] [RCTNetworking] - |Check against integer overflow when parsing response|
Closes https://github.com/facebook/react-native/pull/16286

Differential Revision: D6060975

Pulled By: hramos

fbshipit-source-id: 650e401a3bc033725078ea064f8fbca5441f9db5
2017-11-07 08:08:41 -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
William Li 26038f50bb Export YellowBox API
Summary:
Allow end users to access the YellowBox API so that warnings can be properly ignored via the API first introduced in a974c140db. Based on that API, you should be able to do the following:

```
import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['Warning: ...']);
```

However, if you actually try this today, it results in a broken import error.

Verified using an expo instance. First tried without the YellowBox import, observed a failure to import. Then I added the import statement, and observed no warning on my device.

```
import React from 'react';
import { StyleSheet, Text, View, YellowBox } from 'react-native';

YellowBox.ignoreWarnings(['hey']);

export default class App extends React.Component {
  render() {
    console.warn('hey!');
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

[GENERAL] [ENHANCEMENT] [YellowBox] - Export YellowBox API so warnings can be ignored using a non-deprecated API.
Closes https://github.com/facebook/react-native/pull/16709

Differential Revision: D6254819

Pulled By: hramos

fbshipit-source-id: ff92f32e4dedfb01f6902f54fabc62eb64468554
2017-11-06 17:44:37 -08:00
Jessica Cao 2be3ae1ff2 Add ?Fbt to flow type for the title & message props
Differential Revision: D6253195

fbshipit-source-id: eadb185eacdf341393d73357beab22bed1d0169e
2017-11-06 16:24:22 -08:00
Patrick Kempff 1ee64ccb8a Add tintColor to ActionSheetIOS documentation
Summary:
This pr adds documentation for the tintColor addition of #4590

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

The tintColor was missing from the documentation but works perfectly fine.

Added a tintColor to showActionSheetWithOptions and showShareActionSheetWithOptions in the app i am building right now.

[DOCS][MINOR][ActionSheetIOS] - Added documentation for tintColor in ActionSheet.
Closes https://github.com/facebook/react-native/pull/16679

Differential Revision: D6248070

Pulled By: shergin

fbshipit-source-id: a2276f50b42ff2c5858008f3641c9607f248744a
2017-11-06 10:39:55 -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
Jean Lauliac b9f21dc2be react-native: BundleSegments
Reviewed By: davidaurelio

Differential Revision: D6231309

fbshipit-source-id: 565cbadedc5fd8ab25025b5846c098f24fb15a82
2017-11-06 03:46:35 -08:00
Wei Yeh e0202e459f Fix a few more Flow warnings
Differential Revision: D6236901

fbshipit-source-id: d98c46cce83ddb45d7f9139d981595eaaeeff933
2017-11-05 12:07:46 -08:00
Robert Paul fd9c3618fc - Adding locale prop to DatePickerIOS
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

While building a React Native application, I've come across the use case of wanting to set a specific locale for DatePickers irrespective of the users OS region setting. Since this is a feature available to native DatePicker components, I think it would be helpful to expose this in React Native as well.

Testing can be done by passing a `locale` prop to a DatePickerIOS. Example:

```
<DatePickerIOS
  date={this.state.date}
  mode="date"
  locale="fr_FR"
  onDateChange={date => this.setState({ date: date })}
/>
```

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[IOS][ENHANCEMENT][DatePickerIOS] - Adding a locale prop.
Closes https://github.com/facebook/react-native/pull/16639

Differential Revision: D6241981

Pulled By: hramos

fbshipit-source-id: 77b1b85c09f3e12d6b3e103b3d1ffd1f12e2cea9
2017-11-04 14:40:24 -07:00
Jia Li 59a5dbc0b0 Revert D6210177: react-native: BundleSegments
Differential Revision: D6210177

fbshipit-source-id: 8cb4ee37cd03698e9f3980a9819269086a9d6eab
2017-11-02 12:01:05 -07:00
Avik Chaudhuri a48da14800 @allow-large-files Flow 0.58 upgrade for xplat/js
Reviewed By: yungsters

Differential Revision: D6219339

fbshipit-source-id: f003111500ef5971b9a95f26d43cee6644c16abe
2017-11-02 10:51:14 -07:00
Jean Lauliac 74371bc50d react-native: BundleSegments
Reviewed By: davidaurelio

Differential Revision: D6210177

fbshipit-source-id: c39e4118389a9739e9e70ba34feb5d335a7f2546
2017-11-02 10:01:25 -07:00
Mehdi Mulani e3bb65c62c Remove retain cycle in RCTTextField/RCTTextInput
Reviewed By: shergin

Differential Revision: D6214271

fbshipit-source-id: 4ac7e70f8ead23ac533badaed15d4a939a1965db
2017-11-02 08:51:34 -07:00
Miguel Jimenez Esun 3d7cf4f0cf Fix encoding of various files
Reviewed By: jeanlauliac

Differential Revision: D6220214

fbshipit-source-id: dc97d7ec75a0a52cac5fe2acb980b455094ea7a6
2017-11-02 08:00:56 -07: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
Chris Lewis cf8dc89ee8 Fix $FlowFixMes from TabBarIOS
Summary:
There are a number of $FlowFixMe statements in TarBarIOS.ios.js as a result of recent Flow upgrades introducing new errors/warnings. I had a stab at removing these statements and introducing what are hopefully sensible types.

Only types were changed so `yarn flow` should be sufficient.

[INTERNAL] [MINOR] [TarBarIOS] - |Fix $FlowFixMes|
Closes https://github.com/facebook/react-native/pull/16365

Differential Revision: D6200713

Pulled By: TheSavior

fbshipit-source-id: ecbd58d5831dd04250e794812ea03d202f777d12
2017-11-01 19:17:11 -07:00
Héctor Ramos Ortiz 1dca01b532 Remove ReactNativeVersionCheck __DEV__ gating, print error instead of throwing
Reviewed By: cblappert

Differential Revision: D6192020

fbshipit-source-id: 026f376d6d43ab3de188f94f2a4d5f0cf485733c
2017-10-31 14:28:12 -07:00
Brian Vaughn 870f540336 Updated createAnimatedComponent to account for async rendering
Reviewed By: sahrens

Differential Revision: D6149113

fbshipit-source-id: f28b597c1fe9280ca990fe72efc7b841665de957
2017-10-31 11:29:53 -07:00
Adriano Melo ec50aa6d33 Docs: Improve documentation of Slider (add example)
Summary:
It would be great to have examples in the documentation of all components. I have created a PR to add an example for `CheckBox`, and now I am adding an example for the `Slider` component.

The PR changes documentation. No further test is required.

[DOCS][ENHANCEMENT][Slider] - Added example to documentation
Closes https://github.com/facebook/react-native/pull/16588

Differential Revision: D6197329

Pulled By: hramos

fbshipit-source-id: 91d1b20fc2d4bae15f9706ac4c155411d91af290
2017-10-31 09:42:07 -07:00
Andreas Amsenius c4f8551fd7 Allow shadowOpacity and shadowRadius in NativeAnimated
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

I want to animate `shadowOpacity` style property with Native Animated (`useNativeDriver: true`). This is useful for example in an ios-like navigation transition where the shadow fades in with the view that is sliding in from the side. Code comment for `STYLES_WHITELIST` says:
_In general native animated implementation should support any numeric property that doesn't need to be updated through the shadow view hierarchy (all non-layout properties)._
so I just added `shadowOpacity` (and `shadowRadius` too because why not?).

Before this change, setting `shadowOpacity` (or `shadowRadius`) to an `AnimatedValue` (with `useNativeDriver: true`) would throw the error: `Style property 'shadowOpacity' is not supported by the native animated module`.

After adding `shadowOpacity` (and `shadowRadius`), there is no error. The animation looks correct so it seems to be working. I also tried setting a ridiculously large `shadowRadius` and could see that working too.

Please advice on any further testing I should do.

[IOS] [ENHANCEMENT] [NativeAnimated] - Allow `shadowRadius` and `shadowOpacity` as NativeAnimated style properties.
Closes https://github.com/facebook/react-native/pull/16603

Differential Revision: D6195364

Pulled By: hramos

fbshipit-source-id: a55630df43df3c8f9db9921dab0bfbf925b6a09f
2017-10-31 06:06:20 -07:00
Chris Blappert 8ef28eaa2d Gate ReactNativeVersionCheck by __DEV__
Reviewed By: hramos

Differential Revision: D6168567

fbshipit-source-id: 540dc11886d012f1d1a0f40211d408d3a56b40c5
2017-10-30 15:06:13 -07:00
youngjl1 95bf367981 Spelling fix
Summary:
occured > occurred

Improve code comments by fixing a typo.

No code was changed!

Closes https://github.com/facebook/react-native/pull/16558

Differential Revision: D6188381

Pulled By: shergin

fbshipit-source-id: 719a8d3bc9b42877b9b8218de32fc87b8ca8dd7f
2017-10-30 12:36:16 -07:00
David Aurelio 008e549933 Move Map/Set polyfills to top
Summary: Moves initialization of `Map` and `Set` polyfills to the top of `InitializeCore` to avoid problems with JSC versions that don’t accept (or silently ignore) iterables as constructor arguments.

Reviewed By: mjesun

Differential Revision: D6185632

fbshipit-source-id: 3abe4baeb3a08c328d8c6b3bb1b2e01716c2c95c
2017-10-30 12:11:44 -07:00
Nathaniel Bomberger 3fa648204c Code cleanup - Xcode 9 build warning/issue.
Summary:
Xcode 9 has compiler settings that are more strict.  This can occur if someone updates there project to use the default settings.

This patch declares the default type instead of allowing the compiler to determine it.  Instead of `()` we now say `(void)` in a block call.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

It was just annoying me, and it has no side effects.  If there are side effects, then we should fix the type and not go with empty to represent void.

Update project settings in Xcode.  This code doesn't have any known side effects since the compiler assumes the type is void when not declared.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[DOCS] - Fixed potential compiler build issue on Xcode 9 after updating settings in project.
Closes https://github.com/facebook/react-native/pull/16554

Differential Revision: D6184949

Pulled By: shergin

fbshipit-source-id: 23083248a39c56f5cf50b5ff4390629dd6335f84
2017-10-29 23:17:18 -07:00
Adam Dierkens 35ea34298c - Fixed link ref for NativeEventEmitter.js
Summary:
- Make it link to the right location for [NativeEventEmitter](https://github.com/facebook/react-native/blob/master/Libraries/EventEmitter/NativeEventEmitter.js)

The docs are wrong.

Copy-paste the link. 404 === Bad, 200 === Good
Closes https://github.com/facebook/react-native/pull/16555

Differential Revision: D6184944

Pulled By: shergin

fbshipit-source-id: 0cbf2768c50439935bf0d18f8ca87b85dfedf1b5
2017-10-29 23:17:18 -07:00
Cary Z 0285211c04 Fixed "constants" typo
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

oss-typos DC workshop: rid the world of typos.

Manual spell checker reporting duty.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[DOCS][MINOR][JSTimers.js] Fixed "constants" typo
Closes https://github.com/facebook/react-native/pull/16559

Differential Revision: D6184938

Pulled By: shergin

fbshipit-source-id: d16822d3885c6439239102df2790f5dbf5271a19
2017-10-29 23:17:18 -07:00
Arjun Munji 4c05ede977 Fixed broken image link in example code
Summary:
Got frustrated for a minute trying to figure out why the code I copy pasted from the docs wasn't working

The link I replaced the broken one with is the one used in the iOS device example next to the sample code. It can be found at https://facebook.github.io/react-native/img/favicon.png

 [DOCS] [MINOR] [Libraries/Image/Image.ios.js] - Broken image link in the example code at
Closes https://github.com/facebook/react-native/pull/16569

Differential Revision: D6174048

Pulled By: hramos

fbshipit-source-id: 8c008ab06e8719dfca6a9964d553248c4f088882
2017-10-27 14:53:23 -07:00
David Vacca c278020633 Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D6170631

fbshipit-source-id: 254e6ed9a4d6e42b6d1215de1ff63aedb2c07a0a
2017-10-27 12:34:10 -07:00
nak411 e70789117c Fixed typo in comments
Summary:
Fixed spelling error in comments.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Help fix typo in comments.

Did not make any code changes

[DOCS][MINOR][RCTImageView.m] Typo fixes in comments
<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Closes https://github.com/facebook/react-native/pull/16560

Differential Revision: D6173389

Pulled By: shergin

fbshipit-source-id: f3fd8ea686a882f1543922655498dcc7210d8cb8
2017-10-27 11:05:02 -07:00
Andrew Chen (Eng) 9b6f160c04 Revert D5638458: Fixing RTL HorizontalScrolling in Android
Differential Revision: D5638458

fbshipit-source-id: f4474a12821cd2c20f57ce3bac5996c327ceaa33
2017-10-26 15:33:10 -07:00
David Vacca 36c951d24f Fixing RTL HorizontalScrolling in Android
Reviewed By: astreet

Differential Revision: D5638458

fbshipit-source-id: 08a5070a362eb43e12140cc204172d0950a1b720
2017-10-26 11:25:22 -07:00
Valentin Shergin a32e1cfffb Revert D5189017: [RN] Native implementation of <Image> intrinsic content size on iOS
Differential Revision: D5189017

fbshipit-source-id: 35901e0b5c289cb7ae5b4fe8b13f3da3e43e819f
2017-10-25 08:20:48 -07:00
Valentin Shergin e118d7a656 Revert D5196055: [RN] Intrinsic content size for network image sources of <Image>
Differential Revision: D5196055

fbshipit-source-id: 2122029518dc6f7d1612d31b0ecfa3dd2f0dea7d
2017-10-25 08:20:48 -07: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
Brian Vaughn 43241e591d Moved `PooledClass` and improved `js1 upgrade react`
Reviewed By: gaearon

Differential Revision: D6136816

fbshipit-source-id: fca775786cf4f1717509d9bfeb0f789cc6a99e4e
2017-10-24 12:30:27 -07:00
Valentin Shergin f3a32895ca Intrinsic content size for network image sources of <Image>
Summary:
It makes possible to just specify remote url for the <Image> and it will work.
`<Image source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} />`

Reviewed By: javache

Differential Revision: D5196055

fbshipit-source-id: aaf139c4518cc35d1f4cf810bbf0305aad73a55b
2017-10-23 20:00:12 -07:00
Valentin Shergin 7bd0855650 Native implementation of <Image> intrinsic content size on iOS
Summary:
Now intrinsic content size of <Image> is implemented natively on iOS and now it is actually
`intrinsicContentSize`, not just overrided `height` and `width` styles (which was incorrect and hacky).
This change also removes support of nested content inside <Image>.
This is a first commit in the row where we improve <Image> implementation.

Reviewed By: mmmulani

Differential Revision: D5189017

fbshipit-source-id: eab3defa3d86a5d4219b4f4925ab7460b58d760f
2017-10-23 20:00:12 -07:00
Janic Duplessis c47759a9ae Fix potential retain cycles in Animated iOS
Summary:
Fixes potential retain cycles detected by an internal fb tool.

```
First:

__NSDictionaryM
-> RCTPropsAnimatedNode
-> _parentNodes -> __NSDictionaryM
-> RCTStyleAnimatedNode
-> _childNodes -> __NSDictionaryM

Second:

RCTScrollView
-> _eventDispatcher -> RCTEventDispatcher
-> _observers -> __NSArrayM
-> RCTNativeAnimatedModule
-> _nodesManager -> RCTNativeAnimatedNodesManager
-> _uiManager -> RCTUIManager
-> _viewRegistry -> __NSDictionaryM
-> RCTScrollView
```

First fix:
Use weak map for parent and child nodes, strong refs are managed by RCTNativeAnimatedNodesManager

Second fix:
Make RCTEventDispatcher observers a weak array and make sure we don't keep strong refs to UIManager in RCTNativeAnimatedNodesManager and RCTPropsAnimatedNode.

Tested that native animations still work in UIExplorer

[IOS] [BUGFIX] [NativeAnimated] - Fix potential retain cycles in Animated iOS
Closes https://github.com/facebook/react-native/pull/16506

Differential Revision: D6126400

Pulled By: shergin

fbshipit-source-id: 1ac5083f8ab79a806305edc23ae4796ed428f78b
2017-10-23 13:20:59 -07:00
Gustavo Gard eca331937e "subject" field for Share
Summary:
Add field `subject` to `Options` when Share.
Check 9ee815f6b5/Libraries/ActionSheetIOS/ActionSheetIOS.js (L52)

iOS:
The field `subject` is obtained from `Options`
1e8f3b1102/Libraries/ActionSheetIOS/RCTActionSheetManager.m (L159)

**iOS:**
Tested the following components `ActionSheetIOS` and `Share` using RNTester

**Android**
Don't use the key `subject`
Check 1e8f3b1102/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java (L52)
Closes https://github.com/facebook/react-native/pull/15800

Differential Revision: D6060998

Pulled By: hramos

fbshipit-source-id: fd06f680a4705989e397c5700d8ab35aa7129ba6
2017-10-23 11:32:44 -07:00
Daniel Friesen 165b38ab7a Remove usage of the ... operator in BackHandler
Summary:
This usage of `...` currently causes BackHandler to silently become non-functional when a `Symbol` polyfill is used.

Why?
- The `[...obj]` operator implicitly calls the object's iterator to fill the array
- react-native's internal `Set` polyfill has a load order issue that breaks it whenever a project uses a `Symbol` polyfill
- This means that when `BackHandler` tries to `[...set]` a `Set` of subscriptions the result is always an empty array instead of an array of subscriptions

Additionally it's worth noting that the current code is also wastefully inefficient as in order to reverse iterate over subscriptions it:
- Clones the `Set` (which fills it by implicitly running the set's iterator)
- Uses `[...set]` to convert the cloned set into an array (which also implicitly runs the iterator on the clone)
- Finally reverses the order of the array

----

This code fixes this problem by replacing the use of multiple Set instance iterators with a simple `.forEach` loop that unshifts directly into the final array.

I've tested this by opening the repo's RNTester app on Android and tvOS ensuring that the back handler works before changes, the application crashes when I introduce an error (to verify my code changes are being applied to the app), the back handler works and after changes.

Fixes #11968
Closes https://github.com/facebook/react-native/pull/15182

Differential Revision: D6114696

Pulled By: hramos

fbshipit-source-id: 2eae127558124a394bb3572a6381a5985ebf9d64
2017-10-20 18:02:14 -07:00
ashoat 833b27483b Fix Flow errors at declaration of most major library components
Summary:
The relevant changes in the PR are to Libraries/StyleSheet/EdgeInsetsPropType.js; the rest are just removals of FlowIgnores.

The definition of the relevant types is [here](https://github.com/facebook/flow/blob/master/lib/react.js#L262-L271).

The long and short of it is that for whatever reason, Flow is unable to realize that `ReactPropsChainableTypeChecker` is a subtype of `ReactPropsCheckType` unless we assert it. Once we explicitly hint this to the typechecker, it realizes that `EdgeInsetsPropType` is indeed a valid React PropType, and stops complaining that it isn't.
Closes https://github.com/facebook/react-native/pull/16437

Differential Revision: D6109742

Pulled By: sahrens

fbshipit-source-id: e4e10720b68c912d0372d810409f389b65d7f4b1
2017-10-20 03:50:25 -07:00
Krzysztof Magiera bae9b2b206 Handle touchCancel properly in ScrollResponder
Summary:
Touch cancel events are currently being ignored by the ScrollView component. Currently scrollview responds both to scroll events and touchStart/touchMove/touchEnd events.

The reason why ScrollView listens to touchStart/touchEnd is so that it can update its `state.isTouching` param. This parameter then is used in `scrollResponderHandleScrollShouldSetResponder` to make the decision if scrollview should set the responder or not. So if `isTouching` is true (we've received touchStart) then ScrollView want to became a JS responder. This in turn is important for the case where we receive scroll events that does not necessarily need to trigger responder change, e.g. we don't want Scrollview to become JS responder if scroll events have been triggered by `scrollTo` in which case setting responder would put the whole responder system in a bogus state (note that responder can be released only by touchEnd or touchCancel, so if there is no touchEnd that follows scroll event then ScrollView will remain the responder and this would break next touch interaction).

It is therefore crucial for the ScrollView to reset `isTouching` state when touchCancel arrives, as otherwise the next scroll event would incorrectly trigger responder change.

On top of that ScrollView seems to be the only component in RN's core that registers to handle touchEnd but ignores touchCancel, which stands agains the comment added to `RCTRootView.cancelTouches` [here](https://github.com/facebook/react-native/commit/c14cc123d#diff-9cd70243bd2af75c613e29972bb1b41cR127).

This problem is difficult to test with a pure RN native app, as on Android it does not surface because of the `responderIgnoreScroll` flag that is being added to every scroll event, and it essentially makes the responder system ignore scroll events so they would never trigger responder change. On the other hand on iOS the cancel events are pretty rare. With pure RN app they can only be triggered by a "system" level interaction (e.g. when system alert dialog appears or when home button is clicked and there is a touch interaction happening). This issue becomes more prominent when RN app is embedded in a more sophisticated application that may use [`RCTRootView.cancelTouches`](1e8f3b1102/React/Base/RCTRootView.h (L130)) method to block RNs gesture recognizers in some cases or with third-party libraries that deals with touch events like [react-native-gesture-handler](https://github.com/kmagiera/react-native-gesture-handler) that also calls into the method when native touch interaction is detected.
Closes https://github.com/facebook/react-native/pull/16004

Differential Revision: D6003063

Pulled By: shergin

fbshipit-source-id: f6495ffc57a5f996117b5bd80478bb1a58d2d799
2017-10-19 15:30:44 -07:00
Mike Grabowski 4e1dfa48a2 Fix test suite when running on a feature branch
Summary:
Test suite for React Native version check relies on `ReactNativeVersion.js` file that is modified on a release branch (it contains values of a real version, not zeros).

That makes it impossible for the build to pass: https://circleci.com/gh/facebook/react-native/23494

This PR mocks it with zero values, just like we mock it in other suites. I am not sure if that is desired, but works for now.

CC ide
Closes https://github.com/facebook/react-native/pull/16464

Differential Revision: D6100285

Pulled By: hramos

fbshipit-source-id: 784f7e14f5283403f3fa518940565e1ef19dd398
2017-10-19 13:53:27 -07:00
Ramanpreet Nara 64284bf66e iOS: Implement margin(Start|End) styles for RN
Reviewed By: mmmulani

Differential Revision: D5884168

fbshipit-source-id: 4d37583ba79324e6cf8caaa20cecf865f28337f7
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 0a70c026cb iOS: Implement padding(Start|End) styles for RN
Reviewed By: mmmulani

Differential Revision: D5876934

fbshipit-source-id: 55fc49e0fddeaf0e6541d3159f35783e02bd6260
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 1b5f8d3ee5 iOS: Implement border(Top|Bottom)(Start|End)Radius and border(Start|End)(Color|Width) RN styles
Reviewed By: shergin

Differential Revision: D5874536

fbshipit-source-id: 5ad237bddb70745aef0341cddb172da5ee388c38
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 38b5506599 iOS: Forward RN start/end styles to Yoga
Reviewed By: mmmulani

Differential Revision: D5853589

fbshipit-source-id: 9acee0993a25dce5f4b1ce506746b789b1c4c763
2017-10-18 19:33:31 -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
Brian Vaughn b60fa63de8 Removed ProgressBarAndroid.android deprecation warning
Reviewed By: hramos

Differential Revision: D6092598

fbshipit-source-id: 24282a923cf45e749cf33f8a5b7a49995e7fadfe
2017-10-18 17:01:04 -07:00
Jing Chen 63848bdde5 Revert D6080118: [react-native][PR] Delegate to ProgressBarAndroid from ActivityIndicator on Android, instead of the other way around
Differential Revision: D6080118

fbshipit-source-id: efd75bbcc07de084213d3791520006090001364d
2017-10-18 13:02:03 -07:00
dlowder-salesforce c1223c5530 Apple TV: TouchableOpacity and Button need hasTVPreferredFocus support
Summary:
**Motivation**

Give `TouchableOpacity` and `Button` the same TV focus support as is already present in `TouchableHighlight`.

**Test plan**

Manual testing on TV simulator and devices.
Closes https://github.com/facebook/react-native/pull/15561

Differential Revision: D5665976

Pulled By: hramos

fbshipit-source-id: 0d5c588e1c82471f23617a3df1b77abc589a7c63
2017-10-18 12:18:12 -07:00
Huyanh Hoang f0ac5b369a Add description to require a key for each child in ViewPageAndroid
Summary:
Change the header description and example code.

Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?

Clarify extra requirements for a Component.

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

Go to documentation, see changes.

If you have added code that should be tested, add tests.

Sign the [CLA][2], if you haven't already.

Small pull requests are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13829

Differential Revision: D5661106

Pulled By: hramos

fbshipit-source-id: 39736c05f8017009cdd637930c9f89ae6c2ee7c3
2017-10-18 01:00:15 -07:00
Brent Vatne ce937e5b3f Delegate to ProgressBarAndroid from ActivityIndicator on Android, instead of the other way around
Summary:
`ProgressBarAndroid` regressed after fixing a bug in ccddbf82d7

Run this gist on a new project with this code: https://gist.github.com/brentvatne/a0b57e5bbae1bd2cf76765ea27f077af

Notice that you will see:

<img width="642" alt="screen shot 2017-10-17 at 11 06 03 am" src="https://user-images.githubusercontent.com/90494/31681142-3437a95a-b32b-11e7-85d3-c29bfbfe591e.png">

hmmm... doesn't seem right �

With the patch in this PR applied, you will see:

<img width="642" alt="screen shot 2017-10-17 at 11 01 38 am" src="https://user-images.githubusercontent.com/90494/31680950-b0c1805a-b32a-11e7-909e-42cdf478da56.png">

oh! there we go 😄

[ANDROID] [BUGFIX] [ProgressBarAndroid] - Fix regression in ProgressBarAndroid which limited `styleAttr` to only `Regular`.
Closes https://github.com/facebook/react-native/pull/16435

Differential Revision: D6080118

Pulled By: hramos

fbshipit-source-id: 537ee2c96deedd7b2e75ff3dbdefc1506812f3f3
2017-10-17 20:34:59 -07:00
James Ide 7733d40237 Move JS-native version check to its own module + unit tests + prefix Obj-C macro w/RCT
Summary:
- The version check that ensures the JS and native versions match is now in its own module for two reasons: it is easier to test and it allows react-native-windows to override just this module to implement its own version check (ex: more advanced checks for RNW-specific code).
- Added unit tests for the version checking to specify its behavior more clearly, including parity between dev and prod to avoid prod-only behavior and mitigate SEVs.
- Prefixed the Obj-C `#define` with `RCT_` to conform with other RN globals.
Closes https://github.com/facebook/react-native/pull/16403

Differential Revision: D6068491

Pulled By: hramos

fbshipit-source-id: 2b255b93982fb9d1b655fc62cb17b126bd5a939a
2017-10-16 14:30:34 -07:00
Martin Rädlinger 6747a36f5d VirtualizedList: fix bug where onViewableItemsChanged wouldn't trigger
Summary:
In the current implementation of the `VirtualizedList` the `onViewableItemsChanged` callback wouldn't trigger if the underlying list data changes. (see example snack https://snack.expo.io/Hk5703eBb)

I added a method in the `ViewabilityHelper` to invalidate the cached viewableIndices, which gets triggered when the list-data changes.
Closes https://github.com/facebook/react-native/pull/14922

Differential Revision: D5864537

Pulled By: sahrens

fbshipit-source-id: 37f617763596244208548817d5b138dadc12c75d
2017-10-16 04:35:05 -07:00
Eduard Rastoropov b9e141e900 Added secureTextEntry does not work with multiline
Summary:
The title speaks for itself. Docs regarding secureTextEntry of TextInput were not descriptive enough. Owing to that, it took me more than an hour of debugging to find the issue of why the TextInput in my app was not hiding the input with secureTextEntry.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->
Closes https://github.com/facebook/react-native/pull/16272

Differential Revision: D6060614

Pulled By: ericnakagawa

fbshipit-source-id: 419ad6956e67b9adefae8d789b3fd76181c4194b
2017-10-14 16:40:27 -07:00
Marcin Dobosz 3b7067a62d Partial list of unsupported TextInput styles
Summary:
References #7070

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Docs are incomplete, start filling them out

N/A
Closes https://github.com/facebook/react-native/pull/16346

Differential Revision: D6057501

Pulled By: hramos

fbshipit-source-id: c30d3369fa1a73ef6a93c2ed8f8c53af5a1af7ee
2017-10-13 20:45:15 -07:00
Willem Fibbe 8b044dcb80 Update the `NetInfo.isConnected` example code so that it uses the new `connectionChange` event
Summary:
The first code block already uses the new `connectionChange` event instead of
the deprecated `change` event, so change this example code block as well to use
the new event.

I came across this while upgrading my RN version. In the debug-console I saw a deprecation warning, despite I was using the example-code. Looking at the source, I saw the example code block still used the deprecated event, so update it to use the new one.
Closes https://github.com/facebook/react-native/pull/16357

Differential Revision: D6054428

Pulled By: hramos

fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
2017-10-13 18:02:06 -07:00
Arman Dezfuli-Arjomandi a59d157df4 Update Animated docs to mention potential issues with VirtualizedList
Summary:
Doc update to clarify how to prevent `Animated.loop` and other animations from pre-empting `VirtualizedList` rendering as discussed in #16092.
Closes https://github.com/facebook/react-native/pull/16136

Differential Revision: D6057466

Pulled By: hramos

fbshipit-source-id: 946bcde97b364c623b48ddaeb643309630c072c9
2017-10-13 17:50:17 -07:00
Tim Yung 2fff445b13 RN: Improve NativeEventEmitter Flow Types
Reviewed By: fkgozali

Differential Revision: D6050987

fbshipit-source-id: 1c911bed23f7d26800aafed4b7e7c30a1197f64b
2017-10-13 08:04:17 -07:00
Paito Anderson 4a2d3e9653 Fixed homogenous typo
Summary: Closes https://github.com/facebook/react-native/pull/16285

Differential Revision: D6048989

Pulled By: hramos

fbshipit-source-id: e6affb221961d14827ff655069571a3dc57197a1
2017-10-13 00:15:42 -07:00
Alex Dvornikov 452ac1b58e Added "fetchBundle" global function
Reviewed By: jeanlauliac

Differential Revision: D5985425

fbshipit-source-id: 72de85d354e85b8f7d98c95d5aa5348484d26204
2017-10-12 09:46:29 -07:00
Alex Kotliarskyi cc86d12175 Android: put all non-drawable resources to `res/raw`
Summary: When we built packager asset system we were mostly concerned about images. However, this system can also be used to work with videos, animations and other binary resources. The code that sorts assets into Android resource folders currently just shoves all non-drawable resources under `drawable-mdpi`, which is not ideal. Talking to Android experts on the team, `raw` seems like a much better place for other resources.

Reviewed By: jeanlauliac

Differential Revision: D6026633

fbshipit-source-id: cc2199f60da411ea432972a02f52c459ff5c490a
2017-10-11 15:11:29 -07:00
Peter Ruibal 0ec04ed8ef Remove redundant style field from ScrollView propTypes.
Summary:
We're spreading this in via `...ViewPropTypes` also.  Having both confuses
flow when you try to pass style (even though they're identical), when the
types are defined via `React.ElementProps`

Reviewed By: jingc

Differential Revision: D6028659

fbshipit-source-id: 203e29682d34f1648a47d9ddbaef0c9630fbcb99
2017-10-11 14:25:35 -07:00
Peter Ruibal 752b68857c Add `visible-password` for TextInput.keyboardType on Android
Summary:
`visible-password` represents a very basic keyboard, typically only
letters and numbers.  Backed by InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD,
it is useful for things like password and code entry fields. It can also be more
effective than autoCorrect={false} for disabling autocompletion on some keyboards
(like Gboard).

Note `secureTextEntry` also affects `TYPE_TEXT_VARIATION_*` flags internally, so there
may be some undefined behavior when combining `secureTextEntry` with
`keyboardType="visible-password"`

Also, while here, improve the documentation on TextInput to explicitly enumerate
which keyboardType applies to Android vs. iOS (since this is the first android-specific)

Reviewed By: shergin

Differential Revision: D6005353

fbshipit-source-id: 13af90c96353f714c0e106dd0fde90184a476533
2017-10-10 18:18:34 -07:00
Riley Dulin 7b575d669d Improve flow typing and linting for MessageQueue
Differential Revision: D5987892

fbshipit-source-id: 8b9218875944decc5e21863e3c3f3a659ff2e2e4
2017-10-10 16:32:28 -07:00
Cameron Little 2fb9eeb7e1 Fix typo in Text
Summary: Closes https://github.com/facebook/react-native/pull/16277

Differential Revision: D6021941

Pulled By: ericnakagawa

fbshipit-source-id: 3e541082ac5ead7e321baa8f6a00e5ccdbe8c774
2017-10-10 13:20:18 -07:00
Peter Ruibal e50464d1d7 Unbreak doc generation for SectionList
Reviewed By: hramos

Differential Revision: D6018285

fbshipit-source-id: c21deaaa90627936ce29b0212b06640fa38b82f4
2017-10-10 10:45:47 -07:00
Lukas Kurucz bbc3f603f1 Add minimal example to actionsheet
Summary:
Easier to understand how to use this component. A quick example helps to beginners.
Closes https://github.com/facebook/react-native/pull/16110

Differential Revision: D6017956

Pulled By: shergin

fbshipit-source-id: 82a340dfe8551cc8d7b692b9c71237e2b4421aba
2017-10-10 03:32:08 -07:00
Masayuki Iwai a541d58bc4 Fix that section headers in SectionList don't stick at correct position.
Summary:
I noticed that section headers in SectionList don't stick at correct position in case of using with contentInset and contentOffset. (See the demo below. It looks that contentInset.top is ignored.)
This is a common case of use of NavigationBar and TableView on iOS.

![](https://user-images.githubusercontent.com/143255/29018708-1e2f98aa-7b97-11e7-9599-19dbb832266d.gif)

Here is a demo and an example code:

![](https://user-images.githubusercontent.com/143255/29018753-4201f660-7b97-11e7-9d31-28413d1b6269.gif)

```jsx
import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  SectionList,
} from 'react-native';

export default class RNScrollExample extends Component {
  renderSectionHeader(title) {
    return (
      <View style={styles.sectionHeader}>
        <Text>{title}</Text>
      </View>
    )
  }

  renderItem(content) {
    return (
      <View style={styles.cell}>
        <Text>{`Item ${content}`}</Text>
      </View>
    )
  }

  renderSeparator() {
    return <View style={styles.separator} />
  }

  renderSectionList() {
    const sections = Array.from(Array(10), (e, i) => ({ title: `Section ${i+1}`, data: Array.from(Array(10)).map((e, i) => i+1) }))
    const navigationBarHeight = 64
    return (
      <SectionList
        contentInset={{ top: navigationBarHeight }}
        contentOffset={{ y: -navigationBarHeight }}
        sections={sections}
        keyExtractor={(item, index) => index}
        renderSectionHeader={({ section }) => this.renderSectionHeader(section.title)}
        renderItem={({ item }) => this.renderItem(item)}
        ItemSeparatorComponent={this.renderSeparator}
      />
    )
  }

  renderHeader() {
    return (
      <View style={styles.header}>
        <Text style={styles.headerText}>Contents</Text>
      </View>
    )
  }

  render() {
    return (
      <View>
        {this.renderSectionList()}
        {this.renderHeader()}
      </View>
    )
  }
}

const styles = StyleSheet.create({
  header: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    height: 64,
    paddingTop: 20,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#ffffffcc',
  },
  headerText: {
    fontSize: 16,
    fontWeight: 'bold',
  },
  sectionHeader: {
    paddingHorizontal: 8,
    paddingVertical: 4,
    backgroundColor: '#05bbd3',
  },
  cell: {
    paddingHorizontal: 8,
    paddingVertical: 16,
    backgroundColor: '#82dde9',
  },
  separator: {
    height: 1,
    backgroundColor: '#7d888d',
  },
});

AppRegistry.registerComponent('RNScrollExample', () => RNScrollExample);
```
Closes https://github.com/facebook/react-native/pull/15395

Differential Revision: D5988720

Pulled By: shergin

fbshipit-source-id: d33f6ee943d4f913970e26c322b66b3c9c948a02
2017-10-09 22:45:48 -07:00
Sai Teja Jammalamadaka 4e5d50d6ad Issue #16159 - RCTImageStoreManager's priority
Summary:
RCTImageStoreManager and RCTBlobManager have the same priority, hence in certain cases, both are able to handle the request, but this causes non-deterministic behavior. Hence increased ImageStoreManager's Priority to 1 and thereby increasing RCTImageLoader's Priority to 2 to prevent similar issue of same priorities.

Issue: #16159
Closes https://github.com/facebook/react-native/pull/16160

Differential Revision: D6017931

Pulled By: shergin

fbshipit-source-id: 91f2737af4f2f97197734b696105e1cdc5683365
2017-10-09 22:31:25 -07:00
Gustavo Gard dbe6044074 Correct propTypes for placeholder
Summary:
Proptype mistake, placeholder is a "string" not a "node".

1e8f3b1102/Libraries/Text/RCTBackedTextInputViewProtocol.h (L18)

4d54b48167/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java (L300)
Closes https://github.com/facebook/react-native/pull/16237

Differential Revision: D6017909

Pulled By: shergin

fbshipit-source-id: 75046080a0f33196832f5d4ab58f8b1f4aabad1f
2017-10-09 22:31:24 -07:00
Gustavo Gard 57b4f49db0 Remove broken links
Summary:
Issue https://github.com/facebook/react-native/issues/16255

Remove broken links
Closes https://github.com/facebook/react-native/pull/16262

Differential Revision: D6017751

Pulled By: hramos

fbshipit-source-id: a9465a8a8212dc7b5e1aae21c73b46e60e24c10e
2017-10-09 22:02:09 -07:00
Janic Duplessis 0cd69e8a02 Run eslint --fix
Summary:
CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable.

**Test plan**
Quick manual test, cosmetic changes only.
Closes https://github.com/facebook/react-native/pull/16229

Differential Revision: D6009748

Pulled By: TheSavior

fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
2017-10-09 17:46:44 -07:00
Valentin Shergin c0e9936d8e Opensourcing RCTWrapper
Summary:
RCTWrapper is a library that allows turn any UIView/UIViewController-based widget into React Native component
which will respect layout constrains of native (wrapped) view.
So, you don't need to explicitly specify width and hight in styling.

Take a look at examples to see how to use RCTWrapper.

Reviewed By: mmmulani

Differential Revision: D5868763

fbshipit-source-id: 0a503b42be166d547ca6cbf0829eea9c75a8e364
2017-10-09 17:22:35 -07:00
Valentin Shergin aa97c9ac27 Updated project file to fix Apple TV build
Reviewed By: rsnara

Differential Revision: D6015068

fbshipit-source-id: 3c2cd902457e32dab843764267a1475a078eb64d
2017-10-09 16:31:46 -07:00
Valentin Shergin bf3698323d RCTTextInput: Fixed problem with accessory view & 3rd party libs
Summary:
Now RCTTextInput relies on ivar to detect should it reconstruct inputAccessoryView or not.
Previously we checked `inputAccessoryView` directly which breaks some 3rd party libs.

See https://github.com/facebook/react-native/issues/16071 for more details.
cc douglasjunior

Reviewed By: javache

Differential Revision: D5994798

fbshipit-source-id: c086efdd24f5528393a4c734ff7c984e0ed740d1
2017-10-08 21:48:14 -07:00
Yann Pringault 1c24440644 Add TimePicker modes
Summary:
In the spirit of #10932, I added the `mode` option to the `TimePicker` Android API.
There is only one mode available for **Android < 5**, the `spinner` one.
If we are on **Android >= 5** we can choose between `spinner` or `clock`. If we specify `default` it will use the default of the current Android version.

On **Android < 5**, whatever we choose it will be this:
![screen shot 2017-02-14 at 17 05 44](https://cloud.githubusercontent.com/assets/5436545/22937805/024ec67e-f2da-11e6-8b32-a680d9bc2247.png)

On **Android >= 5**, with the `spinner` mode:
![screen shot 2017-02-14 at 16 51 17](https://cloud.githubusercontent.com/assets/5436545/22937803/024e0bbc-f2da-11e6-9f4b-26102ff2eeac.png)

And with the `clock` mode, the default:
![screen shot 2017-02-14 at 16 51 02](https://cloud.githubusercontent.com/assets/5436545/22937804/024e64e0-f2da-11e6-9911-4135049f4726.png)
Closes https://github.com/facebook/react-native/pull/12384

Differential Revision: D6006689

Pulled By: hramos

fbshipit-source-id: fcd37c867c4061b9982b1687f2c10211e54df7cf
2017-10-08 12:38:45 -07:00
Tim Wang f9be64aea0 Use UnimplementedView for CheckBox on iOS
Summary:
`CheckBox` component was introduced in v0.49.0 and not implemented on iOS.

Users who are trying to use `CheckBox` on iOS will get a warning that
> Native component for "AndroidCheckBox" does not exist

We should declare in the document that this component is Android only and use `UnimplementedView` for iOS.

- Use `react-native init` new project
- Apply pull request changes
- Add `<Checkbox />` after welcome text in `App.js`
- Run the app in iOS simulator
Closes https://github.com/facebook/react-native/pull/16211

Differential Revision: D6005393

Pulled By: hramos

fbshipit-source-id: 1c9b68b5e1c933496c4d7c2f487f0500264b603a
2017-10-07 17:24:23 -07:00
Matej Strasek 4ddc931d15 Fixing test by updating snapshot for TouchableHighlight
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Tests were failing due to not updated snapshot about TouchableHighlight.

Run `npm test`.
Closes https://github.com/facebook/react-native/pull/16185

Differential Revision: D6005399

Pulled By: hramos

fbshipit-source-id: eda5009b68ca121250817de448424105aec6f685
2017-10-07 16:40:43 -07:00
Yann Pringault f66c8f2f7e Fix minor typo in ScrollView doc
Summary:
I don't think a test plan is required here! 😛
Closes https://github.com/facebook/react-native/pull/16243

Differential Revision: D6005196

Pulled By: hramos

fbshipit-source-id: 3b46346e57e0d9971078c4807a4fa0045a8366b1
2017-10-07 15:04:10 -07:00
Paul Brittain 1b80118b66 16111 Webview contentInset docs change
Summary:
Addresses #16111

**No tests needed, non functional change. Test suite ran: PASS**
Closes https://github.com/facebook/react-native/pull/16138

Differential Revision: D6004974

Pulled By: hramos

fbshipit-source-id: 3f47aab417ec0181fe8c3029d72e7729a709a754
2017-10-07 12:22:55 -07:00
Alex Dvornikov 7f6a7aec46 remove RCTWebSocketObserver
Summary: Remove RCTWebSocketObserver as it's not used anywhere in the project.

Reviewed By: shergin

Differential Revision: D5960354

fbshipit-source-id: a5b9d128f7cf9384a9fa9ed20e869801023e1d57
2017-10-04 19:17:07 -07:00
Naman Goel bee33a4400 Improve Flow Types
Differential Revision: D5963184

fbshipit-source-id: 206f0d52b66f4f1af284445b10a8a4ff7b2cc36d
2017-10-04 14:55:34 -07:00
Gustavo Gard 2d2dfa26bc Correct logo URL
Summary:
Update logo URL
https://facebook.github.io/react/img/logo_og.png (old) to https://facebook.github.io/react/logo-og.png (new)

Check that the old URL shows a "Page Not Found" and the new URL the correct image.
Closes https://github.com/facebook/react-native/pull/16204

Differential Revision: D5978967

Pulled By: TheSavior

fbshipit-source-id: f6af03dfd25d68c96e01054c256d8b6ba9fedba2
2017-10-04 14:38:02 -07:00
Alex Kotliarskyi 9c29ee1504 Standard Flow type for style prop
Reviewed By: sahrens

Differential Revision: D5978082

fbshipit-source-id: bd251ed3ecc1f15595e2f5ee941e3865a225c1fd
2017-10-04 14:38:02 -07:00
Brian Vaughn 678a7f3c39 React sync for revisions b5ac963...5f93ee6f6
Reviewed By: gaearon

Differential Revision: D5950896

fbshipit-source-id: 74aebcee8a64e8552b170223adf59ed4ed905a74
2017-10-04 10:16:15 -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
Ramanpreet Nara 992ade1fc5 Re-render views when direction changes
Reviewed By: shergin

Differential Revision: D5959573

fbshipit-source-id: 36b2cde921362a934a2c88a3ed05be5082ed08bf
2017-10-03 13:01:06 -07:00
Alex Dvornikov 96f23e7416 Add a check in InitializeCore.js that PlatformConstants native module is present
Summary: In some enviroments PlatformConstants native module may not be presented in a project, which results in a call to undefined property and a RedBox

Reviewed By: javache

Differential Revision: D5960879

fbshipit-source-id: 80aecbe2f2a61cb410abd5f0dce8ba855e166991
2017-10-03 05:45:06 -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
phillip055 ddc2210eba Add headers prop in source array type prop
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

My first contribution 👍

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/16155

Differential Revision: D5962399

Pulled By: shergin

fbshipit-source-id: b7a44d53d875b32d04c1b876eb7ec2f30a9d0d80
2017-10-02 23:30:32 -07:00
Sam Goldman a16ef18a80 Upgrade Flow to v0.56.0
Reviewed By: calebmer

Differential Revision: D5958715

fbshipit-source-id: 7feda03a9540e69bf8d9b4eb89720248ff43294f
2017-10-02 21:11:05 -07:00
Daniel Andersson 915ac20c76 Avoid eval in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D5950405

fbshipit-source-id: ee794317f820e8fbb87752b88539171115a8e00e
2017-10-02 17:05:34 -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
Jason Carreiro abed3cf6c4 Revert D5944488: [RN][iOS]: Re-render views when direction changes
Differential Revision: D5944488

fbshipit-source-id: 79e695dcc0ea7d09544ace1525828333a5818c5a
2017-10-02 12:19:25 -07:00
Ramanpreet Nara 9bbc70c442 Re-render views when direction changes
Summary:
This is required for D5874536, wherein I'll be introducing direction-aware props for borders.

When a view's border changes due to a direction update, only the frames of its children update. Therefore, only the children `UIView`s get a chance to be re-rendered. This is incorrect because the view that's had its borders changed also needs to re-render. So, I keep a track of the layout direction in a property on all shadow views. Then, when I update that prop within `applyLayoutNode`, I push shadow views into the `viewsWithNewFrames` set.

Reviewed By: mmmulani

Differential Revision: D5944488

fbshipit-source-id: 3f23e9973f3555612920703cdb6cec38e6360d2d
2017-10-02 11:15:48 -07:00
Adam Comella 9c4ec30c15 iOS: Support allowFontScaling on TextInput
Summary:
Currently, only `Text` supports the `allowFontScaling` prop. This commit adds support for it on `TextInput`.

As part of this change, the TextInput setters for font attributes (e.g. size, weight) had to be refactored. The problem with them is that they use RCTFont's helpers which create a new font based on an existing font. These helpers lose information. In particular, they lose the scaleMultiplier.

For example, suppose the font size is 12 and the device's font multiplier is set to 1.5. So we'd create a font with size 12 and scaleMultiplier 1.5 which is an effective size of 18 (which is the only thing stored in the font). Next, suppose the device's font multiplier changes to 1. So we'd use an RCTFont helper to create a new font based on the existing font but with a scaleMultiplier of 1. However, the font didn't store the font size (12) and scaleMultiplier (1.5) separately. It just knows the (effective) font size of 18. So RCTFont thinks the new font has a font size of 18 and a scaleMultiplier of 1 so its effective font size is 18. This is incorrect and it should have been 12.

To fix this, the font attributes are now all stored individually. Anytime one of them changes, updateFont is called which recreates the font from scratch. This happens to fix some bugs around fontStyle and fontWeight which were reported several times before: #13730, #12738, #2140, #8533.

Created a test app where I verified that `allowFontScaling` works properly for `TextInputs` for all values (`undefined`, `true`, `false`) for a variety of `TextInputs`:
  - Singleline TextInput
  - Singleline TextInput's placeholder
  - Multiline TextInput
  - Multiline TextInput's placeholder
  - Multiline TextInput using children instead of `value`

Also, verified switching `fontSize`, `fontWeight`, `fontStyle` and `fontFamily` through a bunch of combinations works properly.

Lastly, my team has been using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14030

Reviewed By: TheSavior

Differential Revision: D5899959

Pulled By: shergin

fbshipit-source-id: c8c8c4d4d670cd2a142286e79bfffef3b58cecd3
2017-10-01 21:45:33 -07:00
Matt Bruce d3e1a21399 Change all calls to no-console from no-console-disallow
Reviewed By: TheSavior

Differential Revision: D5944700

fbshipit-source-id: cdd78d1b32fa98d8a792a39ccc3cb37241ab4366
2017-09-29 16:38:06 -07:00
KhietVo-AgilityIO a004e2b77c Wrong name
Summary:
MaskedViewIOS instead of MaskedView
Closes https://github.com/facebook/react-native/pull/16135

Differential Revision: D5942428

Pulled By: shergin

fbshipit-source-id: 44e771d9a318c66c8721775bcaf8506eb0fbbecd
2017-09-29 15:03:23 -07:00
Pieter De Baets e691699820 Don't set defaultProps for default view manager values
Summary:
The Android ViewManager already has disabled set to false by default. When setting it in defaultProps we send it over for every text view, which is unnecessary.

On platforms that don't support disabled this may also cause unnecessary log noise.
Closes https://github.com/facebook/react-native/pull/16139

Differential Revision: D5944334

Pulled By: javache

fbshipit-source-id: 54c4b65f345cd284759d01d075522f5aa2f74298
2017-09-29 13:45:52 -07:00
Gregory 3849765ac1 fix params order in comments clamp.js
Summary:
/**
 * param {number} value
 * param {number} min
 * param {number} max
 * return {number}
 */

should be:
/**
 * param {number} min
 * param {number} value
 * param {number} max
 * return {number}
 */

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/16077

Differential Revision: D5938021

Pulled By: shergin

fbshipit-source-id: 3a6e4ff5ab39a657bc0d9271ae2a2600998b2ddf
2017-09-29 00:01:10 -07:00
Tomas Reimers d8cc6e3c2b Add SwipeableFlatList
Reviewed By: sahrens

Differential Revision: D5912488

fbshipit-source-id: 3d2872a7712c00badcbd8341a7d058df14a9091a
2017-09-28 22:16:08 -07:00
Riley Dulin 089add4de7 Add @format to MessageQueue
Reviewed By: javache

Differential Revision: D5925489

fbshipit-source-id: 799b530a2540850722ad1910263030afb951c4c5
2017-09-28 13:16:00 -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
Spencer Ahrens e16b514c5f Add onScrollToIndexFailed support
Summary: Allows handling the case of wanting to scroll beyond the measured window.

Reviewed By: TheSavior

Differential Revision: D5915331

fbshipit-source-id: 329927632f4d04f213567ce4bbe547b04b8ea86d
2017-09-27 18:31:15 -07:00
Janic Duplessis 1af645b2fd Validate that JS and Native code versions match for RN releases
Summary:
Basic implementation of the proposal in #15271

Note that this should not affect facebook internally since they are not using OSS releases.

Points to consider:
- How strict should the version match be, right now I just match exact versions.
- Wasn't able to use haste for ReactNativeVersion because I was getting duplicate module provider caused by the template file in scripts/versiontemplates. I tried adding the scripts folder to modulePathIgnorePatterns in package.json but that didn't help.
- Redscreen vs. warning, I think warning is useless because if the app crashes you won't have time to see the warning.
- Should the check and native modules be __DEV__ only?

**Test plan**
Tested that it works when version match and that it redscreens when versions don't before getting other errors on Android and iOS.
Closes https://github.com/facebook/react-native/pull/15518

Differential Revision: D5813551

Pulled By: hramos

fbshipit-source-id: 901757e25724b0f22bf39de172b56309d0dd5a95
2017-09-27 18:31:15 -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
James Isaac 227a5f4e8f Default TextInput autoCapitalize to sentences on Android
Summary:
Currently `TextInput.autoCapitalize` is defaulting to 'none' on Android.  This PR sets the default to 'sentences', to match iOS and the PropTypes documentation.

Fixes #14846
Closes https://github.com/facebook/react-native/pull/14853

Differential Revision: D5918196

Pulled By: shergin

fbshipit-source-id: d0d00e75d44a410c6821b4ff8910099aae2b2c7c
2017-09-26 18:32:14 -07:00
Valentin Shergin 6d67e2dbbc Bunch of utility funcs were moved to RCTUIManagerUtils
Summary: Because `RCTUIManager` is already overcomplicated and that stuff deserves separate file and header.

Reviewed By: javache

Differential Revision: D5856653

fbshipit-source-id: 7001bb8ba611976bf3b82d6a25f5619810a35b34
2017-09-26 14:08:28 -07:00
Chris Geirman e3a6be5d37 explicitly show how to add the optional listener
Summary:
The previous example only showed where to add the optional "listener" but didn't show how to make use of it.

<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

(Write your motivation here.)

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Closes https://github.com/facebook/react-native/pull/15576

Differential Revision: D5911716

Pulled By: shergin

fbshipit-source-id: 60023470d23c2cbbde47ab9aa82c7ecef73be467
2017-09-26 10:26:22 -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
Janic Duplessis 3cbc36138a Native Animated - Allow events that are dispatched from any thread
Summary:
Instead of preventing events from working when not on the UI Thread we can just dispatch to it instead.

**Test plan**
Tested manually that animated events still work in RNTester
Closes https://github.com/facebook/react-native/pull/15953

Differential Revision: D5909816

Pulled By: shergin

fbshipit-source-id: 48d02b6aa9f2bc3bcb638e8852fccaac3f205276
2017-09-25 23:15:15 -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
Lee Byron bd70f3ab3b Remove older devtools hook
Summary:
As of v1.4.0, a new devtools hook is used that is hosted within `relay-devtools` instead of `relay-runtime`. That allows debugging of production relay apps, and reduces byte size of Relay.

As a result, relay-debugger-react-native-runtime and RelayDebugger can be removed.

Reviewed By: kassens

Differential Revision: D5904296

fbshipit-source-id: 2b215f5a25ecb2922b00cdf86f7d31415d8d1328
2017-09-25 19:30:06 -07:00
Valentin Shergin eeda4f3cea Using modern API to get available size in RCTShadowText
Summary: This is just more correct.

Reviewed By: javache

Differential Revision: D5860755

fbshipit-source-id: 8ae0e92b2faedfb6dfa02f59f2a63a044bb6912d
2017-09-25 19:02:20 -07:00
Valentin Shergin 73b596cfdd Small NaN related optimisation in RCTShadowText
Summary: NaN values can not be compared directly, so we have to use `isnan` function.

Reviewed By: mmmulani

Differential Revision: D5859761

fbshipit-source-id: bf99a1ae574cd820265bef0c2bd255b194c5dc3c
2017-09-25 19:02:20 -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
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
Jakub Grzmiel d005c8c08a Fix format warnings for clang 5.0
Reviewed By: mzlee

Differential Revision: D5900751

fbshipit-source-id: 4e9aea068aab3d2d882b8fb103a8828e861da97c
2017-09-25 10:30:53 -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 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
Valentin Shergin 983b05441d Introducing <SafeAreaView>
Summary:
<SafeAreaView> renders nested content and automatically applies paddings reflect the portion of the view
that is not covered by navigation bars, tab bars, toolbars, and other ancestor views.
Moreover, and most importantly, Safe Area's paddings feflect physical limitation of the screen,
such as rounded corners or camera notches (aka sensor housing area on iPhone X).

Reviewed By: mmmulani

Differential Revision: D5886411

fbshipit-source-id: 7ecc7aa34de8f5527c4e59b0fb4efba3aaea28c8
2017-09-24 23:01:25 -07:00
Taylor Kline 82b4b9b115 Give complex FlatList example more motivation
Summary:
Previously, the example MyListItem never referenced the selected prop, leaving ambiguity about the intention of the demo.

By adding a concrete implementation with coloring based on the selected prop, we can see that this is a demo of a multi-select list for batch actions instead of, say, a click-to-navigate nested list.

Here is a working Snack demo for future reference:
https://snack.expo.io/BkRMRTGB-

References #14872

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/14957

Differential Revision: D5892186

Pulled By: sahrens

fbshipit-source-id: c7b46b5f6eae8f36bd4bda7cbbd354cc22108b42
2017-09-22 13:04:06 -07:00
Spencer Ahrens af2e3fea1b Improve DX for FBReactKitIntegrationTests
Summary:
- Enable logging so `console.log` shows up in Xcode console (and CI?)
- Allow loading from bundler for rapid JS iteration.
- Add option to enable JS debugging, although it's a little ghetto.

Reviewed By: mmmulani

Differential Revision: D5869085

fbshipit-source-id: 9c4831859f1491f7f75786f730d8549d69623888
2017-09-21 18:30:38 -07:00
nicehacker f7f347329e Add example on Components
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Adding example on components section with [react-native-web-player](https://github.com/dabbott/react-native-web-player)

- ActivityIndicator
- TouchableOpacity
- TouchableHighlight

Screenshot on http://localhost:8079/react-native/docs/activityindicator.html
![react-native-activityindicator](https://user-images.githubusercontent.com/13135332/30432801-adca0982-9988-11e7-8e70-94ad9e42ea43.png)

Screenshot on http://localhost:8079/react-native/docs/touchableopacity.html
![react-native-touchableopacity](https://user-images.githubusercontent.com/13135332/30432718-80570554-9988-11e7-9c81-15ab98327fed.png)

Screenshot on http://localhost:8079/react-native/docs/touchablehighlight.html
![react-native-touchablehighlight](https://user-images.githubusercontent.com/13135332/30432733-8290fbb8-9988-11e7-94a1-86c3166e544d.png)
Closes https://github.com/facebook/react-native/pull/15950

Differential Revision: D5881366

Pulled By: hramos

fbshipit-source-id: 2926071723defedf9ed5cb1b1128204256c71dd9
2017-09-21 17:37:07 -07:00
Mehdi Mulani a389ffbd84 Add onDismiss to Modal.js
Summary: Adds an onDismiss so that navigation events can be chained to the dismissing of a modal.

Reviewed By: sahrens

Differential Revision: D5852953

fbshipit-source-id: a86e36fdd5b0b206c2dd9fa248e2a88da22efa31
2017-09-21 15:01:52 -07:00
Mehdi Mulani f01c73d84f Silence annoying logs in iOS 11
Summary: Apple changed what messages get logged when a web socket connection fails. Lets hide them to make life better for engineers.

Reviewed By: javache

Differential Revision: D5879306

fbshipit-source-id: cde06405b4af251159269218bf922916a79ac840
2017-09-21 13:03:04 -07:00
Nicholas Juntilla 70558b9e70 Add the import statement to examples
Summary:
As a new user it took me a while to figure out you can import these examples directly. The import statement completes the example for new users like me who have no idea these components can be imported. It is a very important piece of information and it is hard to find otherwise.

I think this should be added to all the other component examples as well.

Documentation only.
Closes https://github.com/facebook/react-native/pull/15501

Differential Revision: D5882436

Pulled By: hramos

fbshipit-source-id: 2da0fe4c7c41e2fdb6b13a945460e17e16442d62
2017-09-21 12:31:37 -07:00
Petter Hesselberg 5317b68e27 Improved documentation for ActionSheetIOS.js
Summary:
This change improves the documentation for `ActionSheetIOS.js`. It's a bit skimpy as is.
Closes https://github.com/facebook/react-native/pull/16030

Differential Revision: D5882446

Pulled By: hramos

fbshipit-source-id: b59ce299a9142ebf015ed674c59e1e435deb759a
2017-09-21 11:55:29 -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
Naman Goel 11963d824d Fix Flow errors in ListViewData source.
Differential Revision: D5839414

fbshipit-source-id: 7a0c7b3d27be728c74e08d3a8209deb3ca68dd63
2017-09-19 16:57:41 -07:00