Commit Graph

4074 Commits

Author SHA1 Message Date
David Vacca 23f8f7aecb Breaking Change: Restrict WebView to only manage navigation of whitelisted URLs: http(s) by default
Reviewed By: achen1

Differential Revision: D7834050

fbshipit-source-id: 80f7fd3cd20979590b75804819e154afc14a3c64
2018-05-04 23:18:14 -07:00
Mehdi Mulani 634e7e11e3 iOS only: Breaking Change: Restrict WebView to only http(s) URLs
Summary:
To prevent people from linking file:// or other URLs inside RN WebViews, default <WebView> to not allowing those types of URLs.
This adds the originWhitelist to specify other schemes or domains to be allowed.

If the url is not allowed, it will be opened in Safari/by the OS instead.

Reviewed By: yungsters

Differential Revision: D7833203

fbshipit-source-id: 6881acd3b434d17910240e4edd585c0a10b5df8c
2018-05-04 13:48:34 -07:00
Logan Daniels f5fcebabeb PerformanceLogger: log extras to console in DEV mode
Differential Revision: D7862011

fbshipit-source-id: 591caf37d6c91ccb07f13005c0f6c57dcaaa22c5
2018-05-03 16:43:34 -07:00
David Vacca 23d61b35fb Breaking change - Disable WebView geolocation by default
Reviewed By: yungsters

Differential Revision: D7846198

fbshipit-source-id: 8d6daff4b794d3569b5ddba2d8d62af8c7ff5b03
2018-05-02 15:59:06 -07:00
Eric Rozell ba88292130 Support platform-specific prop type overrides
Summary:
Moves `PlatformViewPropTypes` to the end of `ViewPropTypes` so platforms can override prop type values. An example of this is in `react-native-windows`, we want to support additional values for the `importantForAccessibility` prop type that are specific to Windows (more details in [this PR](https://github.com/Microsoft/react-native-windows/pull/1807)).

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.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

<!--
  Required: 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!
-->

Run jest tests, test RNTester on iOS and Android. Did not test tvOS, but this should not impact tvOS as the only props included from `PlatformViewPropTypes` are unique (i.e., are not overridden in this file).

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

https://github.com/Microsoft/react-native-windows/pull/1807

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[CATEGORY] [TYPE] [LOCATION] - Message

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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][Enhancement][View] - Make `ViewPropTypes` more friendly to platform extensions.
Closes https://github.com/facebook/react-native/pull/19090

Differential Revision: D7846438

Pulled By: shergin

fbshipit-source-id: e51ee3256d1c21001b371bd07da21319f3ecd810
2018-05-02 11:21:51 -07:00
Spencer Ahrens fffae99640 deepDiffer: add maxDepth arg
Reviewed By: blairvanderhoof

Differential Revision: D7839729

fbshipit-source-id: fe9a06d2aaed9dfbfb3e52779ba4b1b98007b9ce
2018-05-01 22:01:52 -07:00
Spencer Ahrens 5b2a2bee7a PureComponentDebug
Summary:
Drop in replacement for `React.PureComponent` or can replace `React.PureComponent` for all components.

Logs out what exactly triggered a re-render of a `PureComponent` to make it easier to track down why a component is re-rendering. With some other changes we'll also get component stacks in the YellowBox to make it even easier.

I thought about logging the values, but it's too easy to render something gross or cyclical like react components, so I figured people could break in the debugger to get more detail as needed.

Special flow type should cause errors if people try to commit any usage of this - it should only be used for local debugging.

Reviewed By: yungsters

Differential Revision: D7826325

fbshipit-source-id: fdf7910336452ac1c7acd328c04d441dfb186b59
2018-05-01 19:47:52 -07:00
Brent Erickson f99ca3c03f Fix a race condition in AppState that prevents listeners from being notified
Summary:
If someone has setup a subscription on AppState and we correct AppState via getCurrentAppState call, we need to notify all the subscribers of AppState.
1 ) Initial AppState.currentState = 'active'
2-start) Subscribe to AppState Changes
3-start) Fetch Current AppState
4 ) App Code subscribes to AppState module
5 ) App becomes backgrounded
2-finish) AppState listeners are setup (missing background event)
3-finish) AppState.currentState updated to background

At this point the subscription setup in 4) will never be called with the change.

AppState should always call subscribers on change

This is very difficult to formally test since it's due to a race condition. We've seen this condition via bug reports but have had no local repro.

[GENERAL][BUGFIX][AppState] - Fix a race condition that could prevent AppState subscription change listener from firing on initial launch
Closes https://github.com/facebook/react-native/pull/18236

Differential Revision: D7823370

Pulled By: hramos

fbshipit-source-id: 99b174df70262ceaf9da141d005131facd624594
2018-04-30 18:01:17 -07:00
Spencer Ahrens 0f6762ba50 improve console logging
Summary:
* Always log when PRINT_TO_CONSOLE true - o reason to also check DEV.
* Log when `clearExceptTimespans` is called.
* Type `PRINT_TO_CONSOLE: false` to prevent accidental commits setting it true.

Reviewed By: alexeylang

Differential Revision: D7816623

fbshipit-source-id: 47cf7e158133045e20b345139efb1a79e5e6553b
2018-04-30 11:52:57 -07:00
Spencer Ahrens 5b923e0eaf Add args to bridge function call systrace markers
Reviewed By: yungsters

Differential Revision: D7797728

fbshipit-source-id: 615affc57e658d4dd08a88f829d38be930804372
2018-04-30 09:55:49 -07:00
Nikolai Tillmann be32cbef00 Make UIManager prepackable
Reviewed By: sebmarkbage

Differential Revision: D7736403

fbshipit-source-id: 6154b76d9d948658394488fe4472d8b5bbcd3d9f
2018-04-27 19:16:53 -07:00
Alex Dvornikov 333602b9f2 Introduce "Options" argument to "fetchSegment()" function
Reviewed By: jeanlauliac

Differential Revision: D7791186

fbshipit-source-id: e3954a525e6e3b02a48ac19f78cc3716969dd6bf
2018-04-27 15:14:36 -07:00
Rubén Norte c656fa8072 Removed some @providesModule tags and references
Reviewed By: jeanlauliac

Differential Revision: D7758118

fbshipit-source-id: 556bdcac54f92e3143d98e0ae3d9016a5b7de2bd
2018-04-26 06:02:00 -07:00
Mika Andrianarijaona a3a98eb1c7 BREAKING - default underlineColorAndroid to transparent
Summary:
Set default `underlineColorAndroid` to `transparent`.
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fixes #18938

<!--
  Required: 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!
-->

Use a TextInput in a component without defining `underlineColorAndroid`, the underline color should be transparent.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[ANDROID] [BREAKING] [TextInput] - set default underlineColorAndroid to transparent

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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/18988

Reviewed By: mdvacca

Differential Revision: D7765569

Pulled By: yungsters

fbshipit-source-id: f7ad57a46fc0d18b47271ca39faae8c635995fbb
2018-04-25 23:31:51 -07:00
Rubén Norte d5e9e55fa3 Remove @providesModule from all modules
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.

It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)

* Checked the Flow configuration by running flow on the project root (no errors):

```
yarn flow
```

* Checked the Jest configuration by running the tests with a clean cache:

```
yarn jest --clearCache && yarn test
```

* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:

```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```

[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995

Reviewed By: mjesun

Differential Revision: D7729509

Pulled By: rubennorte

fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825
2018-04-25 07:37:10 -07:00
Alex McKelvey 4a802100d1 Improve VirtualizedList yellow-box warning when item is missing a key
Reviewed By: sahrens

Differential Revision: D7746659

fbshipit-source-id: b271dcd604d9adb85d0996dce5b8af1a6efd37d2
2018-04-24 13:47:46 -07:00
Kevin Gozali 9909a4243f iOS: RCTTestRunner should deallocate rootview before invalidating the bridge
Summary: There are cases of race condition where the react component being mounted is calling a nativemodule from JS *right after* the test runner starts invalidating the bridge. This causes assertion failure deep in the RCTModuleData such that the bridge doesn't complete the invalidation. To avoid this, unmount and deallocate the RCTRootView before invalidating the bridge.

Reviewed By: sahrens

Differential Revision: D7727249

fbshipit-source-id: 8b82edc3b795ceb2e32441f16e225d723fcd9be1
2018-04-24 02:01:14 -07:00
Nat Mote 931930ae63 Remove non-top-level export from JSTimers
Reviewed By: davidaurelio

Differential Revision: D7705416

fbshipit-source-id: 1252789c2cd59b8666b57edcf17948c102e63888
2018-04-20 11:03:39 -07:00
Brian Vaughn bc8e42a5e6 Removed fb-specific RN bundle. This should not have been synced. 2018-04-20 10:18:05 -07:00
Tim Yung d69e55060f RN: Support `flexWrap: 'wrap-reverse'`
Reviewed By: fkgozali

Differential Revision: D7684403

fbshipit-source-id: 6c247ba86b8ad1bb4dcc8f44f5609c939afe0f06
2018-04-19 15:50:57 -07:00
Knott Wittawat 654435d1ed Fix VoiceOver not identifying the header correctly
Reviewed By: sophiebits

Differential Revision: D7678644

fbshipit-source-id: ee6c57f2a603eed1c41f22a4142474ab6957ccdf
2018-04-19 13:18:38 -07:00
Kevin Gozali 60b05133ba Unforked renderApplication()
Summary: This allows toggling fabric renderer via the same renderApplication()

Reviewed By: mdvacca

Differential Revision: D7682524

fbshipit-source-id: 59be1d2bea15f5e13e64e2d72304d79f9cb7d084
2018-04-19 11:44:19 -07:00
David Aurelio 0f2e46e84b Remove `Color` workspace
Reviewed By: mjesun

Differential Revision: D7637457

fbshipit-source-id: befee31c649edde654c05e7ba889f7c55b105b86
2018-04-19 08:23:05 -07:00
Peter van der Zee 3c0b8922e2 Upgrade Prettier to v1.12.1 on fbsource
Reviewed By: benjaffe, ryanmce, yungsters

Differential Revision: D7652946

fbshipit-source-id: 396d45c675e93f2298cd2920d927630c81867447
2018-04-19 02:45:35 -07:00
Brian Vaughn 908e8850b9 Forked RN renderers for FB and OSS (52afbe0...0887c7d)
Reviewed By: fkgozali

Differential Revision: D7658727

fbshipit-source-id: 2fdd30694b169d180b40bc1059ecc297b07cd18d
2018-04-18 15:04:53 -07:00
Andrew Chen (Eng) ff9b3c6517 Display JS component stack in native view exceptions
Reviewed By: mdvacca

Differential Revision: D7578033

fbshipit-source-id: 4dc393cddf8487db58cc3a9fefbff220983ba9da
2018-04-17 17:47:38 -07:00
Avik Chaudhuri d2a1461d26 @allow-large-files clean up xplat/js for flow 0.70.0
Reviewed By: fishythefish

Differential Revision: D7643236

fbshipit-source-id: 1d9a95f1e249ce3fdc552a4ca92a6c63b267dae4
2018-04-17 05:42:01 -07:00
Sophie Alpert a275eac56e Clean up some grossness in ScrollResponder
Summary: Still gross but less gross.

Reviewed By: sebmarkbage

Differential Revision: D7107180

fbshipit-source-id: 31f1639a8f44e4ab247c338001a4a5c9b4b83cdf
2018-04-16 13:12:13 -07:00
TomSwift 8621d4b797 iOS textTransform style support
Summary:
Issue [#2088](https://github.com/facebook/react-native/issues/2088).

The basic desire is to have a declarative mechanism to transform text content to uppercase or lowercase or titlecase ("capitalized").

My test plan involves having added a test-case to the RNTester app within the `<Text>` component area.   I then manually verified that the rendered content met my expectation.

Here is the markup that exercises my enhancement:

```
<View>
  <Text style={{ textTransform: 'uppercase'}}>
    This text should be uppercased.
  </Text>
  <Text style={{ textTransform: 'lowercase'}}>
    This TEXT SHOULD be lowercased.
  </Text>
  <Text style={{ textTransform: 'capitalize'}}>
    This text should be CAPITALIZED.
  </Text>
  <Text style={{ textTransform: 'capitalize'}}>
    Mixed:{' '}
    <Text style={{ textTransform: 'uppercase'}}>
      uppercase{' '}
    </Text>
    <Text style={{ textTransform: 'lowercase'}}>
      LoWeRcAsE{' '}
    </Text>
    <Text style={{ textTransform: 'capitalize'}}>
      capitalize each word
    </Text>
  </Text>
</View>
```

And here is a screenshot of the result:

![screen shot 2018-03-14 at 3 01 02 pm](https://user-images.githubusercontent.com/575821/37433772-7abe7fa0-279a-11e8-9ec9-fb3aa1952dad.png)

[Website Documentation PR](https://github.com/facebook/react-native-website/pull/254)
https://github.com/facebook/react-native-website/pull/254

[IOS] [ENHANCEMENT] [Text] - added textTransform style property enabling declarative casing transformations
Closes https://github.com/facebook/react-native/pull/18387

Differential Revision: D7583315

Pulled By: shergin

fbshipit-source-id: a5d22aea2aa4f494b7b25a055abe64799ccbaa79
2018-04-16 09:01:38 -07:00
Patrice Vignola 7e58e2cbf6 Remove duplicate prop definition
Summary:
<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

- This is most likely a merge issue?
- hasTVPreferredFocus was duplicated in the Flow types definition for the Button component, but the PropTypes are fine

<!--
  Required: 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!
-->

Removing a duplicated prop can't really throw a Flow error. Anyway, I removed the duplicated prop and successfully ran `$ yarn flow`

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

None

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[GENERAL] [ENHANCEMENT] [Button] - Remove duplicate prop definition

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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/18845

Differential Revision: D7627621

Pulled By: mdvacca

fbshipit-source-id: 924522641a334212f5e2c1310d81da1e321f19b1
2018-04-13 20:01:06 -07:00
Jakub Grzmiel 3e92073afc Handle processColor in routes
Reviewed By: shergin

Differential Revision: D6646858

fbshipit-source-id: c709464699482ef0c0b77434560612b99716074f
2018-04-12 14:47:05 -07:00
Sebastian Markbage 5001b9f39e Unfork Fabric
Reviewed By: achen1, mdvacca

Differential Revision: D7582130

fbshipit-source-id: f198c63ed2fcd8619610b4b2f28276e7ffca9217
2018-04-11 18:34:07 -07:00
Peter van der Zee f8d6b97140 BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Summary:
BREAKING CHANGE
This change upgrades the React Native build pipeline from Babel 6 to Babel 7

If you use a `.babelrc` then you'll need to update it to Babel 7 (note that some plugins are no longer relevant, some plugins are automatically upgraded, and some will need some manual love).

Note that you may also need to upgrade your dev env, tests etc, to make sure they work with Babel 7.

Reviewed By: mjesun

Differential Revision: D7591303

fbshipit-source-id: 29cef21f6466633a9c366d1f3c0d3cf874c714db
2018-04-11 16:47:18 -07:00
Matt Mahoney c9a6b8560f Revert D7097279: BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Differential Revision:
D7097279

Original commit changeset: 9fb204cae733

fbshipit-source-id: bbbb20b5dbed5dc01ae5557686a07d987b9a6cc6
2018-04-11 08:25:17 -07:00
Peter van der Zee ebd12fa09f BREAKING CHANGE: UPGRADE REACT NATIVE TO BABEL 7!
Summary:
BREAKING CHANGE
This change upgrades the React Native build pipeline from Babel 6 to Babel 7

If you use a `.babelrc` then you'll need to update it to Babel 7 (note that some plugins are no longer relevant, some plugins are automatically upgraded, and some will need some manual love).

Note that you may also need to upgrade your dev env, tests etc, to make sure they work with Babel 7.

Reviewed By: cpojer

Differential Revision: D7097279

fbshipit-source-id: 9fb204cae733174a1c155669b7c17ddb70f7aecc
2018-04-10 21:02:43 -07:00
Manuel Alabor 80fc415cf1 Expose InputAccessoryView Module
Summary:
The latest release of react-native (0.55.2) does not expose the new `InputAccessoryView` component; It can't be accessed at all. This change fixes this problem.

* Problem: Snack showing the problem: https://snack.expo.io/B1fDQRYif
* Proof: `RNTester` still works with adapted imports

No related PRs.

[IOS] [BUGFIX] [InputAccessoryView] - Expose `InputAccessoryView` so it can be imported
Closes https://github.com/facebook/react-native/pull/18780

Differential Revision: D7581729

Pulled By: hramos

fbshipit-source-id: d61ab1f167360e829e32b93fb5414d2f7e57e115
2018-04-10 20:03:15 -07:00
Sebastian Markbage 906dde06b3 React sync for revisions 7a3416f...725c054
Reviewed By: bvaughn

Differential Revision: D7565731

fbshipit-source-id: 91d76a11b7c91dab2fb3295418d1372ca9c1b572
2018-04-10 15:57:33 -07:00
Bjørn-Erik Andreasen 2f1421dec7 Fix for scrollview android
Summary:
Trying this again with a fresh pullrequest as the old one kept having issued due to rebasing.

Fixes #16635
the issue is a little serious if you use a scrollview which contains textinput, you will never get a chance to input something since keyboard will always be dismissed because of on-drag event if your scroll-view use the property: keyboardDismissMode ='on-drag'

verify the issue #16635 and tested this fix worked

[ANDROID] [BUGFIX] [ScrollView] - Check that isTouching is also set when dismissing keyboard with on-drag android.
Closes https://github.com/facebook/react-native/pull/18785

Differential Revision: D7569815

Pulled By: hramos

fbshipit-source-id: 2a07369297ce9ce5a7714e513ccb480ee7011a4d
2018-04-10 10:55:01 -07:00
Sebastian Markbage b4c71361d9 Don't freeze null
Reviewed By: acdlite

Differential Revision: D7567032

fbshipit-source-id: ea9c826d572371748c6e9b5defbb92b427d83bee
2018-04-10 09:37:27 -07:00
Sebastian Markbage a8e3c7f578 Yolo Delete ReactNativePropRegistry
Summary:
Changed StyleSheet.create to be the identity function. We no longer hide it behind an opaque number. Better for types and perf since we don't use it.

I don't really know if we have/need any safer way of rolling this out than just landing it.

It can break if the object passed to StyleSheet.create is mutated afterwards but that isn't a practice anywhere I've seen.

Reviewed By: sophiebits

Differential Revision: D7530023

fbshipit-source-id: bc1afa879c5a5d9cd95cb13bc8ff3347b3622851
2018-04-09 18:46:11 -07:00
Andrew Kriger 722f88ca90 Adds Android click sound to Touchables
Summary:
Android apps play a touch sound on press, as long as you have "Touch sounds" enabled in the settings. As and Android user, when building my app using React Native, one of the first things I noticed was that there were not any touch sounds. This is missing from React Native and there have been multiple PRs to have this implemented, but no success.

This PR iterates over [#6825](https://github.com/facebook/react-native/pull/6825) and [#11136](https://github.com/facebook/react-native/pull/11136)

This PR keeps it simple by only implementing the enhancement for Android, as iOS apps typically do not use touch sounds, and follows the users' system settings for whether or not the sound is played.

I have manually tested this on multiple devices and emulators with zero problems

[ANDROID] [ENHANCEMENT] [UIManagerModule.java]- Adds Android click sound to touchables

[ANDROID] [ENHANCEMENT] [Touchable] - Adds Android click sound to touchables
Closes https://github.com/facebook/react-native/pull/17183

Differential Revision: D7560327

Pulled By: hramos

fbshipit-source-id: ce1094c437541bc677c7d64b0dba343dd9574422
2018-04-09 17:01:57 -07:00
Eric Rozell 4b6e9d3dfd Revert "Remove Platform check from WebSocket module"
Summary:
This reverts commit b9be28915c.

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.

<!--
  Required: Write your motivation here.
  If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->

Fix #18696

<!--
  Required: 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!
-->

Run Jest tests.
Run WebSocket example from RNTester on Android.

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

<!--
  Required.
  Help reviewers and the release process by writing your own release notes. See below for an example.
-->

[CATEGORY] [TYPE] [LOCATION] - Message

<!--
  **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 ] [ {Filename}  ]
  [ IOS      ] [ FEATURE     ] [ {Directory} ]   |-----------|
  [ ANDROID  ] [ MINOR       ] [ {Framework} ] - | {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
-->
[ANDROID][BUGFIX][WebSocketModule] - revert change that regresses WebSocketModule
Closes https://github.com/facebook/react-native/pull/18733

Differential Revision: D7548850

Pulled By: hramos

fbshipit-source-id: b8c79810c1cd6e5a30ec4118bd5ff8ad719f04b9
2018-04-08 18:15:53 -07:00
Sebastian Markbage 9574f88701 Move takeSnapshot from React repo to RN
Reviewed By: sophiebits

Differential Revision: D7547298

fbshipit-source-id: 6ab0c0a9e244a2f68d27307b84285b2c8fff1342
2018-04-07 23:23:33 -07:00
Sam Mueller 554243eb56 Fix TouchHistoryMath import
Summary:
The reference needed to be updated after the file was moved in this commit:
06085d3836

Otherwise, results in the packager failing with the following error:
> Unable to resolve module TouchHistoryMath from /node_modules/react-native/Libraries/Interaction/PanResponder.js: Module TouchHistoryMath does not exist in the Haste module map
Closes https://github.com/facebook/react-native/pull/18732

Differential Revision: D7547181

Pulled By: sebmarkbage

fbshipit-source-id: 78028c2f46faa2ce130a1a0c25fcaca47d2516a8
2018-04-07 21:09:24 -07:00
Liamandrew 3372541a2a Add ability for Animated views to be created with scale X or scale Y
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!

-->

*Accidentally closed previous PR*

Sometimes it can be useful to have an animated view be created with either scale X or scale Y in cases where scaleXY might not be as visually appealing.

Test Plan
Tested on both ios and android in the sample project:

https://github.com/Liamandrew/ScaleAnimationSample

![scaleanimation](https://user-images.githubusercontent.com/30114733/37023697-d0aa7372-217a-11e8-8d3b-2958c63ad83a.gif)
Closes https://github.com/facebook/react-native/pull/18220

Differential Revision: D7542334

Pulled By: hramos

fbshipit-source-id: 208472e5d8f5a04ca3c3a99adce77b035e331ef1
2018-04-06 17:46:54 -07:00
Dulmandakh b0fa3228a7 Implement Image.defaultSource property on Android
Summary:
This pull request implements Image.defaultSource property on Android, using Fresco (http://frescolib.org/docs/placeholder-failure-retry.html), which will show placeholder image (local asset) while loading remote image. Implementation code is almost same with loadingIndicatorSource, but without rotation.

This requires release or production to bundle local images in an APK file.

This provides feature parity with iOS.

Set Image.defaultSource on Android, and will show it while loading Image.source.

```JSX
<Image
  defaultSource={require('<path to image>')}
  source={{uri: '<url to remote image>'}}
  style={{ height: 300, width: 300 }}
/>
```

[ANDROID] [FEATURE] [IMAGE] - Image.defaultSource will show local image as placeholder while loading remote Image.source.
Closes https://github.com/facebook/react-native/pull/18588

Differential Revision: D7540489

Pulled By: himabindugadupudi

fbshipit-source-id: 908ceb659b3416e517bba64c76a31879d965ec09
2018-04-06 16:03:00 -07:00
Sebastian Markbage 06085d3836 Move TouchHistoryMath from React Repo to React Native
Summary:
This hasn't been used by React core for a while. It's unclear why it was in the first place.

We can move it back next to the Panresponder.

https://github.com/facebook/react/pull/12557

Reviewed By: sophiebits

Differential Revision: D7529949

fbshipit-source-id: ef9892cfa8d2d6768da216b81befabe02795a245
2018-04-05 22:07:01 -07:00
Héctor Ramos 445b0c7080 React sync for revisions 1c2876d...7a3416f
Reviewed By: bvaughn

Differential Revision: D7526137

fbshipit-source-id: 9f9db8a6b56cb4ae581a7b8d28079ec38de2180f
2018-04-05 17:34:53 -07:00
Peter van der Zee 439614891c Small refactor
Reviewed By: cpojer

Differential Revision: D7498659

fbshipit-source-id: 43ad85645e2366a385e08d68172e76e336fdfb1f
2018-04-05 06:36:53 -07:00
Peter van der Zee cea798c57b Downgrade ES6 import to ES5 compat module.exports
Reviewed By: rubennorte

Differential Revision: D7498658

fbshipit-source-id: 6825c3010ce13c56f05284448ad9961fe058d7ea
2018-04-05 06:36:53 -07:00
Peter van der Zee 4a814d1370 Change ES6 module syntax to module.exports
Reviewed By: rubennorte

Differential Revision: D7490562

fbshipit-source-id: 861681c24eab678d25af47bb25738651fe3e26b4
2018-04-05 06:36:53 -07:00
Peter Argany 490f22ae72 Fix bug with <InputAccessoryView> safe area conformance
Reviewed By: wwalser

Differential Revision: D7507732

fbshipit-source-id: 10bf8d58c65f1353a3e62a27fc74c2dfd73ac2c4
2018-04-04 16:47:16 -07:00
Brian Vaughn e574b85db6 React sync for revisions 9d484ed...1c2876d
Reviewed By: gaearon

Differential Revision: D7500761

fbshipit-source-id: 8dc1cda879942fc4990b23144a616039fdbe6dc0
2018-04-04 15:20:13 -07:00
Dominik Wienand 0b4f33c2d0 Use .includes instead of .startsWith for checking ignored YellowBox warnings
Summary:
Some warnings don't have a good prefix that can be targeted using .startsWith, e.g. "Module $modulename requires main queue setup". It would be helpful to be able to select this warning using the much more specific middle part of the string ("requires main queue setup since it overrides `constantsToExport`) so I want to change this check from startsWith to includes to enable that.

Changing from .startsWith -> .includes should be completely backward compatible.

Reviewed By: TheSavior

Differential Revision: D7445309

fbshipit-source-id: 2c91dbe5ee3c3aa74be1bca091b20d294e64e853
2018-04-04 13:30:35 -07:00
Kyle Roach 746945824a fix(RCTImageLoader): Adds `requiresMainQueueSetup` to fix v0.52
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!

-->

In react-native v0.52 this warning shows:
```
"RCTImageLoader requires main queue setup
since it overrides `init` but doesn't implement `requiresMainQueueSetup`".
```
This removes the warning by implementing `requiresMainQueueSetup` on RCTImageLoader

* Create new react-native project
* Enable Remote JS Debugging
* Should see no warning regarding RCTImageLoader requiring main queue setup

<!--
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] [BUGFIX] [Libraries/Image/RCTImageLoader.m] - Implements `requiresMainQueueSetup`
Closes https://github.com/facebook/react-native/pull/17679

Reviewed By: shergin

Differential Revision: D7159601

Pulled By: fkgozali

fbshipit-source-id: e17bae67f4005d2c9ddd0d3701506521f3cac152
2018-04-03 16:41:43 -07:00
Paco Estevez Garcia 976712afa3 Replace RN exception handling override with new version
Reviewed By: Hypuk

Differential Revision: D7385541

fbshipit-source-id: 287d3f4d681046f740ed0552e00a2249c3803a0b
2018-04-03 06:01:37 -07:00
Douglas Lowder 201e74f9b7 Fix tvOS build breakage in RCTAnimation Xcode project
Summary:
`RCTSubtractionAnimatedNode.m` was not added to the tvOS build of RCTAnimation... this PR fixes the issue.

tvOS CI should succeed after this change.

[TVOS] [BUGFIX] [RCTAnimation] Fix build breakage
Closes https://github.com/facebook/react-native/pull/18663

Differential Revision: D7483586

Pulled By: hramos

fbshipit-source-id: 521152d829b064b7002dc8651a0558373c5505f8
2018-04-02 22:33:45 -07:00
Christian Brevik d4fb87b0b8 Add iOS 10 textContentType for TextInput
Summary:
Setting `textContentType` will provide the keyboard and system with semantic meaning for inputs. Should enable password/username autofill in apps running on iOS 11+ as demonstrated here: https://developer.apple.com/videos/play/wwdc2017/206/

Also gives you the ability to disable autofill by setting `textContentType="none"`: https://stackoverflow.com/questions/48489479/react-native-disable-password-autofill-option-on-ios-keyboard

Adding `textContentType` equal to `username` or `password`  should give you an autofill-bar over the keyboard which will let you fill in values from the device Keychain:

![image](https://user-images.githubusercontent.com/4932625/37848513-b2170490-2ed4-11e8-85bf-895823d4f98a.png)

Setting the appropriate `textContentType` will fill in the correct value in the `TextInput`.
I have only been able to get this to work on device, and not simulator.

Usage:
```jsx
<TextInput
    value={this.state.username}
    onChangeText={this.setUserName}
    textContentType="username"
/>
```

```jsx
<TextInput
    value={this.state.password}
    onChangeText={this.setPassword}
    secureTextEntry={true}
    textContentType="password"
/>
```

To disable:
```jsx
<TextInput
    value={this.state.password}
    onChangeText={this.setPassword}
    secureTextEntry={true}
    textContentType="none"
/>
```

This will set `textContentType` to an empty string: https://stackoverflow.com/a/46474180/5703116

<!--
  Does this PR require a documentation change?
  Create a PR at https://github.com/facebook/react-native-website and add a link to it here.
-->

Docs PR coming up.

[IOS] [MINOR] [TextInput] - Added `textContentType` prop for iOS 10+. Will enable password autofill for iOS 11+.
Closes https://github.com/facebook/react-native/pull/18526

Differential Revision: D7469630

Pulled By: hramos

fbshipit-source-id: 852a9749be98d477ecd82154c0a65a7c084521c1
2018-04-02 02:46:43 -07:00
Vladislav Pilgasov 4906f8d28c Add an implementation of Animated.subtract
Summary:
Fixes #18451

I've added another example to NativeAnimationsExample, which makes use of `Animated.substract()`, let me know if the example is not desired / doesn't add much value. Below two GIFs of the new method working on iOS and Android:

<img width="320" src="https://user-images.githubusercontent.com/1437605/38154748-165cc5f8-3474-11e8-8b31-504444271896.gif" />
<img width="320" src="https://user-images.githubusercontent.com/1437605/38154749-1679bff0-3474-11e8-80b1-b558d44e0494.gif" />

<!--
  Required: 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!
-->

https://github.com/facebook/react-native-website/pull/276

[GENERAL] [ENHANCEMENT] [Animated] - Implemented Animated.subtract
Closes https://github.com/facebook/react-native/pull/18630

Differential Revision: D7462867

Pulled By: hramos

fbshipit-source-id: 4cb0b8af08bb0c841e44ea2099889b8c02a22a4a
2018-03-30 21:08:52 -07:00
Peter van der Zee 88ba7ebcc7 Fix "function statements" in strict mode builds
Reviewed By: davidaurelio

Differential Revision: D7427473

fbshipit-source-id: 130d0653c100c4a12b2a01aa3489b780febf6d8e
2018-03-28 10:12:41 -07:00
Miguel Jimenez Esun bd134ce6af Increase timeouts to 15, 10
Reviewed By: javache

Differential Revision: D7415558

fbshipit-source-id: 76912d22b8e330845fcca3fa27aab6ed28256a94
2018-03-28 04:45:26 -07:00
Peter Argany fd4bc72512 Add custom RefreshControl support to VirtualizedList
Reviewed By: TheSavior, mmmulani

Differential Revision: D7388137

fbshipit-source-id: 8a1448e5fc526b45773fe4a4f123a179d4a8bee9
2018-03-27 18:19:30 -07:00
Janic Duplessis e3941a18b1 Native Animated - Support border radius
Summary:
Border radius already works properly with native animated but was not in the whitelisted props.

Tested in an app that animating border radius with native animated actually works.

[GENERAL] [ENHANCEMENT] [NativeAnimated] - Support border radius
Closes https://github.com/facebook/react-native/pull/18574

Differential Revision: D7415956

Pulled By: hramos

fbshipit-source-id: 6dd46bcdcb10c6a1956dd1f526212f33a4f44425
2018-03-27 15:19:20 -07:00
Janic Duplessis f5207ba9c7 Fix blob response parsing for empty body on iOS
Summary:
We currently handle empty body poorly in the iOS blob implementation, this happens because of an early return that cause the blob response to not be processed by the blob module, resulting in an empty string as the body instead of a blob object. We also need to make sure to create an empty blob object when data is nil (empty body) as per the XMLHttpRequest spec. The Android implementation was already handling this properly.

Fixes #18223

Send a HEAD request

```js
fetch('https://apipre.monkimun.com/whoami', {
  body: null,
  method: 'HEAD',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
})
```

[IOS][BUGFIX][Blob] - Fix blob response parsing for empty body
Closes https://github.com/facebook/react-native/pull/18547

Differential Revision: D7415950

Pulled By: hramos

fbshipit-source-id: 56860532c6171255869f02a0960f55d155184a46
2018-03-27 11:13:34 -07:00
Gustavo Gard 8b9b3f605e Correct AnimatedValueXY URL
Summary:
Correct URL
Closes https://github.com/facebook/react-native/pull/18556

Differential Revision: D7396357

Pulled By: mdvacca

fbshipit-source-id: f8ff6c9b037fe733cf3be8d1b889d1dcd9c94afb
2018-03-25 20:01:30 -07:00
Jake 228f5c83f9 use correct delegate queue in RCTRSWebSocket
Summary:
This commit makes the websocket's delegate dispatch queue use `RCTWebSocketModule`'s method queue.

This fixes a bug where didReceiveMessage was called on the wrong queue, which is especially harmful if the websocket has a contentHandler expects to be running on the RCTWebSocketModule's method queue.

This also fixes the race condition where `_contentHandlers` and `_sockets` can be mutated from the main dispatch queue (the default in `RCTRSWebSocket`) and `RCTWebSocketModule`'s method queue.

Websockets still work, and hopefully crash less now.

- [iOS][BUGFIX][WebSocket] fix crashes caused by a race condition in websocket delegates.
Closes https://github.com/facebook/react-native/pull/18530

Differential Revision: D7394298

Pulled By: hramos

fbshipit-source-id: 230466ccb47ea532ced15cd7603256a19077b32b
2018-03-24 23:16:20 -07:00
Danny Cochran dd479a9377 Pass invertStickyHeaders to ScrollView
Summary:
invertStickyHeaders was being set to "this.props.inverted" -- it should just inherit from the props of VirtualizedList instead, per discussion in https://github.com/facebook/react-native/issues/18471

Fixes #18471

Pass "invertStickyHeaders: false" to a SectionList (or FlatList), and expect that your sticky headers stick to the bottom of the ScrollView, instead of the top.

none

[ANDROID] [BUGFIX] [SectionList] - invertStickyHeaders can now be set from SectionList or FlatList.
Closes https://github.com/facebook/react-native/pull/18524

Differential Revision: D7386163

Pulled By: hramos

fbshipit-source-id: 3b66dfca280e657303f69f98c5a8bc0df033f9f7
2018-03-23 15:12:39 -07:00
Andrew Chen (Eng) cbb7c7c193 Pass fabric flag from native to JS
Reviewed By: mdvacca

Differential Revision: D7373722

fbshipit-source-id: 3cd051f38677900693f3da797effa11f9161df37
2018-03-23 09:32:00 -07:00
Eli White d50cefb1f2 Moving remaining Style types from StyleSheetTypes to StyleSheet
Reviewed By: yungsters

Differential Revision: D7282831

fbshipit-source-id: ced44d79ad30b7abdda77a25b72493899c2108e4
2018-03-21 14:15:32 -07:00
Eli White a0388f4adc Move ViewStyle, TextStyle, ImageStyle from StyleSheetTypes to StyleSheet
Reviewed By: yungsters

Differential Revision: D7282491

fbshipit-source-id: d6b54d0a2e1fe1816b6a856b1b0b1245a655320a
2018-03-20 19:16:46 -07:00
Eli White f68e04136c Move TypeForStyleKey from StyleSheetTypes to StyleSheet
Reviewed By: yungsters

Differential Revision: D7281362

fbshipit-source-id: 936d198e83dfbfc62449e82b5559a30bd57621c4
2018-03-20 19:16:46 -07:00
Héctor Ramos 3b36a6bf06 React sync for revisions ced176e...9d484ed
Reviewed By: bvaughn

Differential Revision: D7338640

fbshipit-source-id: e2d75d2f1795fb3c37f193d15216951c707711d9
2018-03-20 17:14:40 -07:00
Kevin Gozali 38fe8c2a9e moved ReactFabricInternals outside of shims
Summary: Simply moving it out of shims to not confuse React project

Reviewed By: bvaughn

Differential Revision: D7341846

fbshipit-source-id: b1a0cdb0caca977de744699521f42556699993a7
2018-03-20 15:45:08 -07:00
Jeff Hampton f6bcd73ed7 feat: Remove platform check in requireNativeComponent to support additional platforms
Summary:
Using platform checks can make it difficult to incorporate changes for other platforms (e.g. Windows).
 Using a check for the underlying function accomplishes the same goal without relying on an Android-specific check.  This change allows this JS file to be re-used instead of copied and modified.

[X] Run Jest tests
[X] Test in RNTester on simulators
[X] Test in Playground

No related PR's found :)

[GENERAL] [ENHANCEMENT] [Libraries/ReactNative/requireFabricComponent.js] - Simplified check against UIManager to support additional platforms, removing Android-specific check
Closes https://github.com/facebook/react-native/pull/18381

Differential Revision: D7336214

Pulled By: hramos

fbshipit-source-id: e936f1fdcf36556c528115ee3f79197883d7b7d4
2018-03-20 05:32:50 -07:00
Charles Dick aabd5d1458 Use map instead of array
Reviewed By: dcaspi

Differential Revision: D7327839

fbshipit-source-id: e48d2b9f34e337d14f9519eac16b6a15fa56deb5
2018-03-20 04:17:55 -07:00
Andrew Chen (Eng) f136ae1362 Add test for FabricText
Reviewed By: mdvacca

Differential Revision: D7326562

fbshipit-source-id: e1229f84496e9181475979d757066e3796a24a3f
2018-03-20 01:01:53 -07:00
Andrew Chen (Eng) 785c8f7eb9 Use native as the source of truth to decide if a test should use Fabric
Reviewed By: fkgozali

Differential Revision: D7304221

fbshipit-source-id: cdd7053e6ce6522474df261db5710e2d9c013be6
2018-03-20 01:01:53 -07:00
Sam Goldman 0d924dd629 Upgrade to Flow v0.68.0
Reviewed By: gabelevi

Differential Revision: D7310349

fbshipit-source-id: 70d29815dd7912704aec8a015c970be3fafeeba3
2018-03-19 18:31:36 -07:00
Peter Argany ff70ecf868 Fixed <TextInput> bug with autocapitalization
Reviewed By: shergin

Differential Revision: D7304936

fbshipit-source-id: ef587db89b64e7111dfdeb049c3a1a334c15430b
2018-03-19 14:20:18 -07:00
Mehdi Mulani 9d45de60ac Properly tear down the reachabilityRef in RCTNetInfo
Summary: The pull request that added this (#17397) simply forgot to remove the callback, which would cause crashes if the RCTNetInfo module was ever deallocated. While that usually doesn't happen in apps, it can if the user logs out and you need to wipe all the RCT modules (to remove user data, for instance).

Reviewed By: PeteTheHeat

Differential Revision: D7322999

fbshipit-source-id: e49ec7311b39920f7b7743a5854c0dda1dbccc73
2018-03-19 11:00:23 -07:00
Peter Argany 15bc6d1e0b Added console warning to InputAccessoryView
Reviewed By: mmmulani

Differential Revision: D7305377

fbshipit-source-id: 4a9888b5592014956c3aa44baffb2ac3a0329b88
2018-03-19 10:17:15 -07:00
Dmitry Zakharov c73242938c Make access to SourceCode Native Extension lazy
Reviewed By: fromcelticpark

Differential Revision: D6987478

fbshipit-source-id: 6d600131239be34480bd1c5a0ca84b4fab360386
2018-03-19 09:33:31 -07:00
Cristiano Santos def789cd7e Wrong height when TextInput has an empty string
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!

-->

The caret/cursor did not appear when the TextInput was empty. Found that the cause was because the frame of the TextInput had an height of 0

Just fill and clear a TextInput and the caret/cursor will always appear there.

<!--
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] [BUGFIX] [TextInput] - This was causing the cursor/caret to not appear since the size of the frame had an height of 0.
Closes https://github.com/facebook/react-native/pull/18355

Differential Revision: D7319723

Pulled By: shergin

fbshipit-source-id: b0249ab5493b6ac310d1898ff20c0bad78cf82c9
2018-03-19 02:46:34 -07:00
tuncaulubilge 263d04d756 Added nestedScrollEnabled prop to scroll view for android
Summary:
Nested scrolling in scrollViews, listViews and flatLists are enabled on iOS by default, but needs to be enabled manually on Android. This PR introduces a `nestedScrollEnabled` property to ScrollViews to support nested scrolling on Android 21 and above.

Enabling nested scroll will resolve issues with coordinator layout in android and required to support a collapsing toolbar.

Tested on the test app. We are also using this property in our app currently to support scrolling behaviour required by coordinator layouts.

[ANDROID] [ENHANCEMENT] [ScrollView] - Added a prop to enable nested scrolling
Closes https://github.com/facebook/react-native/pull/18299

Reviewed By: sahrens

Differential Revision: D7256604

Pulled By: mdvacca

fbshipit-source-id: fb8b7f1b5bed39837a2066db7f2a8798d52a3fd6
2018-03-18 20:16:15 -07:00
Kevin Gozali 1c53471911 iOS OSS: fixed RNTester - missing RCTInputAccessoryShadowView.* in .xcodeproj
Reviewed By: yungsters

Differential Revision: D7317380

fbshipit-source-id: 0a40d62c70cd3c3a875e5a418f4b77fecb0417b1
2018-03-17 22:01:15 -07:00
Peter Argany 139d554c48 Replace js Dimensions with shadow view in InputAccessoryViewExample
Reviewed By: mmmulani

Differential Revision: D7196168

fbshipit-source-id: 031ed5ab24d1075f775ec71e5b78d32e03fe8f6f
2018-03-15 10:14:15 -07:00
Brian Vaughn 22004db819 React sync for revisions ad9544f...ced176e
Reviewed By: sebmarkbage

Differential Revision: D7281277

fbshipit-source-id: 75a638114cf2a65a5c973dbdf218f6d3ba042cc4
2018-03-14 23:30:53 -07:00
Andrew Chen (Eng) d678058402 Add Fabric integration test
Reviewed By: fkgozali

Differential Revision: D7207630

fbshipit-source-id: 69cc10d7d45031eec9f3d934b981a5e4bb62a0ef
2018-03-14 16:27:05 -07:00
Khaer Ansori c595509048 Add number-pad keyboardType
Summary:
On Android there's no number-pad but numeric instead, for my use-case I need number only (without decimal and sign, for PIN input)

I write it so there's no breaking change for those already using the `TextInput` Component

None

[ANDROID][ENHANCEMENT][Component] Add number-pad keyboardType
Closes https://github.com/facebook/react-native/pull/18350

Reviewed By: achen1

Differential Revision: D7269721

Pulled By: mdvacca

fbshipit-source-id: 82571dce948e0cf2e4354dc46c69198ec69ba65a
2018-03-14 14:48:10 -07:00
Eli White 28c9c68cfa Adding documentation to new StyleSheet Flow Types
Summary: Adding some explanation and examples of when to use these types.

Reviewed By: yungsters

Differential Revision: D7270185

fbshipit-source-id: c82f061ffb77e33133a59d268a08f7a95fd02fb6
2018-03-14 14:41:32 -07:00
Eli White 8bac869f5d Create Flow Props for Image
Reviewed By: yungsters

Differential Revision: D7270057

fbshipit-source-id: 1ecac28e4060fe0e85a4f0698406f8986ae16caf
2018-03-14 14:12:31 -07:00
Eli White 67656991b3 Move Image PropTypes to a new file
Reviewed By: yungsters

Differential Revision: D7270058

fbshipit-source-id: 91ad7700b7e89c393c6977bfd82494d2febda4a4
2018-03-14 14:12:31 -07:00
Alejandro Paredes Alva 7ce943ef3b Adds _lineHeight = NAN; to RCTTextAttributes
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!

-->

On iOS, when the parent Text contains the `lineHeight` style prop, and the children are also Text components they don't inherit the lineHeight prop.

This is for **iOS** only.
Create a react-native project with React Native 0.54.0 or 0.54.1 and change the app to:
```js
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={{ fontWeight: 'bold', lineHeight: 40 }}>
          <Text style={{ color: 'orange' }}>I am bold and orange, </Text>
          <Text style={{ color: 'red' }}>I am bold and red, </Text>
          <Text style={{ color: 'blue' }}>I am bold and blue, </Text>
          <Text style={{ color: 'purple' }}>I am bold and purple, </Text>
          <Text style={{ color: 'yellow' }}>I am bold and yellow, </Text>
          <Text style={{ color: 'pink' }}>I am bold and pink</Text>
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'black',
    flex: 1,
    justifyContent: 'center',
    padding: 50,
  },
});
```
It displays:
![iphone - 2018-03-12 at 21 51 53](https://user-images.githubusercontent.com/480605/37308941-b56f082e-263f-11e8-9c23-892f77077169.png)

But should look like:
![iphone - 2018-03-12 at 21 48 15](https://user-images.githubusercontent.com/480605/37308784-4efaddf2-263f-11e8-992b-ee0b6bb9a97b.png)

New &lt;Text> iOS https://github.com/facebook/react-native/commit/2716f53

<!--
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] [MINOR] [Text] - Inherit lineheight
Closes https://github.com/facebook/react-native/pull/18340

Differential Revision: D7276655

Pulled By: shergin

fbshipit-source-id: 0fe26536bb74da77be8405911fc699a622bc0b2f
2018-03-14 13:41:37 -07:00
Héctor Ramos 4f8328bf2f React sync for revisions ab4280b...ad9544f
Reviewed By: bvaughn

Differential Revision: D7256390

fbshipit-source-id: 9fe1324da93cb8f4a7f478e1037944774b9b95ff
2018-03-14 09:02:31 -07:00
Janic Duplessis db061ea8c7 Don't wrap ListEmptyComponent in an extra view
Summary:
A common UI pattern for list empty states is some text/images centered inside the visible part of the list. This is pretty hard to do currently because we wrap ListEmptyComponent with an extra view with no way to style it so we cannot just use `flex: 1` to make it fill the available space.

- Added an example of ListEmptyComponent in the FlatList example in RNTester

Before (no way to make ListEmptyComponent fill the space):
<img width="377" alt="screen shot 2018-03-05 at 5 24 15 pm" src="https://user-images.githubusercontent.com/2677334/37003152-129db3ac-209a-11e8-9600-110f10d57144.png">

After:
<img width="377" alt="screen shot 2018-03-05 at 5 09 20 pm" src="https://user-images.githubusercontent.com/2677334/37002809-e6971178-2098-11e8-8cf7-74bfb2f6a992.png">

- Tested some edge cases like returning null from the ListEmptyComponent

- Tested in an app that uses FlatList + ListEmptyComponent

[GENERAL] [MINOR] [VirtualizedList] - Don't wrap ListEmptyComponent in an extra view
Closes https://github.com/facebook/react-native/pull/18206

Differential Revision: D7266274

Pulled By: sahrens

fbshipit-source-id: 4636d2418474a4c86ac63e5e18a9afc391a518c5
2018-03-13 18:11:31 -07:00
Peter Argany c136c54ff0 Refactor RCTInputAccessoryView view hierarchy and names
Reviewed By: shergin

Differential Revision: D7196162

fbshipit-source-id: 07a5c13d4cdb876f5a632d7d53859eab5e235f49
2018-03-13 11:25:12 -07:00
Eli White ab92c00245 Convert Text to ES6 Class
Summary: Utilizing ES6 Classes instead of createReactClass lets us actually enforce the way Text is used via Flow.

Reviewed By: fkgozali

Differential Revision: D7227755

fbshipit-source-id: 8e8285f9ebb3783a0dc4837c37c163178910ff9f
2018-03-12 18:06:28 -07:00
Moti Zilberman 0459e4ffaa Support Image resizeMode=repeat on Android
Summary:
`<Image resizeMode="repeat" />` for Android, matching the iOS implementation (#7968). (Non-goal: changing the component's API for finer-grained control / feature parity with CSS - this would be nice in the future)

As requested in e.g. #14158.

Given https://github.com/facebook/fresco/issues/1575, and lacking the context to follow the specific recommendations in https://github.com/facebook/fresco/issues/1575#issuecomment-267004303, I've opted for a minimal change within RN itself.

It's likely that performance can be improved by offloading this work to Fresco in some clever way; but I'm assuming that the present naive approach is still an improvement over a userland implementation with `onLayout` and multiple `<Image>` instances.

- Picking up on a TODO note in the existing code, I implemented `MultiPostprocessor` to allow arbitrary chaining of Fresco-compatible postprocessors inside `ReactImageView`.
- Rather than extensively refactor `ImageResizeMode`, `ReactImageManager` and `ReactImageView`, I mostly preserved the existing API that maps `resizeMode` values to [`ScaleType`](http://frescolib.org/javadoc/reference/com/facebook/drawee/drawable/ScalingUtils.ScaleType.html) instances, and simply added a second mapping, to [`TileMode`](https://developer.android.com/reference/android/graphics/Shader.TileMode.html).
- To match the iOS rendering exactly for oversized images, I found that scaling with a custom `ScaleType` was required - a kind of combination of `CENTER_INSIDE` and `FIT_START` which Fresco doesn't provide - so I implemented that as `ScaleTypeStartInside`. (This is, frankly, questionable as the default behaviour on iOS to begin with - but I am aiming for parity here)
- `resizeMode="repeat"` is therefore unpacked by the view manager to the effect of:
  ```js
     view.setScaleType(ScaleTypeStartInside.INSTANCE);
     view.setTileMode(Shader.TileMode.REPEAT);
   ```
  And the added postprocessing in the view (in case of a non-`CLAMP` tile mode) consists of waiting for layout, allocating a destination bitmap and painting the source bitmap with the requested tile mode and scale type.

Note that as in https://github.com/facebook/react-native/pull/17398#issue-285235247, I have neither updated nor tested the "Flat" UI implementation - everything compiles but I've taken [this comment](https://github.com/facebook/react-native/issues/12770#issuecomment-294052694) to mean there's no point in trying to wade through it on my own right now; I'm happy to tackle it if given some pointers.

Also, I'm happy to address any code style issues or other feedback; I'm new to this codebase and a very infrequent Android/Java coder.

Tested by enabling the relevant case in RNTester on Android.

| iOS | Android |
|-|-|
| <img src=https://user-images.githubusercontent.com/2246565/34461897-4e12008e-ee2f-11e7-8581-1dc0cc8f2779.png width=300>| <img src=https://user-images.githubusercontent.com/2246565/34461894-40b2c8ec-ee2f-11e7-8a8f-96704f3c8caa.png width=300> |

Docs update: https://github.com/facebook/react-native-website/pull/106

[ANDROID] [FEATURE] [Image] - Implement resizeMode=repeat
Closes https://github.com/facebook/react-native/pull/17404

Reviewed By: achen1

Differential Revision: D7070329

Pulled By: mdvacca

fbshipit-source-id: 6a72fcbdcc7c7c2daf293dc1d8b6728f54ad0249
2018-03-12 16:14:18 -07:00
Vince Oppedisano 9c8c597000 Don't truncate in the middle of an emoji
Reviewed By: adiphos, mantong01

Differential Revision: D7198155

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

Tested Android and iOS playground on simulators.

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

Differential Revision: D7230803

Pulled By: hramos

fbshipit-source-id: 11e03183535a7453cee00dc1e795c27f2fd2bf5d
2018-03-12 08:43:05 -07:00
Jiajie Zhu 450e562727 export CompositeAnimation type
Differential Revision: D7216928

fbshipit-source-id: 9e8c456c7e94ec3456061ad5c699c0eae30cbe5e
2018-03-10 20:25:31 -08:00
Tim Yung 01fffa245d RN: Remove DebugEnvironment from OSS
Reviewed By: TheSavior

Differential Revision: D7209266

fbshipit-source-id: 9f9ce66121ff375e5a5d965d58f4137616407853
2018-03-10 19:07:48 -08:00
Eli White 3fd82d3c89 Fixing misuses of the Text type
Reviewed By: fkgozali

Differential Revision: D7227752

fbshipit-source-id: 3577c86b416a7c04190063243839e98e2a80ec7f
2018-03-10 18:39:47 -08:00
Eli White cd8128b2ec Move Text PropTypes to it's own file
Reviewed By: fkgozali

Differential Revision: D7226404

fbshipit-source-id: b5637dee9a4f10daf0682e46f1ec8920ea03ae33
2018-03-10 18:39:47 -08:00
Eli White 26734a8473 Migrating View to be a Flow Typed ES6 class
Summary:
The flow type for View using createReactClass was essentially `any`, allowing any Prop to be passed in, only pseudo enforced at run time via propTypes.

This diff converts View away from createReactClass and instead uses ReactNative.NativeComponent. This was previously typed as any as well which didn't buy us much. This change converts View to be an ES6 React class component to ensure proptypechecking, and exposes the methods copied from NativeMethodsMixin.

Reviewed By: yungsters

Differential Revision: D5933888

fbshipit-source-id: eae63b818203e0e86741f9f154ec9cf3498369e2
2018-03-09 18:33:52 -08:00
Eli White 5035af80ec Tightening types for View and VirtualizedList
Reviewed By: yungsters

Differential Revision: D7215391

fbshipit-source-id: fa144c0dc3fd897864403b589e943ea88e78a999
2018-03-09 15:11:46 -08:00
Eli White b6b80f6a70 Type VirtualizedList's ref
Reviewed By: yungsters

Differential Revision: D7215114

fbshipit-source-id: 867a7b897f27d415269c11572708afeb570b4be0
2018-03-09 12:42:06 -08:00
Eli White 25b8ec81df Adding FlowFixMe when switching between Component and Ref
Reviewed By: yungsters

Differential Revision: D7215800

fbshipit-source-id: 175f769a2b1fc67e72b10e113a96eb4167437ab0
2018-03-09 12:12:21 -08:00
Eli White f1316cab6c Making values optional in ViewPropTypes
Reviewed By: yungsters

Differential Revision: D7209560

fbshipit-source-id: fd0c55c4f69648927380d12ad9a6b9bcb98047eb
2018-03-09 10:26:07 -08:00
Eli White 2520c645f8 Fixing Assorted View Flow Types
Reviewed By: yungsters

Differential Revision: D7209495

fbshipit-source-id: e4b247e947b3463ea1200298e6078c7485d636e7
2018-03-09 10:26:04 -08:00
Alex Dvornikov 20fcf4779c Make fetchSegment native hook name consistent with __ prefix
Reviewed By: jeanlauliac

Differential Revision: D7205472

fbshipit-source-id: 4cef66539167ed47cf0ac8d3665c20114ffff375
2018-03-09 08:55:51 -08:00
Alexey Lang 8803ab2f11 Fix race condition when there're two flags next to each other
Reviewed By: yungsters

Differential Revision: D7194598

fbshipit-source-id: a76328d63f649403de15503596a179c7baaf7dc3
2018-03-09 04:27:56 -08:00
Tim Yung 3e141cb6c9 RN: Delete Systrace.swizzleJSON
Reviewed By: TheSavior

Differential Revision: D7207460

fbshipit-source-id: 14b1174d6a5c75e1acba7272376d1c462bc13cb6
2018-03-08 23:43:26 -08:00
Tim Yung a8c4b630fc RN: Delete Systrace for RelayClassic
Reviewed By: TheSavior

Differential Revision: D7207462

fbshipit-source-id: 6dd5c5fd22c0a5a7d77331d6adf7b362c3d3e037
2018-03-08 23:43:26 -08:00
Tim Yung 118521c20b RN: Prettify Systrace
Reviewed By: TheSavior

Differential Revision: D7207468

fbshipit-source-id: 05ae6e003ae3e55bc2d3a905f41c28f7041dd7f0
2018-03-08 23:43:26 -08:00
Eli White 214da52fe7 AccessibilityLabel is optional
Summary:
We have a bunch of components internally that use accessibilityLabel in invalid ways.
View was originally typed as any so invalid usages weren't caught. In order to fix these we have to move forward with getting back to flow having no errors. We are weakening these types to get there and we can tighten them again later.

Reviewed By: yungsters

Differential Revision: D7203260

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

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

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

Reviewed By: yungsters

Differential Revision: D7203649

fbshipit-source-id: a8095aa46807ce03272e2962289e8f5705b422b9
2018-03-08 15:56:09 -08:00
Eli White 49396aa78d Fix typing of View refs
Reviewed By: olegbl

Differential Revision: D7192405

fbshipit-source-id: 9d9bce8202a5e8f44d92ef6d0afbf8f55e9ea95a
2018-03-08 14:35:54 -08:00
Héctor Ramos f2ad77f90a Update additional license headers
Reviewed By: sophiebits

Differential Revision: D7196607

fbshipit-source-id: 9e6452f583b2b5616f5bb38f26f2ae33c14bb820
2018-03-08 12:10:14 -08:00
Eli White 4895c645ea Rename Style to DangerouslyImpreciseStyle
Reviewed By: yungsters

Differential Revision: D7190268

fbshipit-source-id: d652a95be7550d65cfbfc59f41d7bda92915bacf
2018-03-08 01:08:42 -08:00
Eli White 5b32358c9e Prettier
Reviewed By: yungsters

Differential Revision: D7188912

fbshipit-source-id: 3466c542dc0fb1832b4545b1a307183efcd72b1d
2018-03-08 01:08:42 -08:00
Eli White 852084ad45 Remove usage of Styles type
Summary: This type was often used when (View|Text|Image)StyleProp should have been used instead. Since there were no valid usages of it in our codebase, we are not making it public anymore.

Reviewed By: yungsters

Differential Revision: D7188658

fbshipit-source-id: 7112cc4a7da7b007b5c758a0890d2e0b8fe1797a
2018-03-08 01:08:41 -08:00
Eli White d89517d60a Remove usage of Internal StyleSheet type
Summary: This type shouldn't be necessary from outside code. All callsites were able to be fixed by using the other types like TextStyleProp

Reviewed By: yungsters

Differential Revision: D7187551

fbshipit-source-id: 34fb7fb5f5e72e6cfcb9748157cb5eb6ad3e1f46
2018-03-08 01:08:41 -08:00
Andrew Chen (Eng) 8cdc7d3e02 Don't assume the SourceCode native module exists
Reviewed By: yungsters

Differential Revision: D7185837

fbshipit-source-id: e8efc22ac0af092dbc1fdf616b0b3f111390dd5d
2018-03-07 18:57:42 -08:00
Andrew Chen (Eng) a162dc8cc6 Fix RefreshControl's dependency on AndroidSwipeRefreshLayout
Reviewed By: mdvacca

Differential Revision: D7185836

fbshipit-source-id: 726e6e6792f1f3971c2f7de9bb83ff888815220d
2018-03-07 18:57:42 -08:00
Eli White cf89a2cbfd Move __StyleProp to StyleSheet
Reviewed By: yungsters

Differential Revision: D7185815

fbshipit-source-id: 897ae37af3f03aa1408f020bcc7e61004d4dbc0d
2018-03-07 16:32:55 -08:00
Eli White a3c07c95ef StyleObj -> DangerouslyImpreciseStyleProp
Summary:
Migrating everything to import from StyleSheet instead of StyleSheetTypes.

Search and replaced
```
import type {StyleObj} from 'StyleSheetTypes';
```
to
```
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
```

and then replacing `StyleObj` with `DangerouslyImpreciseStyleProp` and fixing up the remaining flow errors by hand.

Reviewed By: yungsters

Differential Revision: D7184077

fbshipit-source-id: b8dabb9d48038b5a997ab715687300bad57aa9d4
2018-03-07 13:24:20 -08:00
Eli White 49ffc9fada Rename StyleProp to DangerouslyImpreciseStyleProp
Summary:
We want to rename these types to be more clear what they are actually for. I did this with a find and replace:

```
import type {StyleProp} from 'StyleSheet';
```

to

```
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
```

and `StyleProp` to `DangerouslyImpreciseStyleProp`.

Reviewed By: yungsters

Differential Revision: D7178609

fbshipit-source-id: 32952e0c3a8b6aceef306f1f3c18844feb18f1aa
2018-03-07 12:16:53 -08:00
Eli White ee26d9bcb0 Make StyleSheet.create type private
Summary:
This type is being used in many places where a much simpler type is often better. In a real pinch this type can still be accessed as so:

```
function returnsStyleSheet(
): $Call<typeof StyleSheet.create, *> {
  return StyleSheet.create({
    root: {
      background: 'white',
    }
  })
}

returnsStyleSheet().foo // foo doesn't exist
returnsStyleSheet().root // okay
```

Reviewed By: yungsters

Differential Revision: D7178524

fbshipit-source-id: 3c0ed03486ca00f1e287261e402fd47807f1fc3d
2018-03-07 12:16:53 -08:00
Eli White b58e377961 Remove Unused Exports from StyleSheetTypes
Summary: These types were barely used and unnecessary.

Reviewed By: yungsters

Differential Revision: D7177287

fbshipit-source-id: 63cb6d3aae4889a92b2c23f0df864b5657e6e1ee
2018-03-06 23:30:48 -08:00
Eli White 135637ce24 Merging tests for flattenStyle
Reviewed By: yungsters

Differential Revision: D7176652

fbshipit-source-id: 25b6f2e4f8397ba6f07b2913775b91af90b45750
2018-03-06 23:30:48 -08:00
Eli White 321ba067a8 Type TextStyleProp
Reviewed By: yungsters

Differential Revision: D7176472

fbshipit-source-id: 35f499bdac6c089d5f45884f6f11ea539c8b7085
2018-03-06 23:30:47 -08:00
Eli White c129457d3a Typing ViewProp, ImageProp
Summary:
Tightening these types.

We can't type TextProp the same way yet because of something fishy in Flow:

https://flow.org/try/#0KYDwDg9gTgLgBDAnmYcAqoYGUkBtUC8cA3gD4BQccAZhAHYwBiAhgLYCWuiAXHAM4wo7OgHMANJRr1s7AF7BedAK6sARsCgTSAXwDc5cqEiwEyVIwAiWRtJyJ8cImUm0GLDl14ChorXoNG0PBIKOiYdvgAClAQYI5wACQASsDMACYA8nRcADwJWAAWzCg5GCDYeMAAfFW6cAD09XAprBAAbqjJqZnZiHDMdGkIBagaMVBwIhDAfP0A7syIBgDG9AJwllgRChtWNgzb8cQu0u6cPHAA5LQQlxL+5Kt062UV9sAAasxQvK-b0bF4pttrogA

Reviewed By: olegbl

Differential Revision: D7165134

fbshipit-source-id: 2fd3de2af8bdc53231d59de71def1e6a7221aff7
2018-03-06 18:47:12 -08:00
Kevin Gozali d7b5b2e9e4 Allow Inspector to handle 2 renderers
Summary: To avoid crashing when there are 2 different renderers, let the Inspector be a bit lenient.

Reviewed By: yungsters

Differential Revision: D7175338

fbshipit-source-id: ee5f86252f090361e42b6e2a93ae56c4c83c8c53
2018-03-06 18:09:52 -08:00
Krzysztof Ciombor b7bb2e5745 Add support for Android TV devices
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!

-->

* To be on par with Apple TV support, this makes it possible to run React Native apps on Android TV devices (See also: https://react-native.canny.io/feature-requests/p/android-tv-support)
* These changes also make it possible to navigate through the app using D-PAD buttons that are present on some mobile devices
* Since these changes affect, among others, `ReactRootView.java` and `Touchable.js` code and are closely related to Apple TV implementation, it makes sense for them to be included in the core

 - React native apps can be launched on Android TV devices and properly render their content
 - Navigation is possible using left, right, top, bottom arrows from the remote (or D-PAD)
 - Touchable components can handle D-PAD center button press events and correctly fire their `onPress` handlers
 - Touchable components will receive `onPressIn` and `onPressOut` events and can react to focus/blur changes appropriately (just like on Apple TV)
 - `Platform` constants allow to check if the react-native app is running on TV (`Platform.isTV`)
 - `ScrollView`s behave correctly (same as native implementation) when switching to view outside bounds – that is, the container would scroll such that the newly focused element is fully visible
 - Native "clicking" sounds are played when moving between focusable elements
 - Play/Pause click event is send to `TVEventHandler`
 - Rewind and FastForward events are send to `TVEventHandler`
 - Back button behaves as a normal Android back button
 - Diagonal buttons work correctly on Android TV, e.g. if there is no button directly to the right from the focused one, but there is one to the right but a bit higher/lower it will grab focus
 - Dev menu can be accessed by long pressing fast forward button

A demo showing RNTester app running on Android TV device (Amazon Fire TV Stick) can be found here:
[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20)

- `TextInput` will not work on Android TV devices. There's an issue with native `ReactEditText` implementation that prevents it from receiving focus. This makes it impossible to navigate to `TextInput`.
This will be fixed next, but will be included in a separate Pull Request
- ~Overlay permissions cannot be granted on Android TV devices running Android version >= 6.0
This is because the overlay permission can only be granted by firing an Intent to open settings page (`ACTION_MANAGE_OVERLAY_PERMISSION`). Since this page does not exist on TV devices the permission cannot be requested. This will make the app crash when trying to open dev menu (⌘+M) or displaying a redbox error.
Note: This does not affect devices running Android version < 6.0 (for example Amazon Fire TV Stick)~
This is now fixed by: https://github.com/facebook/react-native/pull/16596

* Launch the RNTester app on Android TV device.
  * Ensure it launches without a crash
  * Ensure basic navigation is possible
  * Ensure Touchable components can receive select events
* Ensure the changes do not break current Android and iOS mobile devices functionality.
* Ensure the changes do not break current Apple TV functionality.

[RNAndroidTVDemo video](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)

* Added `ReactAndroidTVViewManager` that handles TV `KeyEvent`s and dispatches events to JS - This is the core that enables basic navigation functionality on Android TV devices
* Following the above change we copy `TVEventHandler.ios.js` into `TVEventHandler.android.js` to enable JS to pick up those native navigation events and dispatch them further to subscribed views. (Note: We do not have a native `TVNavigationEventEmitter` implementation on Android, thus this file is slightly modified, e.g. it does pass `null` to `NativeEventEmitter` constructor)
* Added `uiMode` to `AndroidInfoModule`. (**Note**: This required changing `extends BaseJavaModule` to `extends ReactContextBaseJavaModule` to be able to use `getSystemService` which requires `Context` instance!
* Added `isTV` constants to both `Platform.ios.js` (keeping the deprecated `isTVOS` as well) and `Platform.android.js`
* Changed condition check on `Touchable.js` to use the newly added `isTV` flag to properly handle TV navigation events on Android as well
* Added `LEANBACK_LAUNCHER` to `RNTester` `intent-filter` so that it is possible to launch it on Android TV devices.
* See also a PR to `react-native-website` repo with updated docs for Android TV: https://github.com/facebook/react-native-website/pull/59

 - [ ] Fix `TextInput` components handling by allowing them to be focused and making a proper navigation between them (and/or other components) possible. One thing to note here that the default behavior to immediately open software keyboard when focused on `TextInput` field will need to be adjusted on Android TV as well)
 - [x] Fix overlay permissions issue by changing the way redbox/dev menu are displayed (see: https://github.com/facebook/react-native/pull/16596)
 - [ ] Adjust placement of TV-related files (e.g. the `TVEventHandler.js` file is placed inside `AppleTV` directory which is not accurate, since it does handle Android TV events as well)

Previous discussion: https://github.com/SoftwareMansion/react-native/pull/1
<!--
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
-->

[ANDROID] [FEATURE] [TV] - Added support for Android TV devices
Closes https://github.com/facebook/react-native/pull/16500

Differential Revision: D6536847

Pulled By: hramos

fbshipit-source-id: 17bbb11e8583b97f195ced5fd9762f8902fb8a3d
2018-03-06 10:47:02 -08:00
Peter van der Zee 6eef7de46e Adding tests to cover regressions when upgrading to babel 7
Reviewed By: mjesun

Differential Revision: D7123659

fbshipit-source-id: f344786dfe5e4c6c0d81992504ba93688edeb5db
2018-03-06 02:16:12 -08:00
Spencer Ahrens 52c7957349 Fix lint in StyleSheet.compose
Reviewed By: TheSavior, yungsters

Differential Revision: D7106910

fbshipit-source-id: e150c6622bb1af9830eef06757897d42002f5676
2018-03-05 18:57:30 -08:00
Eli White b6c7e551a9 Using ReadOnly and Exact types for StyleSheet
Summary: There are a few more things that need to be tightened up but they cause *tons* of errors in FBSource and require more investigation before we can change them.

Reviewed By: sahrens

Differential Revision: D7160522

fbshipit-source-id: 17167efd80fd6c3bac5a055d2ab58b3b251c1b8b
2018-03-05 18:57:30 -08:00
Eli White b98bf1e097 Remove polymorphic types from StyleSheetTypes
Summary:
These types were polymorphic so that stricter types could be passed in for dimension or color. For example, color could be a union of allowed colors. However, since `rgb(0,0,0)` is a valid color, these would have to be allowed opaque types and every creator or caller of these colors would have to use a function.

This would require a massive change to every RN product in the world for negligable gain because StyleSheet values are validated at dev at runtime and cause redboxes for invalid uses.

Since we don't plan to adopt these widely, lets clean up the complexity of these types.

Reviewed By: sahrens

Differential Revision: D7158920

fbshipit-source-id: c58ae402c8248b0863c217c27153191a49c6b980
2018-03-05 18:57:30 -08:00
Maksym Komarychev 9366ce416f Update opacity when `disabled` prop is changed
Summary:
fixes #17105

If you render

```
    <TouchableOpacity
        disabled={true}
        style={{opacity: 0.5}}
    >
        ...
    </TouchableOpacity>
```

and then

```
    <TouchableOpacity
        disabled={false}
        style={{opacity: 1}}
    >
        ...
    </TouchableOpacity>
```

The content of `TouchableOpacity` will still have opacity = 0.5 because real
opacity is controlled by animated property which should be properly updated
when `disabled` prop changes.

<!--
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!

-->

Usually when a button or other UI component is built with `TouchableOpacity` you may want to change it's opacity if state of component is changed (enabled/disabled). Opacity provided in props is overridden with internally-managed animated value. Add extra check when component is updated to trigger opacity animation upon change of `disabled` flag.

You can use code from https://github.com/facebook/react-native/issues/17105.

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

[GENERAL][BUGFIX][TouchableOpacity] - trigger animation on `opacity` upon change in `disabled` prop.
<!--
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/17106

Differential Revision: D7158549

Pulled By: hramos

fbshipit-source-id: 209cc433b829b129810e8a884964c8853ca3fe8f
2018-03-05 16:12:00 -08:00
Sophie Alpert 19b9851999 Update VirtualizedList to not throw with double constructor
Summary: constructor shouldn't have side effects.

Reviewed By: sahrens

Differential Revision: D7146018

fbshipit-source-id: 0ca311e48d6bad81988ed48605c8134068c482da
2018-03-05 14:17:07 -08:00
David Vacca 87690570c8 Remove log in JSDevSupportModule
Reviewed By: fkgozali

Differential Revision: D7138115

fbshipit-source-id: f9cdda250b60a305195e01a11d0907f658d0a9d1
2018-03-05 10:55:50 -08:00
Eli White 70a3ececc3 Tightening type for flattenStyle
Reviewed By: yungsters

Differential Revision: D7131703

fbshipit-source-id: d8e37fcd0c743057e04760b1e50f8d879bd2826a
2018-03-03 15:38:26 -08:00
Eli White 3152e93095 Converting Libraries/Components to not use var
Reviewed By: sahrens

Differential Revision: D7117137

fbshipit-source-id: a55a04928a0073a17e0709e851aa8b11678042ba
2018-03-03 15:38:18 -08:00
Alex McKelvey f7343576fc Truncate filter label if it's too long to fit
Differential Revision: D7144192

fbshipit-source-id: 4001930b194421682fa9bdc9b097434910f339b6
2018-03-02 22:06:23 -08:00
Eli White 7216079a79 Avoid var specific hoisting rules
Reviewed By: sahrens

Differential Revision: D7116184

fbshipit-source-id: 4fd1654028e52f5aafad348546b889f1737c7399
2018-03-01 16:57:25 -08:00
David Vacca 9b3861c109 Fix unmount of ReactRootView for Fabric surfaces
Reviewed By: fkgozali

Differential Revision: D7114865

fbshipit-source-id: f0a1c47c983e610fe0dba3051ed8aa350ac052cc
2018-03-01 10:33:21 -08:00
Héctor Ramos b181b7797f Check PATENTS does not creep into files
Summary:
Some files have crept into the repo with the old license header. These are usually from PRs that were opened prior to the re-licensing of the project.

Let the script run, prior to fixing the errant files. The script outputs the following:

```
PATENTS crept into some new files?
 --- /dev/fd/63	2018-03-01 01:42:48.250153746 +0000
+++ /dev/fd/62	2018-03-01 01:42:48.250153746 +0000
@@ -1 +1,9 @@
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h
+Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m
+ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java
+ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java
+ReactCommon/yoga/yoga/YGLayout.cpp
+ReactCommon/yoga/yoga/YGLayout.h
+ReactCommon/yoga/yoga/YGStyle.cpp
+ReactCommon/yoga/yoga/YGStyle.h
 scripts/circleci/check_license.sh
Exited with code 1
```

Fix the headers in these files and run the script again. No output, exit code 0.
Closes https://github.com/facebook/react-native/pull/18143

Reviewed By: sophiebits

Differential Revision: D7119356

Pulled By: hramos

fbshipit-source-id: d238e4d4a3ae320a2c8e625c2fa29690057a4814
2018-03-01 08:22:05 -08:00
Héctor Ramos 160578624a React sync for revisions a634e53...ab4280b
Reviewed By: bvaughn

Differential Revision: D7077686

fbshipit-source-id: de39027bef1f9d48802202555a5c765999d7bfe7
2018-02-28 19:44:58 -08:00
Peter Argany 6d9fe455dc Fixed TVOS test failure caused by input accessory view change
Reviewed By: mmmulani

Differential Revision: D7103353

fbshipit-source-id: 7a1575eff0296017521fc8ca6fe384301849a73e
2018-02-27 17:56:48 -08:00