Commit Graph

999 Commits

Author SHA1 Message Date
Ian MacLeod 4f89fa9cf3 registration error event
Summary:
This is an updated version of #2336 and #7694.

 ---

This adds a `registrationError` event that is emitted by `PushNotificationIOS` whenever an application receives a registration error from APNS (APNS service failure, running on simulator, etc).  This event fires to the exclusion of the `register` event (and vice versa).

**How to use**

Add the following to your `AppDelegate.m`:

```obj-c
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
  [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error];
}
```

And register an event handler for the event:

```js
PushNotificationIOS.addEventListener('registrationError', function({ message, code }) {
  // Complete your registration process in error.
});
```

**Test plan**

Added support for this event (and `register`) to UIExplorer as a proof of concept.  Navigating to the push notifications example on a simulator is an easy way to reproduce this e
Closes https://github.com/facebook/react-native/pull/9650

Differential Revision: D3822142

Pulled By: javache

fbshipit-source-id: a15ed8941b74dc3eed2c44c658deccbcaf39ce3d
2016-09-06 11:13:40 -07:00
Andrei Coman 128b698a03 UIExplorer fixes
Summary:
Currently, when reloading uiexplorer, it does not go back to the last visited
component. This fixes it, by only storing the state (which contains the last
visited component), after it has been set.

Reviewed By: bestander

Differential Revision: D3821288

fbshipit-source-id: 5b9ba10765ce402c20016519a3b7f6b5211cc623
2016-09-06 06:43:37 -07:00
leeight 0d176b3337 Update XHRExampleFetch and dump the response headers
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

Dump the response headers so that we can check `Set-Cookie` header is working properly whether or not.

**Test plan (required)**

Manual Test.

![image](https://cloud.githubusercontent.com/assets/104052/18259326/6b86c90a-7415-11e6-8979-92bd24ac703c.png)

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/9687

Differential Revision: D3821145

Pulled By: javache

fbshipit-source-id: 24baa051165d3b451ba0e71efbe70db44b0bf45e
2016-09-06 04:28:38 -07:00
Andrei Coman f07ca31303 Listen to device orientation changes
Summary:
Similar to iOS, send device orientation changes events. This does not have the
`getCurrentOrientation` method, because it's not used. If necessary, we'll
add it separately.
This also adds a simple example for testing.

We listen to orientation changes in `onGlobalLayout`, and check if the rotation of the device has changed. If it has, we emit the event.
But:
- `onGlobalLayout` (and `onConfigurationChanged` - which is the method usually used for checking for device orientation changes) is *not* called when the device goes from landscape
  to reverse landscape (same with portrait), as that is not a relayout / configuration change. We could detect if this happens with the help of an `OrientationEventListener`. However, this listener notifies you if the degree
  of the phone changes by a single degree, which means that you need to know by how many degrees the phone needs to change in order for the orientation to change. I haven't looked into how accurate this could be, but I suspect that in practice it would cause a lot of bugs. A simple `abgs` and google search reveals that everybody uses a different margin for detecting a rotation change (from 30 to 45 degrees), so I suspect that this won't work
  as expected in practice. Therefore, we're not using this here, and we're sticking to what android provides via `onConfigurationChanged`. If we find that we have issues because users need to know when the user goes
  from landscape to reverse landscape, then we'll have to revisit this.

Reviewed By: foghina

Differential Revision: D3797521

fbshipit-source-id: 62508efd342a9a4b41b42b6138c73553cfdefebc
2016-09-06 03:59:01 -07:00
Andrei Coman 5d240a8ed3 Fix uiexplorer BUCK install
Summary: It's missing a dependency

Reviewed By: bestander

Differential Revision: D3821094

fbshipit-source-id: 8e048f6daa052ff002ebef2498920d7bd69d324d
2016-09-06 03:43:49 -07:00
leeight 99d742c0b7 On Android `geolocationError` return PositionError object.
Summary:
Follow iOS implementation:
https://github.com/facebook/react-native/blob/master/Libraries/Geolocation/RCTLocationObserver.m#L325

and FIX #9710
Closes https://github.com/facebook/react-native/pull/9734

Differential Revision: D3819868

Pulled By: mkonicek

fbshipit-source-id: 3deb7d3d253d402bfcb88c6a94ca705128998748
2016-09-05 12:58:43 -07:00
Pieter De Baets dda3c5f48d Support sync method calls in the objc bridge
Reviewed By: mhorowitz

Differential Revision: D3801188

fbshipit-source-id: b990680049a46840472a25e66882f8a29890ae90
2016-09-05 07:44:00 -07:00
Janic Duplessis 3c1b69c1a9 Add TextInput controlled selection prop on Android
Summary:
Android PR for TextInput selection, based on the iOS implementation in #8958.

** Test plan **
Tested using the text selection example in UIExplorer.
Closes https://github.com/facebook/react-native/pull/8962

Differential Revision: D3819285

Pulled By: andreicoman11

fbshipit-source-id: 9a2408af2a8b694258c88ab5c46322830c71452a
2016-09-05 07:13:46 -07:00
Mehdi Mulani 6c909ef80d Render UIExplorer examples functionally to handle landscape orientation correctly
Reviewed By: javache

Differential Revision: D3810007

fbshipit-source-id: ff8dfa4b326bb385ea91592b374f5a45a6d4ff64
2016-09-02 14:43:44 -07:00
Pieter De Baets 07553d0f1c Update React Native minimum OS version to iOS8
Reviewed By: majak

Differential Revision: D3723143

fbshipit-source-id: 482f9820370b752d937e6df7f74c33d53a0a2e7d
2016-09-01 19:43:47 -07:00
Pieter De Baets 46b54fd7a8 Support bundle argument for image loading
Reviewed By: mmmulani

Differential Revision: D3768798

fbshipit-source-id: 5b35f06957cebfe74aca90fe6a456f7f739509a9
2016-08-31 17:43:49 -07:00
Pieter De Baets 74308209f9 Cleanup FBReactKit BUCK paths
Reviewed By: mmmulani

Differential Revision: D3785232

fbshipit-source-id: 8abb2789420eca9a2f7a88dbf43f2a58ded081c8
2016-08-31 17:43:49 -07:00
Ian MacLeod 63931b1a68 Support RCTNetworking#clearCookies on iOS
Summary:
This adds cookie clearing support for iOS to match the existing support on Android.  Helpful for resetting the app to a clean state (say, when logging a user out).
Closes https://github.com/facebook/react-native/pull/9264

Differential Revision: D3776492

Pulled By: javache

fbshipit-source-id: 59ae19ac09d3cf0d0e229cd9e8e30865e65ca96c
2016-08-26 05:43:39 -07:00
zxcpoiu 2cfe774a56 Ios: complete iOS vibration pattern supports (js)
Summary:
This is a revised follow up version from #8574 ( originally implemented in `objc` )
This PR change the implementation in JS suggested by javache

**motivation**

To supports vibration pattern like android.

The [iOS vibration implementation link](http://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios/13047464#13047464) mentioned by skv-headless at https://github.com/facebook/react-native/pull/6061#discussion_r54062592, which will not be accepted by apple since that implementation uses a private API. Thus, I use pure public API `NSTimer` to implement it.

**Note**

Since vibration time on iOS is not configurable, there are slightly differences with android.
for example:

**Android Usage:**
`Vibration.vibrate([0, 500, 200, 500])`
==> V(0.5s) --wait(0.2s)--> V(0.5s)

`Vibration.vibrate([300, 500, 200, 500])`
==> --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s)

**iOS Usage:**
if first argument is 0, it will not be included in pattern array.
( vibration
Closes https://github.com/facebook/react-native/pull/9233

Differential Revision: D3775085

Pulled By: javache

fbshipit-source-id: 370495857d5581399de32d2bed1ea1bcce193e9d
2016-08-25 18:28:38 -07:00
Janic Duplessis f0a3c56048 Add TextInput controlled selection prop on iOS
Summary:
This adds support for a controlled `selection` prop on `TextInput` on iOS (Android PR coming soon). This is based on the work by ehd in #2668 which hasn't been updated for a while, kept the original commit and worked on fixing what was missing based on the feedback in the original PR.

What I changed is:
- Make the prop properly controlled by JS
- Add a RCTTextSelection class to map the JS object into and the corresponding RCTConvert category
- Make sure the selection change event is properly triggered when the input is focused
- Cleanup setSelection
- Changed TextInput to use function refs to appease the linter

** Test plan **
Tested using the TextInput selection example in UIExplorer on iOS.
Also tested that it doesn't break Android.
Closes https://github.com/facebook/react-native/pull/8958

Differential Revision: D3771229

Pulled By: javache

fbshipit-source-id: b8ede46b97fb3faf3061bb2dac102160c4b20ce7
2016-08-25 17:28:37 -07:00
Jeff Morrison 5a5c56c8a9 fbsource deploy
Reviewed By: gabelevi, bestander

Differential Revision: D3753032

fbshipit-source-id: 47aadb8a54f47c40f0133966df588d42cdbe0d80
2016-08-23 10:28:53 -07:00
Pieter De Baets 84f68c338a Send down image source to RCTImageView onLoad callback on iOS
Summary: This allows the onLoad callback to know which image has actually loaded. This is only for iOS at the moment - implementing this for Android will require quite a bit more work.

Reviewed By: majak

Differential Revision: D3738759

fbshipit-source-id: b1fc2bd0dc5de90096debeab02b8f795739a4547
2016-08-22 10:58:49 -07:00
Richard Evans 0cf9505630 Allow the disabling of navigation gestures.
Summary:
During development of an app I decided upon NavigationExperimental as I found it easily configurable with my Redux stores and make it work the way I wanted. One thing I found missing was the ability to decide if gestures were on or not for the card stack. In my case I need the gestures off as they conflict with what I am trying to do. This PR simply opens up the ability to turn the gestures for a CardStack off.

Testing was completed via UI Explorer. An additional example replicating the existing one with the new setting set to false was created. To ensure nothing broke I tested both the original example and new example to ensure gestures worked (and didn't work) when expected.

I did not see any unit tests around NavigationExperimental but if I simply missed them I would be more then happy to update/add any.
Closes https://github.com/facebook/react-native/pull/9505

Differential Revision: D3749880

Pulled By: ericvicenti

fbshipit-source-id: dfa42ff8b6c8b41490ad1efc931b364e47058243
2016-08-21 13:13:46 -07:00
Pieter De Baets 049639cfdd Remove unreferenced SliderIOSExample
Reviewed By: foghina

Differential Revision: D3728792

fbshipit-source-id: 879872c9f65af6caa8f027b78a95f718dcc18834
2016-08-19 09:43:40 -07:00
Felix Oghina 2a7f4be8f8 native decay animation
Summary: Add support for `useNativeDriver: true` to `Animated.decay`. Add example in Native Animated Example UIExplorer app.

Reviewed By: ritzau

Differential Revision: D3690127

fbshipit-source-id: eaa5e61293ed174191cec72255ea2677dbaa1757
2016-08-19 07:13:45 -07:00
Mengjue Wang 53d3f94175 Create a RTLExample for OSS
Reviewed By: fkgozali

Differential Revision: D3740559

fbshipit-source-id: 79271abe7ef5c723e934da24884ff777aea0acc3
2016-08-18 20:58:39 -07:00
Martin Kralik ee49dd756d check for NSPhotoLibraryUsageDescription in plist
Reviewed By: javache

Differential Revision: D3723122

fbshipit-source-id: a5393c7dd3c36a15bec3f2e79859920419cc6726
2016-08-18 07:28:43 -07:00
Emil Sjolander fd34c6d567 Move default spacing out of csslayout
Reviewed By: foghina

Differential Revision: D3709574

fbshipit-source-id: 6e0277bd97407a5c642d742f93ca2ac70d7307da
2016-08-18 03:28:34 -07:00
Pieter De Baets a0b3565847 Fix snapshottests under iOS10
Reviewed By: dinhviethoa

Differential Revision: D3722988

fbshipit-source-id: 4345b757e28700ac61e1de38b61430e78948e58a
2016-08-17 10:44:01 -07:00
Pieter De Baets fba96ab990 Use image references consistently in UIExplorer
Reviewed By: davidaurelio

Differential Revision: D3728780

fbshipit-source-id: 4da6a0417eea1ccd0ec0d25574959661f05decb1
2016-08-17 04:43:52 -07:00
Andrei Coman 35d60ecac8 Reinstate view example for screenshot tests
Reviewed By: javache

Differential Revision: D3716630

fbshipit-source-id: 07381f0afe541d0bfea8de6a719d0fa176ccbc3f
2016-08-16 04:58:30 -07:00
Emil Sjolander f7a22bc33c Use single function for margin, position, padding, and border
Reviewed By: lucasr

Differential Revision: D3715201

fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
2016-08-15 09:28:41 -07:00
Connor McEwen 0fb2ccfcc3 Add JS library for requesting Android M Permissions
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

The Android permissions native module was open sourced recently (b7352b4667) but it is currently undocumented and requires directly interfacing with the native module.

This provides a JS wrapper to make it easier to use the permissions module and documents it.

This could be cleaner if the native code used Promise blocks instead of callbacks, but I didn't want to change the native code without a thumbs up since I'm guessing this is used in one of facebook's apps. Happy to do that if it makes sense

I also tried to make the `PERMISSIONS` object a class property - it works in the actual code but not in the documentation (think it's a jsdocs problem), so decided to initialize in the constructor.

**Test plan (required)**

If the API looks good, I will change the UIExplorer example to use this.

cc andreicoman11
Closes https://github.com/facebook/react-native/pull/9292

Differential Revision: D3716303

Pulled By: andreicoman11

fbshipit-source-id: cd40b8757fdf70ea8faecfb58caa00e99a99789e
2016-08-15 05:58:33 -07:00
Janic Duplessis 0e204e1141 Add support for value listener
Summary:
Adds support for `Animated.Value#addListener` for native driven animated values. Same as #8844 but for iOS. This depends on some JS code in #8844 so only review the 2nd commit and let's wait for #8844 to land first.

**Test plan**
Tested using the UIExplorer example.
Closes https://github.com/facebook/react-native/pull/9194

Differential Revision: D3681749

fbshipit-source-id: 521a61e2221c1ad1f6f40c75dd2dc957361d0271
2016-08-11 18:13:31 -07:00
Jacob Parker 68d483e041 Centre text in case where the distance between baselines is larger th…
Summary:
…an the font size (per CSS spec)

Extending upon work https://github.com/facebook/react-native/pull/7603
Closes https://github.com/facebook/react-native/pull/8851

![screen shot 2016-08-04 at 14 49 21](https://cloud.githubusercontent.com/assets/7275322/17404165/bd67bc48-5a52-11e6-9ba1-5a8524f18867.png)
![screen shot 2016-08-04 at 14 49 24](https://cloud.githubusercontent.com/assets/7275322/17404167/be5f4044-5a52-11e6-9014-391349f9c5e1.png)
Closes https://github.com/facebook/react-native/pull/9211

Differential Revision: D3706347

fbshipit-source-id: 0adfff8e8418b02f9b5d6671f5c89669e41abec3
2016-08-11 16:58:33 -07:00
leeight 4963a37e80 Move `getLaunchOptions` from ReactActivity to ReactActivityDelegate
Summary:
After 3c4fd42749, `getLaunchOptions` no longer exists in class `ReactActivity`.
We need refactor UIExplorerActivity to fix the build error.
Closes https://github.com/facebook/react-native/pull/9320

Differential Revision: D3696381

Pulled By: astreet

fbshipit-source-id: 5700cf2363029a95cfbdaf6230e4f82ea69fb472
2016-08-11 04:13:40 -07:00
tfallon@mail.depaul.edu c6b6f53ae7 Initial implementation of adjustsFontSizeToFit.
Summary: Closes https://github.com/facebook/react-native/pull/4026

Differential Revision: D2678492

Pulled By: nicklockwood

fbshipit-source-id: 0467814f810fee997ac50960ffb1daa74d52acba
2016-08-10 11:28:37 -07:00
Jacob Parker f951da912d Add iOS support for CSS property font-variant, accepting tabular-nums…
Summary:
Ground work for allowing `font-variant`s. Currently allows switching between `tabular-nums` and `proportional-nums`. I will need guidance on how to test this, and a few pointers on code style (new to Objective C, and had to make one or two hacks).
Closes https://github.com/facebook/react-native/pull/9045

Reviewed By: majak

Differential Revision: D3664338

Pulled By: javache

fbshipit-source-id: 032f326c37ee6150348da2b33b6a3fc1988e8920
2016-08-09 08:43:34 -07:00
funorpain ced272d906 Android: TicTacToe Example Project
Summary:
**Motivation**

Android project for TicTacToe example is missing.

**Test plan (required)**

Open Android Studio and run TicTacToe-android-app. It builds and runs as expected.
Closes https://github.com/facebook/react-native/pull/8918

Differential Revision: D3684375

Pulled By: foghina

fbshipit-source-id: cd4112467179d3d334cab198d817ed8b5b32599b
2016-08-09 07:58:30 -07:00
Rickard Ekman 8e2906ae89 Android: Implement cancelable option for Alerts
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes https://github.com/facebook/react-native/pull/8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
2016-08-09 06:13:48 -07:00
Adrian Paul Matos 8af6aefd54 Fix alert's error message
Summary:
`error` is not an object so `error.message` will return 'undefined'
Closes https://github.com/facebook/react-native/pull/9271

Differential Revision: D3689980

Pulled By: javache

fbshipit-source-id: 07de946f04cdff0e8013faa2c5512c51c82147b9
2016-08-09 04:43:34 -07:00
Janic Duplessis df05311777 Add transform support for native animated on Android
Summary:
This adds support for the `transform` animated node. This brings feature parity with the iOS implementation and allows running the NativeAnimated UIExplorer example that was created with the iOS implementation on Android. This is based on some work by kmagiera in the exponent RN fork.

This also adds support for mixing static values with animated ones in the same transform as well which is not supported on iOS at the moment. It is also implemented in a way that rebuilds the transform matrix the same way as we build it in JS so it will be easy to remove some of the current limitations like forcing the transforms order and only supporting one of each type.

**Test plan (required)**

Tested with the NativeAnimated example on Android and iOS. Also tested mixing in static values in a transform (`[{ rotate: '45deg' }, { translateX: animatedValue }]`).
Closes https://github.com/facebook/react-native/pull/8839

Differential Revision: D3682143

fbshipit-source-id: 5e6fd4b0b8be6a76053f24a36d1785771690a6f8
2016-08-07 00:58:36 -07:00
Pieter De Baets c5a44b7ca3 Move font helpers to RCTFont
Reviewed By: majak

Differential Revision: D3662804

fbshipit-source-id: 2c03a094a74c617c0d6172e327bd77d23d0d44c2
2016-08-05 12:44:20 -07:00
Hedger Wang 38979f9c68 NavigationExperimental: Stop using absolute position for NavigationHeader.
Summary:
Not a API change, but this may break the layout of exisitng apps that
uses NavigationHeader.

For now, NavigationHeader uses absolute position, which makes it hard for
NavigationCardStack to determine the height of the scenes.

Theoretically, the height of the scenes would be the height of the cards
stack minus the height of the header.

That said, if we want to support the headers with different height (e.g.
MyIOSHeader or MyAndroidHeader), we're forced to expose the height of the
headers and manually compute the height of the scenes.

Alternatively, if the header does not use absolute position, the height
of the scenes can adjust automatically with flex box, and that's what this
commit is about to do.

Reviewed By: ericvicenti

Differential Revision: D3671119

fbshipit-source-id: 26e48f801da3661c5d7dce4752ba927621172f4a
2016-08-04 15:28:30 -07:00
Janic Duplessis 158d435f36 Implement native Animated value listeners on Android
Summary:
Adds support for `Animated.Value#addListener` for native driven nodes on Android. This is based on work by skevy in the exponent RN fork. Also adds a UIExplorer example.

** Test plan **
Run unit tests

Tested that by adding a listener to a native driven animated node and checked that the listener callback is called properly.

Also tested that it doesn't crash on iOS that doesn't support this yet.
Closes https://github.com/facebook/react-native/pull/8844

Differential Revision: D3670906

fbshipit-source-id: 15700ed7b93db140d907ce80af4dae6be3102135
2016-08-04 13:13:33 -07:00
Eric Vicenti e3c6d8c931 Fix UIExplorer iOS swipe back
Reviewed By: hedgerwang

Differential Revision: D3670396

fbshipit-source-id: 76aafa951d869227f32c2d4c585bb1513e5eea37
2016-08-04 12:43:50 -07:00
Hedger Wang ca8531105e NavigationExperimental: Rename `renderOverlay` to `renderHeader`
Summary:
NavigationCardStack is a custom component, and its API should be explicit, not
too generic..

In NavigationCardStack, the prop `renderOverlay` is actually used to render
the NavigationHeader, and we uses absolute position to build the layout for
the header and the body.

One of the problem with using absolute postion and fixed height to build the
layout that contains the header is that the header can't have variant height
easily.

Ideally, if the layout for the header used flex-box, we'd ve able to be more
adaptive to deal with the header that has variant height.

That said, let's rename `renderOverlay` to `renderHeader`, then build the
proper layout that explicitly works better with the header.

If we to need to support overlay in navigation, we may consider add
`renderOverlay` later, if it's really necessary.

Reviewed By: ericvicenti

Differential Revision: D3670224

fbshipit-source-id: ff04acfe9dc995cb57117b3fd9b07d5f97b9c6ee
2016-08-04 11:28:31 -07:00
sam 1d980188f8 clean UIExplorer NavigationExperimental example code
Summary:
1. Explain the **motivation** for making this change.

    Those codes cleaned are not used anywhere, remove them would make the example much more clear to users.

2. **Test plan (required)**

    ![navigationexperimental](https://cloud.githubusercontent.com/assets/1091472/17392196/4f28cba4-5a4e-11e6-9ef1-727edc784f1f.gif)
Closes https://github.com/facebook/react-native/pull/9203

Differential Revision: D3668848

fbshipit-source-id: c604a21c84dba72a5a3c857fc16bc7febfe20377
2016-08-04 10:28:31 -07:00
G. Grau 063f221e56 UIExplorer: fix navigation animation by using props passed to renderTitleComponent
Summary:
The animation shown in the UIExplorer example for NavigationExperimental's NavigationHeader is not working correctly. Due to an incomplete use of the `renderTitleComponent()` callback, interpolation is not working correctly in this example.

Even if the animation error is subtle, since the examples are followed by developers quite closely, the bug may multiply if not corrected in the sample code.

This is a really *tiny* modification that fixes that particular animation.
Closes https://github.com/facebook/react-native/pull/9067

Differential Revision: D3669140

Pulled By: javache

fbshipit-source-id: 6dab36a9132da2f704e9a074ae26e744c3420cde
2016-08-04 03:44:25 -07:00
R0CKSTAR 916bc38d89 Fix libraries missing in examples: 2048 and TicTacToe
Summary:
The examples: 2048 and TicTacToe will display errors when click the run on Xcode. I imported RCTNetwork and RCTImage for 2048 and RCTNetwork for TicTacToe and it works on the simulator.
Closes https://github.com/facebook/react-native/pull/9123

Differential Revision: D3662099

Pulled By: javache

fbshipit-source-id: 2e2d88336ea83eae58088f4cc1d5003ba2a2f71b
2016-08-03 04:58:28 -07:00
alvaromb e52cab5a7f Adds the ability to use UIManager to check if a node is an ancestor
Summary:
Sometimes is handy to check if a React node is a descendant of another node or not. For instance, I want to check if the focused `TextInput` is descendant of an specific `ScrollView`:

```js
const currentlyFocusedField = TextInput.State.currentlyFocusedField()
UIManager.viewIsAncestorOf(
  currentlyFocusedField,
  this.getInnerViewNode(),
  (isAncestor) => {
    if (isAncestor) {
      console.log('The focused field is a descendant of this ScrollView!')
    }
  }
)
```

This function uses the same strategy as the `measureLayout` method to check if one node is an ancestor of other node. As the `measureLayout` method, this is performed outside the main thread.

By now I've only implemented the iOS version and its tests, but if this function is going to be merged I'll implement the Android version too. I have objc experience but no Java or Android, so I prefer to validate this functionality before jumping into developing the Android part.
Closes https://github.com/facebook/react-native/pull/7876

Differential Revision: D3662045

Pulled By: javache

fbshipit-source-id: b9668e8ea94fd01db76651f16243926cf9c2566f
2016-08-03 04:13:43 -07:00
Artyom Trityak 5617d41327 ActivityIndicator Example ES6 classes migration and TimerMixin removal
Summary:
**This is the first part of `React.createClass` -> ES2015 classes migration.
1. Rewritten UI Explorer ActivityIndicator example to ES2015 classes
2. Removed TimerMixin from example.

Motivation:

- ES2015 classes do not support mixins so due to the classes / pure functions as "best practices" it would be better to avoid mixins in examples.

- TimerMixin is covered later and is out of scope of current example.
Closes https://github.com/facebook/react-native/pull/8342

Differential Revision: D3659349

fbshipit-source-id: e1c6f1a3091d60c589303fe6da55b8d132adedc3
2016-08-02 17:13:30 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
yueshuaijie 15bf2c57b8 Add TextInput.dataDetectorTypes prop.
Summary:
On iOS, if `TextInput` is used with prop `multiline={true}`, the backend view is `UITextView`. Sometimes we need `UITextView.dataDetectorTypes` to detect clickable url in the text view. The PR add this prop to `TextInput`, so we can use it like this:

`<TextInput`
`    defaultValue="Detect phone number: 88888888."`
`    editable={false}`
`    multiline={true}`
`    dataDetectorTypes="all"`
`    />`

Similar as #8743 .
Closes https://github.com/facebook/react-native/pull/8863

Differential Revision: D3648027

fbshipit-source-id: 987bd4f46fb5be74099b62988135a32115d9269c
2016-07-31 14:28:28 -07:00
Fadil Sutomo 63d15af18d Activity indicator: add size prop
Summary:
**motivation**

Previously, size can only accept either 'small' or 'large'. And to obtain a custom size, scale transformation is used. This is to let users to possibly pass number value directly to define ActivityIndicator's size.

**Test plan**

I have also modified the current example to reflect the new size prop in action.
Closes https://github.com/facebook/react-native/pull/8935

Differential Revision: D3637910

fbshipit-source-id: 6b8e1d4504964916df327b2d3eaaef1bb8cd5112
2016-07-28 15:28:43 -07:00
David Goldman fd48bc3cff Implement multi-source Images on iOS
Summary: Mirrors Android's support for multiple sources for Image, allowing us to fetch new images as the size of the view changes.

Reviewed By: mmmulani

Differential Revision: D3615134

fbshipit-source-id: 3d0bf2b75f63a4379e0e49f2dab9aea351b31d5f
2016-07-28 14:13:46 -07:00
sam 7971cca4f0 add UIExplorer example of SwipeableListView
Summary:
Q: Explain the **motivation** for making this change. What existing problem does the pull request solve?

A: There is no example for [`SwipeableListView`](https://github.com/facebook/react-native/tree/master/Libraries/Experimental/SwipeableRow) component, it would be helpful to add one.

**Test plan (required)**

Some screenshots here:

<img width="377" alt="screen shot 2016-07-14 at 21 47 50" src="https://cloud.githubusercontent.com/assets/1091472/16841629/af8392c4-4a0c-11e6-9f92-208aba514f36.png">

Tested on:

1. Simulators

    iPhone 4s, 5, 5s, 6, 6 Plus
Closes https://github.com/facebook/react-native/pull/8782

Differential Revision: D3624365

fbshipit-source-id: 76598ac69bca1dca6ae928d2d19c9f1384d8e161
2016-07-27 17:58:36 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
Sokovikov 857d2b8eae change lineBreakMode to ellipsizeMode
Summary:
lineBreakMode only in rc so I think we can replace property without any deprecation warnings. satya164
Closes https://github.com/facebook/react-native/pull/9008

Differential Revision: D3614901

fbshipit-source-id: 724227c0a89192825a24850b930b80884571a51f
2016-07-25 13:13:35 -07:00
SangYeob Bono Yu 3b35732800 Add Share module
Summary:
revision of https://github.com/facebook/react-native/pull/5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes https://github.com/facebook/react-native/pull/5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
2016-07-25 03:43:29 -07:00
Janic Duplessis 5903949ad6 Load local assets synchronously to prevent image flicker
Summary:
This uses `[UIImage imageNamed:]` to load local assets that are bundled using `require('../image/path.png')` and makes sure it is done synchronously on the main queue to prevent images from flickering. This improves user experience a lot when using large local images and prevents icon flickers to match the behaviour of most native apps.

This adds to methods to the ImageLoader protocol, one to tell if the image loader must be executed on the url cache queue and one to tell if the result of the image loader should be cached. I then use these to make the LocalImageLoader bypass the url cache queue and avoid caching images twice.

Note that this doesn't affect debug builds since images are loaded from the packager.

I'm not sure if we want to still support async loading of local images as I'm not sure how much of a perf difference this will make. Maybe someone at fb can benchmark this see how it affects your apps but there wasn't a noticeable one in mine. Also I only enabled this for loading png and jpg im
Closes https://github.com/facebook/react-native/pull/8102

Reviewed By: bnham

Differential Revision: D3433647

Pulled By: javache

fbshipit-source-id: 37bd6aff20c0465c163db3cdbcaeaedff55f7b1f
2016-07-21 07:58:51 -07:00
Emil Sjolander 1af9270e45 Revamp API
Reviewed By: majak

Differential Revision: D3579423

fbshipit-source-id: 040ecab2f20216aa136ccb8a9e7e15ffa882b313
2016-07-20 08:58:59 -07:00
Don Yu 12ec213c0d Add support for layout gravity to ToastAndroid
Summary: Add support for top, bottom, and center layout gravity to ToastAndroid

Reviewed By: AaaChiuuu

Differential Revision: D3590224

fbshipit-source-id: 84dbbcfbe4133f291d62723c5c261acd7b32b46e
2016-07-20 08:13:37 -07:00
Emil Sjolander 1aa7ad0ab8 CamelCase
Reviewed By: majak

Differential Revision: D3576069

fbshipit-source-id: cecda2cdb67f2f66ac92e336068d58731ccdb101
2016-07-20 06:43:32 -07:00
Tobias Ritzau d343eaabff Added the native animation demo to the android UIExplorer
Reviewed By: javache

Differential Revision: D3569816

fbshipit-source-id: ab03f3f3ad10b3921d428628c87e4091c07ceafe
2016-07-19 02:43:24 -07:00
sasaki takeru fa062aab14 fix UIExplorer build path
Summary:
UIExplorerApp.ios.js is moved into js directory.
Closes https://github.com/facebook/react-native/pull/8884

Differential Revision: D3586032

Pulled By: nathanajah

fbshipit-source-id: 93793681e33a0922e3d8503da3f1c0d01fd4fa93
2016-07-19 01:58:36 -07:00
Brent Vatne a564af853f Throw flow error when trying to access a style that is not defined on a stylesheet
Summary:
I thought it would be useful to help clear out references to no longer used styles and also catch typos on style names to have flow error when we try to access a style that isn't defined.

Example:

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because `continer` is misspelled
    return (
      <View style={styles.continer} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because no fancyContainer style is defined
    return (
      <View style={[styles.container, styles.fancyContainer]} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

All credit goes to jeffmo in this tweet: https://twitter.com/lbljeffmo/status/755179096271888385

Also included in the PR is some cleanup on styles that
Closes https://github.com/facebook/react-native/pull/8876

Differential Revision: D3584983

Pulled By: yungsters

fbshipit-source-id: 0ee0e12ff3d976c137d932688e323c26690e0a52
2016-07-18 23:28:25 -07:00
Ernest Walzel 83336130ef Fix minor typo in ListViewExample.js
Summary:
s/_renderSeperator/_renderSeparator/
Closes https://github.com/facebook/react-native/pull/8816

Differential Revision: D3580181

Pulled By: javache

fbshipit-source-id: e9cf35d50512b490efafa880f8d99ca13aa4df15
2016-07-18 10:30:53 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
Janic Duplessis df8c88e000 Fix UIExplorer entry file on iOS
Summary:
Files were moved to the js/ directory so UIExplorer did not work anymore on iOS, this fixes the path.
Closes https://github.com/facebook/react-native/pull/8841

Differential Revision: D3576752

fbshipit-source-id: 921ddc2e158ee0c74dcf691a32504900c5d79e1d
2016-07-17 01:43:28 -07:00
Nathan Azaria 87124383ac Changed JS location of examples to source from RCTBundleURLProvider instead.
Summary:
This changes the JS location of the examples (2048, UIExplorer, Movies, and TicTacToe) to be set from RCTBundleURLProvider instead.
This also makes the example apps run the bundle script, which makes the build time longer.

Reviewed By: javache

Differential Revision: D3516371

fbshipit-source-id: 70e53c62feb81c067df4e2298e7d1f1458777490
2016-07-15 10:13:29 -07:00
Pieter De Baets 0b6f0fcf55 Correctly specify run_tests for all apps in ci_config
Reviewed By: talah

Differential Revision: D3552776

fbshipit-source-id: 690ab316fa3dc761cf8f2903542ee6ed5cb15b37
2016-07-15 08:58:28 -07:00
Pieter De Baets 23e087fc26 Fix TextInput stack overflow when pasting text in multiline input with maxlength
Summary: When pasting text longer than maxlenght, the textDidChange: call we did would end calling back into textView:shouldChange: because we saw an unexpected multi-character change. Since this is an expected mutation, update predictedText appropriately.

Reviewed By: majak

Differential Revision: D3561524

fbshipit-source-id: 07bb78d830ccfa3aed6ee274dc30adeadce9e1f8
2016-07-14 07:43:32 -07:00
Janic Duplessis 5618c3ff09 Initial implementation of requestIdleCallback on iOS
Summary:
iOS follow up to #8569. This currently depends on the Android PR since it contains the JS implementation, only review the last commit. Just putting this out here for visibility, don't merge this before the Android PR.

**Test plan**
Tested by running a background task that burns all remaining idle time (see UIExplorer example).

Tested that native only calls into JS when there are pending idle callbacks.

Tested that timers are executed before idle callback.
Closes https://github.com/facebook/react-native/pull/8734

Differential Revision: D3560818

fbshipit-source-id: a28d3092377a7fd4331647148d40fe69e4198c7e
2016-07-13 22:58:30 -07:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.

- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.

** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.

Tested that native only calls into JS when there are pending idle callbacks.

Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```

I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569

Differential Revision: D3558869

Pulled By: astreet

fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba
2016-07-13 18:58:20 -07:00
Eric Vicenti 38157f0175 Fix UIExplorer List
Summary:
NavigationCardStack has a race condition when replacing routes quickly (like on keystrokes).

This change reverts some capability of the UIExplorerList but makes it feel nice for the meantime while we fix the issue in NavigationTransitioner. If we used flux/redux for UIExplorer, this issue would have been avoided.

Reviewed By: javache

Differential Revision: D3556035

fbshipit-source-id: 36b3e7b5abb1ec11cd68acda40db588920ff7e11
2016-07-13 14:28:45 -07:00
Philipp von Weitershausen 08c375f828 Add responseType as a concept to RCTNetworking, send binary data as base64
Summary:
In preparation for Blob support (wherein binary XHR and WebSocket responses can be retained as native data blobs on the native side and JS receives a web-like opaque Blob object), this change makes RCTNetworking aware of the responseType that JS requests. A `xhr.responseType` of `''` or `'text'` translates to a native response type of `'text'`. A `xhr.responseType` of `arraybuffer` translates to a native response type of `base64`, as we currently lack an API to transmit TypedArrays directly to JS. This is analogous to how the WebSocket module already works, and it's a lot more versatile and much less brittle than converting a JS *string* back to a TypedArray, which is what's currently going on.

Now that we don't always send text down to JS, JS consumers might still want to get progress updates about a binary download. This is what the `'progress'` event is designed for, so this change also implements that. This change also follows the XHR spec with regards to `xhr.response` and `xhr.responseText`:

- if the response type is `'text'`, `xhr.responseText` can be peeked at by the JS consumer. It will be updated periodically as the download progresses, so long as there's either an `onreadystatechange` or `onprogress` handler on the XHR.

- if the response type is not `'text'`, `xhr.responseText` can't be accessed and `xhr.response` remains `null` until the response is fully received. `'progress'` events containing response details (total bytes, downloaded so far) are dispatched if there's an `onprogress` handler.

Once Blobs are landed, `xhr.responseType` of `'blob'` will correspond to the same native response type, which will cause RCTNetworking to only send a blob ID down to JS, which can then create a `Blob` object from that for consumers.

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

Reviewed By: javache

Differential Revision: D3508822

Pulled By: davidaurelio

fbshipit-source-id: 441b2d4d40265b6036559c3ccb9fa962999fa5df
2016-07-13 04:58:37 -07:00
弘树 262397d5b1 Fix UIExplorer example AppDelegate.m for pre-bundle comment
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

UIExplorer example doc fix.

**Test plan (required)**

Unnecessary.

**Code formatting**

Just fix comment, not related to code

Fix pre-bundle doc
Closes https://github.com/facebook/react-native/pull/8733

Differential Revision: D3554930

fbshipit-source-id: 76ed3da17df840f90987f7468cea7cd65741313f
2016-07-13 02:13:24 -07:00
Pieter De Baets 2f73ca8f76 Cleanup UIExplorer folder
Summary: Move all JS to a js/ subfolder so we get some overview of this folder again.

Reviewed By: bestander

Differential Revision: D3542598

fbshipit-source-id: 7637133fe4152f4d39e461b443b38510272d5bc8
2016-07-12 05:59:13 -07:00
Pieter De Baets 81f59dfdc2 Remove code for testing without JS bundle
Reviewed By: mmmulani

Differential Revision: D3542347

fbshipit-source-id: d0dcfb65645faf515e6e48e6ff733646e1bcf907
2016-07-11 13:33:55 -07:00
Nathan Azaria defc34a28b Removed calls to RCTBundleURLProvider setDefaults
Reviewed By: javache

Differential Revision: D3534799

fbshipit-source-id: 0c784cd9a993c6379e49087906ebf670ddd4f8cd
2016-07-11 02:58:32 -07:00
Skotch Vail bcf4bb6edd Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK
Reviewed By: javache

Differential Revision: D3442470

fbshipit-source-id: 584a2bb3df5f7122166778b8fd44fae45560491e
2016-07-07 12:44:14 -07:00
Janic Duplessis 2537157d99 Implement TextInput onContentSizeChange
Summary:
This adds proper support for tracking a TextInput content size as discussed in #6552 by adding a new callback that is called every time the content size changes including when first rendering the view.

Some points that are up for discussion are what do we want to do with the onChange callback as I don't see any use left for it now that we can track text change in onChangeText and size changes in onContentSizeChange. Also a bit off topic but should we consider renaming onChangeText to onTextChange to keep the naming more consistent (see [this naming justification](https://twitter.com/notbrent/status/709445076850597888)).

This is split in 2 commits for easier review, one for iOS and one for android.

The iOS implementation simply checks if the content size has changed everytime we update it and fire the callback, the only small issue was that the content size had several different values on initial render so I added a check to not fire events before the layoutSubviews where at this point the value is g
Closes https://github.com/facebook/react-native/pull/8457

Differential Revision: D3528202

Pulled By: dmmiller

fbshipit-source-id: fefe83f10cc5bfde1f5937c48c88b10408e58d9d
2016-07-07 09:00:01 -07:00
Jeff Morrison 7795918eb4 Unrevert D3518381
Reviewed By: gabelevi

Differential Revision: D3522895

fbshipit-source-id: 52f28c7f3142566a07d8bc845be882aeda098809
2016-07-06 12:58:41 -07:00
Ian Childs 0fde81c816 Reverted commit D3518381
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 645c25191d5e7cff7689bd4dc583c478eba46496
2016-07-06 09:43:37 -07:00
Jeff Morrison a8e6a236cc fbobjc -> Flow v0.28
Reviewed By: gabelevi

Differential Revision: D3518381

fbshipit-source-id: 2dd5f89177aaefbd098ba1fd3c193da111ff14c7
2016-07-06 08:58:42 -07:00
Jing Chen 8c59644bf8 Reverted commit D3516105
Reviewed By: javache

Differential Revision: D3516105

fbshipit-source-id: 7454ffced51267a1b1fd9850f63bc3eba9868571
2016-07-05 14:13:23 -07:00
Nathan Azaria c12db8045c Removed calls to RCTBundleURLProvider setDefaults
Reviewed By: javache

Differential Revision: D3516105

fbshipit-source-id: ea92714378f3d2be189b59b1b76d3e689aeac4c7
2016-07-05 03:28:23 -07:00
Konstantin Raev bb0fda7d54 Revert PR-7825 snapshot changes
Summary:
Tests got broken after https://github.com/facebook/react-native/pull/7825, reverting changes
Closes https://github.com/facebook/react-native/pull/8508

Differential Revision: D3503439

Pulled By: bestander

fbshipit-source-id: 95b9283371654265234d975e1b0df540f4ef55fa
2016-06-30 07:28:21 -07:00
Hedger Wang e19fa82dd2 Add an example for Pager built with NavigationTransitioner & Animated.View
Summary:
Add an example for Pager built with NavigationTransitioner & Animated.View

This example demostrates how to apply pre-defined gesture handling and
animation styles to the <Animated.View /> to build a Pager navigator.

Reviewed By: ericvicenti

Differential Revision: D3495807

fbshipit-source-id: 08e275010888925bc9fd1840e7052f975c95ad63
2016-06-29 18:43:47 -07:00
Tucker Connelly 3d3b067f6f Add zIndex support
Summary:
Adds zIndex support :)

**Test Plan**

Tested the following components by adding two of each, overlapping them, and setting a high zIndex on the first of the two:

ActivityIndicator
Image
MapView
Picker
ScrollView
Slider
Switch
Text
TextInput
View
WebView

Tested on Android 4.1 and iOS 8.4. Also tested updating zIndexes on Views in my own app.

<img width="359" alt="ios activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633473/88f842cc-257b-11e6-8539-c41c0b179f80.png">
<img width="330" alt="android activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633475/88f95784-257b-11e6-80c0-2bf3ed836503.png">
<img width="357" alt="ios image" src="https://cloud.githubusercontent.com/assets/4349082/15633474/88f93d80-257b-11e6-9e54-4ff8e4d25f71.png">
<img width="340" alt="android image" src="https://cloud.githubusercontent.com/assets/4349082/15633478/88fd2788-257b-11e6-8c80-29078e65e808.png">
<img width="342" alt="android picker" src="ht
Closes https://github.com/facebook/react-native/pull/7825

Differential Revision: D3469374

Pulled By: lexs

fbshipit-source-id: b2b74b71d968ebf73ecfd457ace3f35f8f7c7658
2016-06-29 07:43:23 -07:00
Martín Bigio eafc5dac62 Add support for `drawableLeft` and `drawablePadding` props
Summary: Add support inlining images into text inputs. For now this is only available on Android.

Reviewed By: andreicoman11

Differential Revision: D3470805

fbshipit-source-id: 14db05ec4d5af549bf314b903654314f39bf73ea
2016-06-28 14:13:48 -07:00
alvaromb 9bd80cbc26 Added the ability to set an image title in the NavigatorIOS
Summary:
This pull request adds support for setting an image title in `NavigatorIOS`. It sets the `titleView` property of `UINavigationItem`.

Added an example into `UIExplorer`

<img width="487" alt="ex" src="https://cloud.githubusercontent.com/assets/289640/16147578/3d552606-3484-11e6-9a26-1e8c113ace03.png">

The code follows the same style as the rest of `RCTNavItem` and `RCTWrapperViewController`.
Closes https://github.com/facebook/react-native/pull/8182

Differential Revision: D3469073

Pulled By: javache

fbshipit-source-id: 2d3e4bad534f92b6e6b24a6b74f2993f3a8c9012
2016-06-23 08:28:30 -07:00
Mike Lambert 6cd712713b Support selectable={true} property on Text fields on Android.
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

This adds support for a text field that the user can click-and-drag to select text (which can then be copied using the native selected-text-hover-widget).

I'd love to add this to iOS too, but iOS appears to draw glyphs directly to the screen for its <Text> widget (versus using UITextField), so it might be too difficult to support there. But at least I can support my Android users with this change.

Let me know if/what kind of "demonstrate the code is solid" you would like for this. A screenshot of selected text with this property set?
Closes https://github.com/facebook/react-native/pull/8028

Differential Revision: D3474196

Pulled By: bestander

fbshipit-source-id: 8d3656681265a0e6229bfa13ff2ae021e894d3cd
2016-06-22 19:13:32 -07:00
Emil Sjolander dc5b4903dd Fix ListViewGridLayoutExample Fixes #8248
Reviewed By: javache

Differential Revision: D3469544

fbshipit-source-id: 6fad3a7b6f7cafbb833818b7b7a3afb3e127bbcf
2016-06-22 08:43:27 -07:00
Janic Duplessis 4c83237511 Add Image resizeMode repeat on iOS
Summary:
This adds a new resize mode for iOS 'repeat' that tiles the image over it's frame. This allow to easily create a view with a repeating background pattern which there is no way to do at the moment without including a bunch of different sized assets.

I'm not 100% sure it should be a resizeMode or a separate prop but I went with resizeMode since it made more sense to me and the are not really any use cases where we'd want to use this with another resizeMode other than 'stretch'.

**Test plan**

Tested mainly by adding a UIExplorer example, also tested that changing the resizeMode prop from and to 'repeat' worked properly.
![screen shot 2016-06-07 at 3 06 17 am](https://cloud.githubusercontent.com/assets/2677334/15848755/d95d8046-2c5c-11e6-9f3d-1ce8a1c9c846.png)

I'd like to implement this on Android too but it is a bit trickier since Fresco's ImageView doesn't support image tiling and would require submitting a PR there too :(
Closes https://github.com/facebook/react-native/pull/7968

Differential Revision: D3469119

Pulled By: javache

fbshipit-source-id: ab9dbfe448a5b0771dbf0c41fcceeb366210f583
2016-06-22 04:28:44 -07:00
Hedger Wang bdb8efdd66 Add example for <NavigationTransitioner />
Summary:
Add an example for <NavigationTransitioner /> that shows how to use
<NavigationTransitioner /> and <Animated.View /> to build a stack of
animated scenes that render the navigation state.

This also defines the generic method for NavigationTransitioner to render scenes.

Reviewed By: ericvicenti

Differential Revision: D3422322

fbshipit-source-id: b9ff4c5102442a110739a546565552496349d473
2016-06-21 14:28:41 -07:00
Krzysztof Magiera a59afb98d5 Decompose transform matrix in native (for android).
Summary:
This diff translates implementation of transform matrix decomposition from JS to java. This is to support offloading animations of transform property, in which case it is required that we can calculate decomposed transform in the UI thread.

Since the matrix decomposition code is not being used for other platform I went ahead and deleted parts that are no longer being used.

**Test plan**
Run UIExplorer Transform example before and after - compare the results
Closes https://github.com/facebook/react-native/pull/7916

Reviewed By: ritzau

Differential Revision: D3398393

Pulled By: astreet

fbshipit-source-id: 9881c3f565e2050e415849b0f76a0cefe11c6afb
2016-06-21 11:28:29 -07:00
leeight dcc2abc1f6 Fix Examples/{UIExplorer,Movies}
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

UIExplorerActivity.java and MoviesActivity.java should override `getReactNativeHost` method. And this PR will fix https://github.com/facebook/react-native/issues/8215.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/8223

Differential Revision: D3456957

fbshipit-source-id: cc0b51e5bfaec71d210bfba81b1f7cd06a723d8c
2016-06-20 08:43:29 -07:00
Andrei Coman b7352b4667 Open source permissions
Summary:
This moves into open source the PermissionsModule and the activity and listener interfaces
necessary to make permissions work.
It also moves the PermissionsExample into the UIExplorer. In order to make this
work, the device has to be Android M and above, and the target sdk of the app has to be 23+, so I changed the uiexplorer manifest to
target that API. This has the unfortunate consequence that people testing on
devices with API 23+ will have to enable the `draw over other apps` setting that
react needs for RedBoxing. The app will automatically send the user to that screen,
so enabling the setting and resuming the app should be trivial.
For testing, try requesting permission for a permission that is currently
revoked. If a permission is granted, it can be revoked via adb (`adb shell pm
revoke com.your.app android.permission.PERMISSION_NAME`), and then requested.

Reviewed By: bestander

Differential Revision: D3431324

fbshipit-source-id: 8cbaea676d2b5727cb5191cdb77a02e213bf9ba3
2016-06-15 09:43:58 -07:00
Hedger Wang 4ab1bcb124 Fix typo, rename NavigationHeaderScenesTabs-example.js. to NavigationExperimental/NavigationCardStack-NavigationHeader-Tabs-example.js
Summary:
- Fix typo.
- rename NavigationHeaderScenesTabs-example.js. to NavigationExperimental/NavigationCardStack-NavigationHeader-Tabs-example.js

Differential Revision: D3431559

fbshipit-source-id: 25cd0837efced2156d608577ee7c383009c2de24
2016-06-14 16:28:47 -07:00
Janic Duplessis 4c245160bd Replace deprecated ActivityIndicatorIOS and ProgressBar with ActivityIndicator
Summary:
This replaces ActivityIndicatorIOS and indeterminate ProgressBar that were deprecated recently with ActivityIndicator across the codebase and examples and a few other cleanups.

This also make a small tweak to ActivityIndicator so it uses the Android theme color instead of gray when no color is specified.

Use Slider instead of SliderIOS in CameraRoll example.

Remove the line about unifying ActivityIndicator and ProgressBar.

**Test plan**
Tested the affected components in UIExplorer on iOS and Android, tested the changes made in Movies example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/8082

Differential Revision: D3429770

fbshipit-source-id: 3b2e1196a8b9fe00d47a7aa1bbc079b094796421
2016-06-13 22:28:24 -07:00
Andrei Coman 617a38d984 Support multi sources for images
Summary:
This adds support for specifying multiple sources for an image component, so that native can choose the best one based on the flexbox-computed size of the image.
The API is as follows: the image component receives in the `source` prop an array of objects of the type `{uri, width, height}`. On the native side, the native component will wait for the layout pass to receive the width and height of the image, and then parse the array to find the best fitting one. For now, this does not support local resources, but it will be added soon.
To see how this works and play with it, there's an example called `MultipleSourcesExample` under `ImageExample` In UIExplorer.

Reviewed By: foghina

Differential Revision: D3364550

fbshipit-source-id: 66c5aeb2794f2ffeff8da39a9c0b95155fb2d41f
2016-06-13 14:13:25 -07:00
Sokovikov c03b166854 line break mode for ios
Summary:
What do you think is ```lineBreakMode``` a good name? For android it is called ```ellipsize```.

<img src="https://cloud.githubusercontent.com/assets/1488195/15628555/7372f8d0-250c-11e6-8919-722f28a38d60.png"" width="300" />
Closes https://github.com/facebook/react-native/pull/7819

Differential Revision: D3417256

fbshipit-source-id: 189441a23ff554bf7f6d67fa8510959351e9e5cc
2016-06-10 04:28:37 -07:00
Fabian Eichinger d43e0db81e Add support for reverse flex directions on Android and iOS
Summary:
This PR adds support for both 'row-reverse' and 'column-reverse' for Android and iOS and is based on the changes in #6683 that looked like it's all but abandoned.
It also adds examples for the new directions to the "Layout - Flexbox" section of UIExplorer as well as some rad new colors to the section to make the difference between "row-reverse" and "flex-end" more apparent.

**Test plan (required)**
Tested inside of UIExplorer

Android
<img width="571" alt="screen shot 2016-06-05 at 7 42 14 pm" src="https://cloud.githubusercontent.com/assets/4332237/15807140/cf8e05de-2b55-11e6-9366-a2e3194cabf8.png">

iOS
<img width="578" alt="screen shot 2016-06-05 at 7 41 35 pm" src="https://cloud.githubusercontent.com/assets/4332237/15807143/dee8e9b8-2b55-11e6-8777-c30329fa54e8.png">
Closes https://github.com/facebook/react-native/pull/7938

Differential Revision: D3417182

fbshipit-source-id: e8c9f5976ca95b2d2069a5b31a20f6d6309eb3cc
2016-06-10 03:28:45 -07:00