Commit Graph

83 Commits

Author SHA1 Message Date
Valentin Shergin 2b1795c5ad Support `<TextInput keyboardType="numeric" returnKeyType="done" />` on iOS
Summary:
Standard only-numeric (number pad) keyboard on iOS does not have any "Done" or "Enter" button, and this is often very badly hurt user experience.
Usually it can be solved by implementing custom `inputAccessoryView`, but RN does not have built-in support for customizing it.
So, this commit introduced limited support only for "Done" button (returnKeyType="done") and it should suite very well for the vast majority of use cases.
This is highly requested feature, see more details here:
https://github.com/facebook/react-native/issues/1190

Reviewed By: mmmulani

Differential Revision: D5268020

fbshipit-source-id: 90bd5bffac6aaa1fb7c5c2ac539b35b04d45918f
2017-06-27 16:22:45 -07:00
Spencer Ahrens 1a5489bb70 Fix SnapshotExample
Reviewed By: fkgozali

Differential Revision: D5327149

fbshipit-source-id: 685bd2f52b6457b03db2e49df67c9830dd6c102a
2017-06-27 09:40:24 -07:00
Brian Vaughn 119959252e Remove RN fiber createClass wrapper around View
Reviewed By: spicyj

Differential Revision: D5241527

fbshipit-source-id: 9209004544e83cc0f03fcaa27c9b1acf8db09930
2017-06-21 12:38:06 -07:00
Hank Brekke ec68536e08 iOS `presentationStyle` Modal Appearance
Summary:
When using `<Modal` on larger iOS devices, esp. iPad and iPhone 7 Plus devices, there is no way to use the system functionality for controlling the appearance of modals (`presentationStyle`), which improves the native system's animation and display of smaller content appearing within large horizontal space.

I've added a new picker for selecting a `presentationStyle` within  the RNTester app. See below for the appearance of this change, as well as the relevant changes to the RN documentation.

![may-22-2017 09-49-50](https://cloud.githubusercontent.com/assets/3521186/26315020/6d4b1cb0-3ed5-11e7-8ac8-a996f1ee00f9.gif)
<img width="1051" alt="screen shot 2017-05-22 at 9 50 12 am" src="https://cloud.githubusercontent.com/assets/3521186/26315021/6d4cbf7a-3ed5-11e7-9d13-a5d20c9f3533.png">
Closes https://github.com/facebook/react-native/pull/14102

Differential Revision: D5281990

Pulled By: shergin

fbshipit-source-id: 882d8cb79e7adb0b4437cdf26e5e7ab1fc04f4c1
2017-06-20 19:22:57 -07:00
Mehdi Mulani 112e3767ce Fix crash in AccessibilityManager
Summary:
Fix this crash by making sure the RCTDeviceInfo is doing things on the main thread.
This fixes #14043.

Reviewed By: ashwinb

Differential Revision: D5286746

fbshipit-source-id: cce3426a6e7e7221cff82f8bca663d9a060dd358
2017-06-20 18:45:58 -07:00
Guy Blank 60783aa6ba Expose content-available APS key for iOS silent push
Summary:
<details>
  Thanks for submitting a PR! Please read these instructions carefully:

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

  Please read the [Contribution Guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md) to learn more about contributing to React Native.
</details>

_What existing problem does the pull request solve?
In iOS when sending a silent push notification you need to configure the 'content-available' APS key to the value of 1 (When this key is present, the system wakes up your app in the background and delivers the notification to its app delegate, see [apple docs](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1)).

This PR exposes this property to the notification event handler so app code can handle silent push scenario specifically. Currently this property is not available.

I've updated the PushNotificationIOSExample in the RNTester.

1. Open RNTester in xcode
2. Enable the  push notifications capability
3. run on device
4. Go to PushNotificationIOS
5. click on "send fake notification"
6. verify alert message contains 'content-available' with a value of 1.
Closes https://github.com/facebook/react-native/pull/14584

Differential Revision: D5279181

Pulled By: shergin

fbshipit-source-id: d2288e147d89ba267f54265d819aa0a9969095e7
2017-06-19 16:46:31 -07:00
Alex Dvornikov c143313a20 Make RCTSamplingProfilerPackagerMethod not depend on RCTBridge
Reviewed By: javache

Differential Revision: D5245899

fbshipit-source-id: a99de4cbf0ddd9c8ee98cbbf438f8930a57e917c
2017-06-15 12:07:34 -07:00
Avik Chaudhuri 71401c1185 update xplat/js to flow 0.48.0
Reviewed By: zertosh

Differential Revision: D5243415

fbshipit-source-id: 78ea4f7f29bcd6a70650f24ceb05f06b18b39018
2017-06-14 15:47:21 -07:00
Eric Vicenti c78ddf2c3d Fix header on RNTester file
Reviewed By: hramos

Differential Revision: D5214933

fbshipit-source-id: 42ef48eead88200fc33029923ce1f4b1b5acf3b2
2017-06-13 12:18:45 -07:00
Eric Vicenti c4818d9394 Fix header on RNTester file
Reviewed By: hramos

Differential Revision: D5215027

fbshipit-source-id: 8e2dd4b4bfc94767839b44bf7af489a76d1caad7
2017-06-13 09:47:14 -07:00
Spencer Ahrens 1d30f833a6 Add inverted option
Reviewed By: bvaughn

Differential Revision: D5210277

fbshipit-source-id: 5a8b196b90a2ac6d20397113ef4bd76446ea9fa3
2017-06-12 22:45:49 -07:00
Jean Regisser 5114b61b5e Add support for flashScrollIndicators on iOS
Summary:
Flashing scroll indicators is a standard behavior on iOS to show the user there's more content.

Launch RNTester on iOS, go to the ScrollView section, tap the "Flash scroll indicators" button.
You'll see this:

![Flash scroll indicators](https://cloud.githubusercontent.com/assets/57791/26250919/ebea607a-3cab-11e7-96c6-27579cc809ab.gif)

I've exposed the method `flashScrollIndicators` on all scrolling components that were already exposing a `scrollToXXX` method so it's usable from those components using a ref.

Let me know what you think.
Closes https://github.com/facebook/react-native/pull/14058

Differential Revision: D5103239

Pulled By: shergin

fbshipit-source-id: caad8474fbe475065418d771b17e4ea9766ffcdc
2017-06-06 13:06:48 -07:00
Koen Punt e5e3591009 replace lineBreakMode with ellipsizeMode
Summary:
lineBreakMode is a non-existing property (or maybe legacy?)

While reading the docs I encountered this prop being used in the example, but it doesn't exist in the codebase anymore.
Closes https://github.com/facebook/react-native/pull/13820

Differential Revision: D5189652

Pulled By: javache

fbshipit-source-id: 70e620fc094ae5e1628ab13ee9e410044e4f5291
2017-06-06 04:16:00 -07:00
Valentin Shergin 072d2709df Introducing `-[RCTView reactAccessibleView]`
Summary:
Sometimes, when we implement some custom RN view, we have to proxy all accessible atributes directly to some subview which actually has accesible content. So, in other words, this allows bypass some axillary views in terms of accessibility.
Concreate example which this approach supposed to fix:
https://github.com/facebook/react-native/pull/14200/files#diff-e5f6b1386b7ba07fd887bca11ec828a4R208

Reviewed By: mmmulani

Differential Revision: D5143860

fbshipit-source-id: 6d7ce747f28e5a31d32c925b8ad8fd4b98ce1de1
2017-06-02 14:19:57 -07:00
Pieter De Baets 79500f81a9 Fix Travis CI runs
Summary: Closes https://github.com/facebook/react-native/pull/14286

Differential Revision: D5164925

Pulled By: javache

fbshipit-source-id: 0ebe028ab58f37a9afc8b615fe346d7af9180040
2017-06-02 09:03:18 -07:00
Jhen cf51aee9a0 Support `options` param for `requestIdleCallback`
Summary:
The `requestIdleCallback` sometimes doesn't work in `Debug JS Remotely` mode if I use real device, the callback will never called. I guess it may be debugger worker and device caused by the time gap, or some cause websocket blocking, so it's just sometimes happening.

I think we can support [options](https://developer.mozilla.org/zh-TW/docs/Web/API/Window/requestIdleCallback#Parameters) for that.

Added an example `Run requestIdleCallback with timeout option` for Timers of UIExplorer, it use `{ timeout: 100 }` option with burn CPU 100ms, we can see `didTimeout` is true.
Closes https://github.com/facebook/react-native/pull/13116

Differential Revision: D4894348

Pulled By: hramos

fbshipit-source-id: 29c4c2fe5634b30a8bf8d3495305cd8f635ed922
2017-06-01 11:00:40 -07:00
Valentin Shergin e13b9c6e49 RCTTextField was spliited into two classes
Summary:
Motivation:
 * We maintain two different implementation of <TextInput> (multilined and singlelined), this change makes the implementations much similar which will help us to support and improve both of them in the (near) future;
 * We have to have separated RCTView-based container view for (TextField) to support sofisticated bordering and so on;
 * It opens to us possibility to unify UITextView and UITextField subclasses and remove code duplication across RCTTextView and RCTTextField;
 * Making things decoupled in general will allow us to fix existing bugs with events.

Reviewed By: mmmulani

Differential Revision: D5083010

fbshipit-source-id: 2f2d42c2244d2b39256c51480c1f16f4e3947c01
2017-05-29 16:01:11 -07:00
Valentin Shergin 48650226e8 Multiline <TextInput> was fixed to match layout logic of singlelined one
Summary: Now padding, border and intinsic sizes are computed same way as for singlelined text input.

Reviewed By: mmmulani

Differential Revision: D5075880

fbshipit-source-id: 1bc2fd479c13a003c717b1fc3d9c69f4639d4444
2017-05-29 16:01:09 -07:00
Valentin Shergin 44af4d19d3 Fixed <TextInput>'s padding and border size computation and layout
Summary: Previosly `borderWidth` did not affect actual content inset (which was a problem).

Reviewed By: mmmulani

Differential Revision: D5072483

fbshipit-source-id: d43cba7414a9335b9f9fd4d1565d7aee403cce0e
2017-05-29 16:01:04 -07:00
Valentin Shergin ea9d6746df Singleline <TextInput> now has intrinsic size
Summary:
Singleline <TextInput> now has intrinsic size which is equal to size of placeholder.
And if <TextInput> does not have placeholder it still has intrinsic height.
So, we don't need to set the size up manually every single time anymore!

(Multiline <TextInput> already has this feature.)

Reviewed By: mmmulani

Differential Revision: D5069971

fbshipit-source-id: f65c1062a812259b66d287929314dc571dc1f3ee
2017-05-29 16:00:58 -07:00
Valentin Shergin 3df537a25c Using `drawViewHierarchyInRect` instead of `renderInContext` for snapshot tests
Summary:
We found that `-[CALayer renderInContext:]` produces bad results in some cases (which is actually documented thing!),
so we decided to replace it with `-[UIView drawViewHierarchyInRect:]` which is more reliable (I hope).
As part of this change I completly removed support of `CALayer` from local fork of `RNTesterIntegrationTests`.

See https://github.com/facebook/react-native/pull/14011#issuecomment-303844580 for more details.

janicduplessis

Reviewed By: javache

Differential Revision: D5129492

fbshipit-source-id: 6a9227037c85bb8f862d55267f5301e177985ad9
2017-05-26 15:16:07 -07:00
Janic Duplessis 11424a8bc6 Native Animated - Support Animated.loop on iOS
Summary:
Follow up to #11973 to add support to Animated.loop with useNativeDriver on iOS.

**Test plan**
Test with new UIExplorer example
Run unit tests
Closes https://github.com/facebook/react-native/pull/13359

Differential Revision: D4960754

Pulled By: javache

fbshipit-source-id: caa840281f1b060df7a2b1c50405fcae1e1b0de6
2017-05-26 03:30:33 -07:00
glevi@fb.com ffdae135fd Deploy v0.47.0 to xplat/js
Reviewed By: zertosh

Differential Revision: D5135644

fbshipit-source-id: f979970f8d0c4e082ec1302084d4def6652557c8
2017-05-25 23:00:37 -07:00
Valentin Shergin 35393524a9 Fixed <TextInput>.onContentSizeChange on Android
Summary:
Previously <TextInput>'s onContentSizeChange event fires very rearly, usually just once after initial layout. This diff fixed that.
I also considered to a bunch of another things to get the native notification, but I found that overriding `onTextChanged` is the most reliable, easy and effitient way to implement this.

I tried/considered:
 * onLayout (does not fire)
 * OnPreDrawListener (fires to often)
 * OnGlobalLayoutListener (does not fire)
 * OnLayoutChangeListener (does not fire)
 * isLayoutRequested (too hacky)

(I also fixed the <AutoExpandingTextInput> demo to illustrate the fix.)

And just heads up, we will remove `contentSize` info from `onChange` event very soon.

GH issue: https://github.com/facebook/react-native/issues/11692

Reviewed By: achen1

Differential Revision: D5132589

fbshipit-source-id: e7edbd8dc5ae891a6f4a87b51d9450b8c6ce4a1e
2017-05-25 19:31:31 -07:00
Jason Noah Choi ff78a8de22 Add newly recommended method for RCTLinkingManager due to deprecation
Summary:
What existing problem does the pull request solve?

Beginning in iOS9, Apple has deprecated `-application:openURL:sourceApplication:annotations:`

`- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation NS_DEPRECATED_IOS(4_2, 9_0, "Please use application:openURL:options:") __TVOS_PROHIBITED;`

This PR uses the newly recommended method:

`- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)`

while meanwhile, leaving the deprecated one for developers wishing to use the older `-application:openURL:sourceApplication:annotations:` for apps that support versions 8.x or less.

Benefits will include:
- [x] less warnings
- [x] official deprecation should happen when iOS 11 is deployed
- [x] TVOS support
Closes https://github.com/facebook/react-native/pull/13615

Differential Revision: D4987980

Pulled By: javache

fbshipit-source-id: ae07715a55ca627860262a9c8cf7df1e3c5e752b
2017-05-25 11:31:23 -07:00
Caleb Meredith f702cbecba Render section footer in <SectionList> sections with no data
Summary:
Fixes https://github.com/facebook/react-native/issues/13784

The section footer was only rendered with the last item of the section. However, that meant in sections where no items were rendered, no section footer would be rendered. This patch makes sure that when there are no items the section footer is rendered with the section header in addition to adding tests asserting the existance of section footers in empty lists.

One potential point of contention is whether or not a section separator (as defined by the `SectionSeparatorComponent` prop to `<SectionList>`) should be rendered in an empty list. I did not include a section separator for empty lists, but let me know if you think one should be included. See the test plan below for an image of an empty section rendered without a section separator.

I was also running into a lint error, `no-alert`, in `SectionListExample.js` around line 135 that blocked me from publishing. This error looks to be triggered when the `alert()` global function is called, so to fix the error I added an import for the `Alert` module and called the `alert()` function on that module.

To help debug the `scrollToLocation()` behavior that was modified as a part of this PR I added three buttons (can be seen in the test plan image) which scroll to arbitrary points in the list.

Reviewed By: sahrens

Differential Revision: D5084095

fbshipit-source-id: 4c98bebc1c3f1ceaa5a634fa144685d83d1072df
2017-05-25 10:30:55 -07:00
Douglas Lowder 9e8a39ce2c Add ART library to UIExplorer for iOS, with sample and snapshot test
Summary:
**Motivation**

The ART library is part of the react-native repo, but is not included in UIExplorer and has no native testing.  This PR adds the ART library to UIExplorer, adds an example tab for it, and adds a snapshot test.

**Test plan**

New snapshot test.
Closes https://github.com/facebook/react-native/pull/13621

Differential Revision: D4954082

Pulled By: javache

fbshipit-source-id: 83e21c5df1b766ff6ca9f8914eb3382f7323627d
2017-05-25 08:45:47 -07:00
Xinbo Wang eac399b696 Add flexWrap warning
Reviewed By: sahrens

Differential Revision: D5117970

fbshipit-source-id: 11b542bd6cd7b1ab22ba8f6822d471df94fa7da2
2017-05-25 00:00:38 -07:00
Valentin Shergin 9637dd4a1b Introducing <ImageBackground>, replacement for <Image> which supports nesting views
Summary:
We are removing support of nesting views inside <Image> component. We decided to do this because having this feature makes supporting `intrinsinc content size` of the `<Image>` impossible; so when the transition process is complete, there will be no need to specify image size explicitly, it can be inferred from actual image bitmap.

And this is the step #0.

<ImageBackground> is very simple drop-in replacement which implements this functionality via very simple styling.
Please, use <ImageBackground> instead of <Image> if you want to put something inside.

Reviewed By: yungsters

Differential Revision: D5100021

fbshipit-source-id: 640c0fb2d1066e166d974efba39b4cfaaee7dd45
2017-05-24 11:30:48 -07:00
David Aurelio a710f9a81e Move packager launcher scripts outside of `packager/`
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.

Reviewed By: javache

Differential Revision: D5112193

fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
2017-05-23 16:17:09 -07:00
Pieter De Baets 885856c6a1 More attempts to fix Travis CI runs
Summary:
* Add RCTBridge+Private to exported headers for unit tests
* Fix tvOS build
Closes https://github.com/facebook/react-native/pull/13840

Reviewed By: ericvicenti

Differential Revision: D5027887

Pulled By: javache

fbshipit-source-id: 7a17ee2f84eb1cb87e71373444ef25559959c24a
2017-05-10 04:32:54 -07:00
Valentin Shergin 5058e7eb05 Several layout related helper methods of RCTShadowView was moved to new (+Layout) category.
Reviewed By: javache

Differential Revision: D4865327

fbshipit-source-id: 4df71b57433370ee09c3f1288c4d6241a33f440a
2017-05-08 11:31:20 -07:00
Eric Vicenti 4a80dceac7 Re-license and rename UIExplorer integration test app as RNTester
Reviewed By: yungsters

Differential Revision: D4950085

fbshipit-source-id: 44574b5d0ef0d2ad5dfc714309b18dc69cbad9ff
2017-05-08 11:31:19 -07:00