Commit Graph

3896 Commits

Author SHA1 Message Date
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
Alex Hinson 2dd2529b3a Add option to hide context menu for TextInput #17335
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 is currently no way to disable to context menu that automatically appears over a TextInput. This is especially troublesome if you would like to disable the user from pasting text into certain fields. This PR adds a `contextMenuHidden` property to TextInput that will hide it.

I'm not sure if testing is necessary here. I would be happy to investigate further on how this would be tested, if deemed necessary!

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

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

[FEATURE][TextInput] - Added `contextMenuHidden` property
Closes https://github.com/facebook/react-native/pull/18125

Differential Revision: D7101888

Pulled By: hramos

fbshipit-source-id: fe36603a3fbdcefbd644251a7ea894ac7e23e5b8
2018-02-27 17:32:24 -08:00
Adam Burdette dbafc29e60 Fix #8615: NetInfo.isConnected for iOS
Summary:
This is fixing #8615. The problem was that, on initialization, the `_connectionType` variable was still set to its default value of `RCTConnectionTypeUnknown`. The exposed API method did nothing to determine this unless a subscription had be established and then the method would simply return the last reported value. Instead, the exposed oneshot API call now actually checks the connection status through the same methods as the subscription and updates RCTNetInfo’s values before returning.

In order to avoid reporting events without a subscription, a flag is set and unset on calls to start/stopObserving.

- start app
- observe the (in)correct reporting of the manual status
- change network status to offline
- press refresh
- observe the manual fetch
- start subscription
- change network status to online
- press refresh to show that the manual refresh works (only now working for current RN version)
- change network status to offline
- stop subscription
- change network status to online
- press refresh to show manual refresh does(n't) work without subscription
- start subscription to show it updates to current

Current Behavior: https://drive.google.com/file/d/1Ods6HORgp_vfm1mQVjGwhtH1D7issxjo/view?usp=sharing
Fixed Behavior: https://drive.google.com/file/d/11H1UOF33LeMGvXEOoapU62ARDSb7qoYv/view?usp=sharing

[IOS] [BUGFIX] [Libraries\Network\RCTNetInfo.m] - Fixed #8615, `iOS: NetInfo.isConnected returns always false`, by decoupling the fetch from the status of the subscription.
Closes https://github.com/facebook/react-native/pull/17397

Differential Revision: D7102771

Pulled By: hramos

fbshipit-source-id: ea11eb0b1a7ca641fc43da2fe172cf7b2597de4a
2018-02-27 14:16:20 -08:00
Julien K 6c353fd7e9 onPress animation with magnification
Summary:
Related to: #15454

Motivation: Improve tvOS feeling for TouchableHighlight

![changewithaniamtion](https://user-images.githubusercontent.com/7658664/29193477-b99b4a10-7e25-11e7-8b31-e0e4ca9d7720.gif)

- When you select the button he is focus and the underlay is show
- When you press the button, there is an animation, but after the animation, the focus is on the button and the underlay is show

Play with tvParallaxProperties on tvOS, test with and without patch just to see the actual behaviour
```
			<TouchableHighlight
						tvParallaxProperties={{
							enabled: true,
							shiftDistanceX: 0,
							shiftDistanceY: 0,
							tiltAngle: 0,
							magnification: 1.1,
                                                        pressMagnification: 1.0,
							pressDuration: 0.3,
						}}
						underlayColor="black"
						onShowUnderlay={() => (console.log("onShowUnderlay")}
						onHideUnderlay={() =>  (console.log("onHideUnderlay")}
						onPress={() =>  (console.log("onPress")}
					>
						<Image
							style={styles.image}
							source={ uri: 'https://www.facebook.com/images/fb_icon_325x325.png' }
						/>
					</TouchableHighlight>
```
Closes https://github.com/facebook/react-native/pull/15455

Differential Revision: D6887437

Pulled By: hramos

fbshipit-source-id: e18b695068bc99643ba4006fb3f39215b38a74c1
2018-02-27 13:10:02 -08:00
Peter Argany 38197c8230 Support Input Accessory View (iOS Only) [1/N]
Reviewed By: mmmulani

Differential Revision: D6886573

fbshipit-source-id: 71e1f812b1cc1698e4380211a6cedd59011b5495
2018-02-27 11:09:30 -08:00
Jean Lauliac a759a44358 npmignore: ignore tests and fixtures
Summary:
This try to address #17672 and https://github.com/facebook/metro/issues/139. We should probably not include these folders in the released version of React Native, as they are used only for testing—am I incorrect?

cc MoOx, t4deu.

I ran:

```
npm pack
tar -t -f react-native-1000.0.0.tgz | less
```

Then verified that `__fixture__` was not part of the package.

https://github.com/facebook/react-native/pull/17672

[GENERAL] [BUGFIX] [.npmignore] - Do not publish test-specific files
Closes https://github.com/facebook/react-native/pull/18019

Differential Revision: D7098211

Pulled By: jeanlauliac

fbshipit-source-id: 0748ad8c064450bd2a9f4d6f49675a7f74fb300f
2018-02-27 08:42:14 -08:00
Sebastian Markbage 07334cb47b Clean up unused modules
Reviewed By: fkgozali

Differential Revision: D7092777

fbshipit-source-id: 619a78911f2857f1183597143aec86957f277f9e
2018-02-26 20:03:27 -08:00
Spencer Ahrens 3756d41de1 Add testOnly_pressed to TouchableHighlight
Reviewed By: yungsters

Differential Revision: D7043098

fbshipit-source-id: 1df06df6820d81b37dc9a167a7931ed20df44f0f
2018-02-26 13:48:19 -08:00
Tim Yung 80c18395e2 RN: Flow Type for `PressEvent`
Reviewed By: sahrens

Differential Revision: D7082716

fbshipit-source-id: 13e1730b0b2380ae6be63e2b36bb40b9a44a99f4
2018-02-25 23:27:00 -08:00
Tim Yung a817c64043 RN: Use `$ReadOnly` in CoreEventTypes
Reviewed By: sahrens

Differential Revision: D7082715

fbshipit-source-id: d2f7e280d02bbd8e7dcba2d38b719fa4f82ecb8b
2018-02-25 23:27:00 -08:00
Valentin Shergin a534672e13 Fixed problem in Text measurent on iOS
Summary: See the comment it code.

Reviewed By: mmmulani

Differential Revision: D7074168

fbshipit-source-id: e6eda9a47552142ccb0ba8e7bd9a103b0cb4f9f9
2018-02-25 09:37:38 -08:00
Eric Rozell 8a073c1d8b Fix `onLayout` prop for TextInput on Android
Summary:
When the `autogrow` prop was removed from `TextInput` on Android, the `_onLayout` helper method was removed. This helper method implemented the hook required to make `autogrow` work, then dispatched the `onLayout` event to the handler in `this.props`. This change points passes the `onLayout` handler from `this.props` directly to the inner component.

<!--
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 was updating copied code in react-native-windows and noticed this bug.

Run jest tests.

N/A

<!--
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][MINOR][BUGFIX] [TextInput] - Fix `onLayout` prop for TextInput on Android
Closes https://github.com/facebook/react-native/pull/18040

Differential Revision: D7078736

Pulled By: hramos

fbshipit-source-id: 798530729d7f0ee1ebb59f698af4d4b6ff43928b
2018-02-24 01:02:42 -08:00
Kevin Gozali 486ac9dc82 update FabricUIManager to call the right JS object
Reviewed By: sebmarkbage

Differential Revision: D7037275

fbshipit-source-id: 6a1d13227910d0cdb99dde4b6c98ed7a20ef9911
2018-02-23 17:04:40 -08:00
Eric Rozell b9be28915c Remove Platform check from WebSocket module
Summary:
WebSocket uses the Platform module to check how many arguments for the `close` method should be used. In react-native-windows, we have the same number of arguments for `close` as Android, so we're prevented from using this module as-is because of the platform check (see https://github.com/Microsoft/react-native-windows/blob/master/Libraries/WebSocket/WebSocket.windows.js#L136).

By switching to an argument count check, this module becomes more useful cross-platform. If you'd like to keep the platform check, I'm also open to inverting the conditional, e.g., `if (Platform.OS !== 'ios')`.

<!--
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'd like to minimize the amount of code I need to copy over to react-native-windows for platform-specific overrides.

Run jest tests.

N/A

<!--
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][MINOR][ENHANCEMENT][Libraries/WebSocket/WebSocket.js] - Better enable cross-platform support of WebSocket.js
Closes https://github.com/facebook/react-native/pull/18056

Differential Revision: D7070380

Pulled By: TheSavior

fbshipit-source-id: 9bfd47654d0bf6f0e07fc799853a206721467525
2018-02-23 11:17:27 -08:00
Reem Helou 446ce49e9b Fix Bug with Date Picker IOS
Reviewed By: sahrens

Differential Revision: D7052609

fbshipit-source-id: 740fffa9ad55ccd21347626f9c5dc180fcc4094d
2018-02-23 10:53:22 -08:00
Islam Magdy b57a78c3de Fix for #17348, Scrollable failing due to uglify-es
Summary:
Fixes https://github.com/facebook/react-native/issues/17348 - Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'this._subscribableSubscriptions.forEach')

Same existing tests applies, just added extra checks.

This patch fixes the issue https://github.com/facebook/react-native/issues/17348

 [ANDROID] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
 [IOS] [BUGFIX] [Subscribable] - Fix for https://github.com/facebook/react-native/issues/17348
Closes https://github.com/facebook/react-native/pull/17463

Reviewed By: sahrens

Differential Revision: D7062101

Pulled By: TheSavior

fbshipit-source-id: 1306f4695ffc8748f674de70740ded09e1e390f7
2018-02-22 18:03:03 -08:00
Mats Byrkeland edb6ca72fd Fix ESLint warnings using 'yarn lint --fix'
Summary:
Hi! I would like to contribute to React Native, and I am just starting out. I forked the repo and found that it has quite a lot of ESLint warnings – many of which were automatically fixable. This PR is simply the result of running `yarn lint --fix` from the root folder.

Most changes are removing trailing spaces from comments.

Haven't really done any manual testing, since I haven't done any code changes manually. `yarn test` runs fine, `yarn flow` runs fine, `yarn prettier` is satisfied.

N/A

[INTERNAL][MINOR][] - Fix ESLint warnings
Closes https://github.com/facebook/react-native/pull/18047

Differential Revision: D7054948

Pulled By: hramos

fbshipit-source-id: d53e692698d1687de5821c3fb5cdb76a5e03b71e
2018-02-22 07:23:17 -08:00
Alex Kotliarskyi 7dd12a26b9 Mock static methods of TouchableNativeFeedback on iOS
Reviewed By: TheSavior

Differential Revision: D7016679

fbshipit-source-id: bd04244eaf876e3ffab4f0c64792769a9ea40abd
2018-02-21 11:21:34 -08:00
Eric Rozell 47addd8e34 Remove unused reference in Text.js
Summary:
Previously, the Platform module was used to detect when RCTVirtualText should be used. Recently, this has changed to detecting the availability of a native virtual text component on the UIManager. The import for the Platform module can be deleted.

I was cleaning up source code copied in react-native-windows and noticed this reference is no longer used in Text.js.

Run jest tests.

N/A

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

Differential Revision: D7042473

Pulled By: hramos

fbshipit-source-id: d318cfdfd2d052bd1662ac469dd51633f6d59d17
2018-02-21 09:17:30 -08:00
Tim Yung 8c036ce090 RN: Remove Animated -> ScrollView -> Animated Cycle
Reviewed By: sahrens

Differential Revision: D7027223

fbshipit-source-id: 59924fada0f29a5e2ce1ae9a3694a94cfb26367c
2018-02-20 20:35:08 -08:00
Brian Vaughn 9dd7608c97 Replaced unstable_AsyncComponent with unstable_AsyncMode
Reviewed By: gaearon

Differential Revision: D7025510

fbshipit-source-id: 1aff984ce7479e5fdff71259d0f552193a6cdcea
2018-02-20 17:46:53 -08:00
Tim Yung 973ef9728c RN: Remove React Stack Systrace Logic
Reviewed By: sophiebits

Differential Revision: D7027263

fbshipit-source-id: f4eb3fab402eda337f464e4ebb0771202a9b93f2
2018-02-19 22:32:36 -08:00
Caleb Meredith da3424c929 @allow-large-files Upgrade xplat/js to Flow v0.66
Reviewed By: gabelevi

Differential Revision: D7016717

fbshipit-source-id: 2bd2fd67074ba5d405ecd63a1aeb37354f8634c9
2018-02-16 20:24:57 -08:00
Sophie Alpert 26684cf3ad Update to MIT license
Summary: Manual changes.

Reviewed By: TheSavior, yungsters

Differential Revision: D7012152

fbshipit-source-id: de7459be3db13c687868b45059856f125c4f2eb1
2018-02-16 18:31:53 -08:00
Sophie Alpert 1490ab12ef Update license headers for MIT license
Summary:
Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs.

find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$
replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree.

Reviewed By: TheSavior, yungsters

Differential Revision: D7007050

fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
2018-02-16 18:31:53 -08:00
Mehdi Mulani f96dfb9468 Disable font scaling when an explicit font handler is set
Reviewed By: sahrens

Differential Revision: D7003464

fbshipit-source-id: f36ff344c50a9c63af6c852138041c1c918259c8
2018-02-16 12:37:51 -08:00
Mehdi Mulani cff522d283 Dirty text shadow nodes on UIManager queue after multiplier changes
Summary: Letting them fire on whatever queue we get the notification from throws an assert.

Reviewed By: shergin

Differential Revision: D7002789

fbshipit-source-id: 669474af1a07f0df6784b69b54afe0152c1ba3c4
2018-02-16 12:37:42 -08:00
Krzysztof Magiera b48f7e5605 Support for animated tracking in native driver
Summary:
This PR adds support for Animated tracking to Animated Native Driver implementation on Android and iOS.

Animated tracking allows for animation to be started with a "dynamic" end value. Instead of passing a fixed number as end value we can pass a reference to another Animated.Value. Then when that value changes, the animation will be reconfigured to drive the animation to the new destination point. What is important is that animation will keep its state in the process of updating "toValue". That is if it is a spring animation and the end value changes while the previous animation still hasn't settled the new animation will start from the current position and will inherit current velocity. This makes end value transitions very smooth.

Animated tracking is available in JS implementation of Animated library but not in the native implementation. Therefore until now, it wasn't possible to utilize native driver when using animated tracking. Offloading animation from JS thread turns out to be crucial for gesture driven animations. This PR is a step forward towards feature parity between JS and native implementations of Animated.

Here is a link to example video that shows how tracking can be used to implement chat heads effect: https://twitter.com/kzzzf/status/958362032650244101

In addition this PR fixes an issue with frames animation driver on Android that because of rounding issues was taking one extra frame to start. Because of that change I had to update a number of Android unit tests that were relying on that behavior and running that one additional animation step prior to performing checks.

As a part of this PR I'm adding three unit tests for each of the platforms that verifies most important aspects of this implementation. Please refer to the code and look at the test cases top level comments to learn what they do.

I'm also adding a section to "Native Animated Example" screen in RNTester app that provides a test case for tracking. In the example we have blue square that fallows the red line drawn on screen. Line uses Animated.Value for it's position while square is connected via tracking spring animation to that value. So it is ought to follow the line. When user taps in the area surrounding the button new position for the red line is selected at random and the value updates. Then we can watch blue screen animate to that position.

You can also refer to this video that I use to demonstrate how tracking can be linked with native gesture events using react-native-gesture-handler lib: https://twitter.com/kzzzf/status/958362032650244101

[GENERAL][FEATURE][Native Animated] - Added support for animated tracking to native driver. Now you can use `useNativeDriver` flag with animations that track other Animated.Values
Closes https://github.com/facebook/react-native/pull/17896

Differential Revision: D6974170

Pulled By: hramos

fbshipit-source-id: 50e918b36ee10f80c1deb866c955661d4cc2619b
2018-02-16 12:10:01 -08:00
Valentin Shergin 0dbe18375e `base-line` metric exposure for <TextInput>
Summary:
Now <TextInput> (both bersions) exposes base-line metric to Yoga.
Before:
https://cl.ly/0G1Q29450O0y
After:
https://cl.ly/2X103V3O0322

Reviewed By: yungsters

Differential Revision: D6957054

fbshipit-source-id: d76d96f56720d710a4230c53beafdb0b2521e8a9
2018-02-15 17:46:41 -08:00
Valentin Shergin 51b3529f6c `base-line` metric exposure for <Text>
Summary:
Now <Text> exposes base-line metric to Yoga.

Before:
https://cl.ly/1F0B0D430U3e

After:
https://cl.ly/0G1Q29450O0y

Reviewed By: yungsters

Differential Revision: D6957055

fbshipit-source-id: 04c1df693915e294b54e3c33e0aea21611dcc232
2018-02-15 17:46:41 -08:00
Andres Suarez 59401f89c1 Fold .eslintrc's into the root eslintrc
Reviewed By: TheSavior

Differential Revision: D6997050

fbshipit-source-id: 81e45d24343cca8336adb0de43bd766899ff03b6
2018-02-15 07:53:52 -08:00
Alex Dvornikov f7f5dc6649 Extract polyfillGlobal from InitializeCore
Reviewed By: jeanlauliac

Differential Revision: D6987657

fbshipit-source-id: 8762732de671418520376a98bdd724bbb24e4e36
2018-02-15 04:23:43 -08:00
Janic Duplessis 10b642a7af Verify that the component passed to createAnimatedComponent is not functional
Summary:
Stateless functional components don't support refs and we need that for the component to work, it used to crash with this error message: `undefined is not an object (evaluating 'this._component.getScrollableNode')`. This makes it clear what the issue is.

Fixes some of the errors in #10635, not sure if it fixes all the cases described in the issue though.

**Test plan**
Tested that passing a component with createClass or extends Component works but passing a function causes an error.

[GENERAL] [ENHANCEMENT] [Animated] - Verify that the component passed to createAnimatedComponent is not functional
Closes https://github.com/facebook/react-native/pull/15019

Differential Revision: D6988096

Pulled By: sahrens

fbshipit-source-id: ec0ffa763245e786f44b4a1d56c0738876c25782
2018-02-14 08:02:48 -08:00
Valentin Shergin 7d20de412b Fixed a bug with positioning of nested views inside <Text>
Summary:
Fixing of recent regression in layout system.
Conseptually, a superview should define frames of child views.

Reviewed By: mmmulani

Differential Revision: D6980128

fbshipit-source-id: e267e966fd46af28db1d3d40939110040b74e33f
2018-02-13 23:51:54 -08:00
Spencer Ahrens 4761d5a83e add BULLET and BULLET_SP
Reviewed By: TheSavior

Differential Revision: D6983446

fbshipit-source-id: c8ce4b1c7836654910db84c9cd4b6d0bcec8ae27
2018-02-13 22:17:21 -08:00
Spencer Ahrens d220118dbd Freeze UTFSequence
Summary:
Don't want anyone accidentally mutating it.

Also make deepFreezeAndThrowOnMutationInDev easier to use with nice flow typing.

Reviewed By: yungsters

Differential Revision: D6974089

fbshipit-source-id: 0f90e7939cb726893fa353a4f2a6bbba701205bc
2018-02-13 14:36:37 -08:00
Peter van der Zee 6893a26bfb Fix duplicate var name declaration
Reviewed By: rafeca

Differential Revision: D6965150

fbshipit-source-id: 332c8202f350e2014fedb9790f3d895222fb4f8d
2018-02-13 01:49:56 -08:00
Spencer Ahrens 4d0ee37293 Add FDSStoryHeader
Reviewed By: TheSavior

Differential Revision: D6945233

fbshipit-source-id: 9630a72e4a7c88ca282392c374ca88326f282713
2018-02-12 18:50:21 -08:00
Spencer Ahrens 54870e0c6c Add UTFSequence module for common unicode usage
Summary:
A collection of Unicode sequences for various characters and emoji.

  - More explicit than using the sequences directly in code.
  - Source code should be limitted to ASCII.
  - Less chance of typos.

Reviewed By: TheSavior

Differential Revision: D6969065

fbshipit-source-id: c11ec96b74f5dfa7c624a3c53f3c29f6284a82b3
2018-02-12 18:50:21 -08:00
Brian Vaughn bedaaa1419 React sync for revisions 467b103...a634e53
Reviewed By: flarnie

Differential Revision: D6965585

fbshipit-source-id: 48c20d0010f4daf83272a36b3bdaca94493ab8fa
2018-02-12 14:02:30 -08:00
Valentin Shergin f91f7d91a1 Reimagining of RCTShadowView layout API
Summary:
This is reimagining of interoperability layer between Yoga and ShadowViews (at least in Yoga -> RN part).
Goals:
 * Make it clear and easy.
 * Make clear separation between "what layout what", now parent always layout children, noone layout itself.
 * Make possible to interleave Yoga layout with custom imperative layout (may be used in SafeAreaView, Text, Modal, InputAccessoryView and so on).

Reviewed By: mmmulani

Differential Revision: D6863654

fbshipit-source-id: 5a6a933874f121d46f744aab99a31ae42ddd4a1b
2018-02-12 00:32:43 -08:00
Andres Suarez 9d214967d2 Fix ESLint upgrade "parsing error"
Reviewed By: adamjernst

Differential Revision: D6959356

fbshipit-source-id: 77c61998f23a6acd7cdfe2c87d8760a23d957800
2018-02-10 10:51:14 -08:00
Héctor Ramos 5e80d95e03 React sync for revisions 4eed18d...467b103
Reviewed By: bvaughn

Differential Revision: D6953225

fbshipit-source-id: f96e3cec57cce397d46d49115dd3734a33427992
2018-02-09 16:05:29 -08:00
Nikolai Tillmann 01a58d182a Fixing Prepack model for latest global.nativeExtensions changes.
Differential Revision: D6943293

fbshipit-source-id: cb67b063b77e8f89712fb437fc5471b7f874c482
2018-02-09 14:00:10 -08:00
Brian Vaughn e7010348d8 Removed ReactNativeFeatureFlags
Reviewed By: flarnie

Differential Revision: D6938455

fbshipit-source-id: 1ad08ebf01dcae76f50b26fb993425233da1ae16
2018-02-09 10:58:55 -08:00
Kevin Gozali 854c2330eb fixed blobmanager inserting nil when there's no mime type
Summary:
Upon handling symbolication response when a redbox occurs, the blob manager inserted `nil` mime type because the response header doesn't specify any. This crashed the app with exception:

```
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[4]'
terminating with uncaught exception of type NSException
```

Reviewed By: shergin

Differential Revision: D6945632

fbshipit-source-id: 9298bd2674447106763c73e1a5035417bd30f29c
2018-02-08 19:31:25 -08:00
Kevin Gozali fa0ac92b2c call into native FabricUIManager from JS
Reviewed By: mdvacca

Differential Revision: D6945104

fbshipit-source-id: ac66c6105c0d18bef003cdd08d06dbb49c61e669
2018-02-08 19:31:25 -08:00
Brian Vaughn 6f007e8957 Ran rename-unsafe-lifecycles codemod on xplat/js
Reviewed By: trueadm

Differential Revision: D6889214

fbshipit-source-id: e815cda4b09f3650ae3b0b9a44ae6f5fcb48fe25
2018-02-08 10:58:31 -08:00
Dmitry Zakharov 47fe52380a Migrate SourceCode from Native Module to a Native Extension.
Reviewed By: danzimm

Differential Revision: D6848275

fbshipit-source-id: c50305018aa2bdf014f5f665f370f65866197c3b
2018-02-08 06:37:01 -08:00
Spencer Ahrens d37cdd97ae FIGCardHeader updates
Reviewed By: TheSavior

Differential Revision: D6914352

fbshipit-source-id: 7ee12999d19d665509e225d15cb263cbafafe258
2018-02-07 17:37:56 -08:00
Dmitry Zakharov 0c49c1f332 Native Modules -> Native Extensions
Reviewed By: danzimm

Differential Revision: D6887988

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

Reviewed By: mdvacca

Differential Revision: D6919080

fbshipit-source-id: 5807105a6c45dd99584eb92a5570c6076e2d56b9
2018-02-06 21:49:37 -08:00
Spencer Ahrens 8a882fe6d6 Fix adjustsFontSizeToFit to only shrink, not grow, text
Reviewed By: shergin

Differential Revision: D6913407

fbshipit-source-id: 3fdeeee1a28917f623fc9f804c1b28216cba5375
2018-02-06 21:19:09 -08:00
Oleg Lokhvitsky ef596dec49 Fix initialScrollIndex for Android
Reviewed By: sahrens

Differential Revision: D6885608

fbshipit-source-id: c153fcb5c2552982481d8af8b9755ae035e9b293
2018-02-02 16:02:12 -08:00
Valentin Shergin ebc98840e9 Improved documentation for <TextInput clearButtonMode=...>
Summary:
Documentation only. Actual behaviour was never changed.

Created from Diffusion's 'Open in Editor' feature.

Reviewed By: sahrens

Differential Revision: D6869466

fbshipit-source-id: 6e964433bb2b04b288736a3f01244285bc8c3fe8
2018-02-02 11:50:49 -08:00
Tim Yung d99ba70c49 RN: Add NativeImageSource Flow Type
Reviewed By: TheSavior

Differential Revision: D6869985

fbshipit-source-id: 836134ae0919d49b161d1a75d5743e977e6eb3f4
2018-02-01 23:45:09 -08:00
Valentin Shergin 6c4ef287ad Improved documentation for <TextInput caretHidden=...>
Summary:
Documentation only.

Created from Diffusion's 'Open in Editor' feature.

Reviewed By: sahrens

Differential Revision: D6878890

fbshipit-source-id: 23f58246625ab6664bc3dcd4490f24ee50e410c8
2018-02-01 23:20:29 -08:00
Valentin Shergin d7fa81f181 Fixed double `onChange` event triggering from <TextInput> on iOS
Summary:
The problem was recently introduced in the last refactoring of the Text module.
There are two problem actually:
(1) Compare this current code with stable version.
In the stable version the event is only triggered here:
https://github.com/facebook/react-native/blob/0.52-stable/Libraries/Text/RCTTextField.m#L132-L140
In the new version the event is triggered in two places (which is obviously wrong).

(2) Executing `[_eventDispatcher sendTextEventWithType:RCTTextEventTypeChange:...]` and _onChange() actually do the same thing.
Historically, the single-line <TextInput> used the first approach and multi-line used second one. When we unify the logic, mixed both of them, which was apparenly wrong.
So, we have to remove another call of `[_eventDispatcher sendTextEventWithType:RCTTextEventTypeChange:...]`.
The the future we have to completly remove usage of `_eventDispatcher` from this component.

Depends on D6854770.

Reviewed By: fkgozali

Differential Revision: D6869678

fbshipit-source-id: 6705ee8dda2681ae184ef6716238cc8b62efeff1
2018-02-01 14:16:40 -08:00
Brian Vaughn 13829751b1 React sync for revisions a7b9f98...4eed18d
Reviewed By: gaearon

Differential Revision: D6875052

fbshipit-source-id: 516f46f1b78bd8ca3323ba119d3afda491d76497
2018-02-01 14:06:55 -08:00
Spencer Ahrens e485cde187 use scrollview for lightbox on ios
Reviewed By: wwalser

Differential Revision: D6858376

fbshipit-source-id: a9ff9c71cb4ad56a4f5af73a4e86de52ddf75700
2018-02-01 12:13:07 -08:00
Valentin Shergin 74963eb945 Stub for `caretHidden` prop in RCTUITextView
Summary:
Even if we don't support this prop yet, we have to expose this in RCTUITextView to conform the contract between ViewManager and ShadowView.
Same story as D6842304.
Depends on D6842304.

Reviewed By: fmoo

Differential Revision: D6869750

fbshipit-source-id: 9b35f1a38040319ec66f1ec12f97ac739f8b204f
2018-02-01 11:03:27 -08:00
Agastya Darma b1cdb7d553 Implementing space-evenly
Summary:
So in v0.52.0 space-evenly is introduced but not yet implemented (1050e0b by woehrl01). This pull request implements the space-evenly.

Manual Testing.
![notes marker](https://i.imgur.com/IXmezVY.png)

[IOS] [FEATURE] [Yoga] Adding space-evenly on justify-content in iOS
[ANDROID] [FEATURE] [Yoga] - Adding space-evenly on justify-content in Android
Closes https://github.com/facebook/react-native/pull/17805

Differential Revision: D6858294

Pulled By: shergin

fbshipit-source-id: 7a705ca05f58603ef4588e1bfd16c16a78f8a390
2018-01-31 10:17:22 -08:00
Valentin Shergin 00099093dc Text: Enabling RCTVirtualText for iOS
Summary:
Without this change native RCTVirtualText module is unactive on iOS.
This can cause bags in Text rendering because failback module (RCTVirtualText) does not popagate dirty status upward.

Depends on D6842304.

Reviewed By: yungsters, AaaChiuuu

Differential Revision: D6854770

fbshipit-source-id: ab8b7acd67309b7351c0074293ee6515a55385ce
2018-01-30 20:35:39 -08:00
Valentin Shergin ef4214a49a Stub for `clearButtonMode` prop in RCTUITextView
Summary: Even if we don't support this prop yet, we have to expose this in RCTUITextView to conform the contract between ViewManager and ShadowView.

Reviewed By: sahrens

Differential Revision: D6842304

fbshipit-source-id: 7ea26974f595eba6a3c06df06ca01e46af2e63df
2018-01-30 11:30:54 -08:00
Brian Vaughn c7ed03a95c Synced ReactFabric render
Reviewed By: fkgozali, sebmarkbage

Differential Revision: D6839001

fbshipit-source-id: 47b8278e883c33ca1f359dd16614f86c292e972d
2018-01-30 09:01:17 -08:00
Semen Zhydenko 8ffc16c6e7 Typos in code
Summary:
To fix typos

No testing required, changed only internal things names

No

addtionalStyles -> additionalStyles
occured -> occurred
recomendedType -> recommendedType
markDirtyAndPropogate -> markDirtyAndPropagate
targetting -> targeting
RCTApplyTranformationAccordingLayoutDirection -> RCTApplyTransformationAccordingLayoutDirection (tranform -> transform)
Closes https://github.com/facebook/react-native/pull/17587

Differential Revision: D6832696

Pulled By: shergin

fbshipit-source-id: 452287e5ce82df5c6b87126cb21889b7bd9d73c1
2018-01-29 19:17:33 -08:00
Héctor Ramos 28d60b68ad Trim docs that are already present in the open source docs site
Summary:
A lot of these docs are already present in https://github.com/facebook/react-native-website.
Closes https://github.com/facebook/react-native/pull/17776

Differential Revision: D6839783

Pulled By: hramos

fbshipit-source-id: 945fde22afb8f181d0463617d224d3f3429faa24
2018-01-29 16:20:15 -08:00
Adam Putinski 31288161e1 Add accessibilityElementsHidden prop
Summary:
Allow iOS to have similar accessibility functionality to Android. This PR exposes the `accessibilityElementsHidden` property on iOS which is similar to Android's `importantForAccessibility="no-hide-descendants"`

I didn't see any existing examples for testing native props being passed through, but I did add an example to the RNTester app. I've attached some screenshots using the Accessibility Inspector to verify the property was correctly passed through.

![a](https://user-images.githubusercontent.com/603528/34998153-50e66776-faac-11e7-826d-1445a6813929.png)
![b](https://user-images.githubusercontent.com/603528/34998158-535a7420-faac-11e7-80d4-992fb7cd82dd.png)

I've updated the website with appropriate documentation.

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

![screen shot 2018-01-16 at 10 23 50](https://user-images.githubusercontent.com/603528/34998202-6f2f39a6-faac-11e7-8651-0cfe8e037a30.png)
![screen shot 2018-01-16 at 10 23 59](https://user-images.githubusercontent.com/603528/34998205-711d6f94-faac-11e7-974d-54340c72fce4.png)

[IOS] [FEATURE] [View] - Added accessibilityElementsHidden property
Closes https://github.com/facebook/react-native/pull/17627

Differential Revision: D6806444

Pulled By: hramos

fbshipit-source-id: 50d31fdb92f4c59ae9355b019c422418b2e6cc24
2018-01-29 14:44:11 -08:00
Brian Vaughn d676746f14 React sync for revisions 9491dee...a7b9f98
Reviewed By: sebmarkbage

Differential Revision: D6834573

fbshipit-source-id: 30829313053ecec54a891941fcf090021497ef8e
2018-01-29 14:44:11 -08:00
Logan Daniels ae2d5b1e68 Nested virtualized lists should receive recordInteration events
Summary:
Right now when an interaction is recorded on a parent VirtualizedList, the interaction isn't passed on to its children. That means that if `waitForInteraction` is set to true for a child list's viewability helper, it will never trigger a VPV.

This change adds forwarding of these events inside `onBeginScrollDrag`. It also forwards the interaction state of the parent list at register time, in case a child list is rendered mid-scroll.

Reviewed By: sahrens

Differential Revision: D6822091

fbshipit-source-id: dfe300e42722d4285f65787ab2c1368f050c5577
2018-01-29 12:13:58 -08:00
Janic Duplessis ecaca80d42 Support sticky headers for inverted Lists
Summary:
Sticky headers for inverted lists should still stick at the top of the list instead of the bottom.

Tested by adding the inverted prop to the SectionList example in RNTester.

It does add a prop to ScrollView but it's very specific to the inverted list implementation, not sure if it should be documented.

[GENERAL][ENHANCEMENT][LISTS] -  Support sticky headers for inverted Lists
Closes https://github.com/facebook/react-native/pull/17762

Differential Revision: D6830784

Pulled By: sahrens

fbshipit-source-id: 6841fdd46e04b30547659d85ff54c3a21c61a8a2
2018-01-29 11:46:26 -08:00
Dmitry Zakharov 429fcc8cab Migrate DeviceInfoModule from RN Module to Native Function.
Reviewed By: danzimm

Differential Revision: D6750934

fbshipit-source-id: f453801737e41632c6b84ff894e7f0eb66b575dc
2018-01-29 11:18:42 -08:00
Moti Zilberman be7037fd8e Test and document Image resizeMode=center on iOS
Summary:
`<Image resizeMode="center">` already works on iOS (implemented in #8792), but is neither tested nor documented the way the other `resizeMode` values are.

This PR primarily enables the relevant RNTester case on iOS, and secondarily copies over the doc comment from `Image.android.js` to `Image.ios.js`. A PR to `react-native-website` will follow shortly and it is there I will try and revise the wording a bit.

Updated RNTester screenshot (iOS):

<img src=https://user-images.githubusercontent.com/2246565/35470720-44b38282-0357-11e8-941c-1b3c5a1b2f3b.png width=300>

react-native-website PR coming soon.

[IOS] [MINOR] [Image] - Include resizeMode=center in RNTester
Closes https://github.com/facebook/react-native/pull/17759

Differential Revision: D6829051

Pulled By: hramos

fbshipit-source-id: c6e0000a75765e8bf3a1d0306aaafad002b14a58
2018-01-27 11:45:12 -08:00
Satyajit Sahoo be56a3efee Implement Blob support for XMLHttpRequest
Summary:
This PR is a followup to https://github.com/facebook/react-native/pull/11417 and should be merged after that one is merged.

  1. Add support for creating blobs from strings, not just other blobs
  1. Add the `File` constructor which is a superset of `Blob`
  1. Add the `FileReader` API which can be used to read blobs as strings or data url (base64)
  1. Add support for uploading and downloading blobs via `XMLHttpRequest` and `fetch`
  1. Add ability to download local files on Android so you can do `fetch(uri).then(res => res.blob())` to get a blob for a local file (iOS already supported this)

  1. Clone the repo https://github.com/expo/react-native-blob-test
  1. Change the `package.json` and update `react-native` dependency to point to this branch, then run `npm install`
  1. Run the `server.js` file with `node server.js`
  1. Open the `index.common.js` file and replace `localhost` with your computer's IP address
  1. Start the packager with `yarn start` and run the app on your device

If everything went well, all tests should pass, and you should see a screen like this:

![screen shot 2017-06-08 at 7 53 08 pm](https://user-images.githubusercontent.com/1174278/26936407-435bbce2-4c8c-11e7-9ae3-eb104e46961e.png)!

Pull to rerun all tests or tap on specific test to re-run it

  [GENERAL] [FEATURE] [Blob] - Implement blob support for XMLHttpRequest
Closes https://github.com/facebook/react-native/pull/11573

Reviewed By: shergin

Differential Revision: D6082054

Pulled By: hramos

fbshipit-source-id: cc9c174fdefdfaf6e5d9fd7b300120a01a50e8c1
2018-01-26 09:17:11 -08:00
Tim Yung 3fc33bb54f RN: Add Missing Start/End Style Types
Reviewed By: shergin

Differential Revision: D6813953

fbshipit-source-id: eed5dcaa2b6f4101f03d7fe1fca9d20c0f6a6429
2018-01-25 22:01:05 -08:00
Valentin Shergin 7d1ec7a3dc Fixed a bug when <Text> does not redraw native view on relayout
Summary: `contentFrame` is now always provided by shadow thread (with attributed string and embedded views), so we have to update it on every single relayout.

Reviewed By: yungsters

Differential Revision: D6817401

fbshipit-source-id: c2a1f314f34a2187053eb11ce0744c935edbb8ae
2018-01-25 21:33:20 -08:00
Valentin Shergin 46fd864348 Proper attributed strings comparsion in RCTBaseTextInputView
Summary:
Now, in the new model, we transfer text attributes with actual text via attributed text to a native text component,
so previous text-only comparsion is not sufficient anymore.

Depends on D6600685.

Differential Revision: D6809833

fbshipit-source-id: 475b7426cf3c6694781790d99ef32466606da2f2
2018-01-25 13:47:35 -08:00
Valentin Shergin 2716f53220 The New <Text> on iOS
Summary:
This is a complete rewrite of RCTText, the part of React Native which manages Text and TextInput components.

Key points:

* It's understandable now. It follows a simple architectural pattern, and it's easy to debug and iterate. Text flow layout is a first-class citizen in React Native layout system now, not just a wired special case. It also brings entirely new possibilities such as nested interleaving <Text> and <View> components.
* All <Text>-specific APIs were removed from UIManager and co (it's about ~16 public methods which were used exclusively only by <Text>).
* It relies on new Yoga measurement/cloning API and on-dirty handler. So, it removes built-in dirty propagation subsystem from RN completely.
* It caches string fragments properly and granularly on a per-node basis which makes updating text-containing components more performant.
* It does not instantiate UIView for virtual components which reduces memory utilization.
* It drastically improves <TextInput> capabilities (e.g. rich text inside single line <TextInput> is now supported).

Screenshots:
https://cl.ly/2j3r1V0L0324
https://cl.ly/3N2V3C3d3q3R

Reviewed By: mmmulani

Differential Revision: D6617326

fbshipit-source-id: 35d4d81b35c9870e9557d0211c0e934e6072a41e
2018-01-24 00:03:01 -08:00
Eli White cd263a2cc7 Backed out changeset 409acf8d3356
Differential Revision: D6789941

fbshipit-source-id: 30d431727a4615208f51293d071f9334584a2269
2018-01-23 19:26:03 -08:00