Summary:
We currently have iOS and Android existing app integration guides. I have revamped these into a single tutorial, with three sections: Objective-C, Swift and Android.
For Objective-C and and Swift, the tutorial is now based on a more real world app - integrating a React Native-based high score screen into a 2048 app.
For expediency to get the iOS stuff out, for Android, *for now*, I have kept the existing documentation (with minor updates), but am planning to try to follow the same 2048 model for it as well.
This uses the same toggler as Getting Started
> I do note the copypasta of the toggler code. I am planning another separate pull request to make that more modular and reusable across all areas of the documentation on which it seems reasonable.
<img width="1277" alt="screenshot 2016-05-25 15 34 27" src="https://cloud.githubusercontent.com/assets/3757713/15558448/13c0aa1a-228f-11e6-9f38-5117d5824b84.png">
<img width="1260" alt="screenshot 2016-05-25 15 40 50" src="https://cloud.githubusercont
Closes https://github.com/facebook/react-native/pull/7764
Differential Revision: D3444455
Pulled By: JoelMarcey
fbshipit-source-id: 73dcdadd912177bb83b29099ff857046bf495939
Summary: I noticed sometimes the swipeable row prioritizes the list view's vertical scroll too much, or returns to closed position if swiped a little distance but at high velocity. These new thresholds help both cases.
Reviewed By: hedgerwang
Differential Revision: D3441994
fbshipit-source-id: 84a9fdf63a33b3047a9a0205e87d8c489e9a6631
Summary: the default child alignment of 'stretch' is not compatible with flexWrap:'wrap'. By aligning children to the start of the container we fix this.
Reviewed By: jingc
Differential Revision: D3436864
fbshipit-source-id: ead5a5765ed0c336ed6e727af2970d4e6d7ff34f
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
Summary:
Some changes are required to this scripts in order to successfully run it on Sandcastle:
- the packager needs to be started before the test, doing this only when not running in Travis
- no xcpretty available, piping to anything else (e.g. `cat`) fails
Closes https://github.com/facebook/react-native/pull/8127
Differential Revision: D3437268
Pulled By: avaly
fbshipit-source-id: a0a52f08b31f50b88f5d0fd4d9d6c827df179d71
Summary:
Issue we were seeing: scrollview would clip its cells when it was resized to 0 height and moved offscreen, but it wouldn't add it back when it was resized and moved back
Why this was happening: scrollview wouldn't rerun its un/clipping logic after the first run unless 1/it has 0x0 frame or 2/it has been scrolled. Neither was happening here.
Fix: run the un/clipping logic when scrollview's frame has been changed since the last clipping.
Reviewed By: javache
Differential Revision: D3436996
fbshipit-source-id: 1a8cfeb72b425fcc80815d30743fa308b9c75ab6
Summary:
Some changes are required to this scripts in order to successfully run it on Sandcastle:
- the packager needs to be started before the test
- no xcpretty available, piping to anything else (e.g. `cat`) fails
Closes https://github.com/facebook/react-native/pull/8123
Differential Revision: D3436833
Pulled By: avaly
fbshipit-source-id: e284d6eaf370720b9a0f2468b114a596028f7107
Summary:
Currently, DevTools only work under ios (although this is undocumented!), because the JavaScriptEngine initialization process skips setupDevTools() on android.
DevTools work fine with Android, as tested on 0.26, 0.27, and 0.28 using Nuclide's inspector.
For reference, [the relevant issue on react-devtools](https://github.com/facebook/react-devtools/issues/229).
Closes https://github.com/facebook/react-native/pull/8095
Reviewed By: bestander
Differential Revision: D3430206
Pulled By: javache
fbshipit-source-id: 76f19407271a3779e12bd244f1bc31ef3a8659c7
Summary:
Some changes are required to this scripts in order to successfully run it on Sandcastle:
- the packager needs to be started before the test
- no xcpretty available, piping to anything else (e.g. `cat`) fails
Closes https://github.com/facebook/react-native/pull/8123
Differential Revision: D3436833
Pulled By: avaly
fbshipit-source-id: 893ac5cba4197cf5bb6b492701171910fd10f99d
Summary:
Currently, DevTools only work under ios (although this is undocumented!), because the JavaScriptEngine initialization process skips setupDevTools() on android.
DevTools work fine with Android, as tested on 0.26, 0.27, and 0.28 using Nuclide's inspector.
For reference, [the relevant issue on react-devtools](https://github.com/facebook/react-devtools/issues/229).
Closes https://github.com/facebook/react-native/pull/8095
Reviewed By: bestander
Differential Revision: D3430206
Pulled By: javache
fbshipit-source-id: 826f0252fff3f0ec2c843149540a0109e34d1d18
Summary:
This defines the generic function prop `render(props: NavigationTransitionProps)`
to NavigationTransitioner, which enables developer to render scenes, header, overlay,
underlay...etc.
Differential Revision: D3431478
fbshipit-source-id: 93dbc7da23ad8c95565b01f7865d1e8dfd4401f7
Summary:
We're seeing sporadic "CGContext...: invalid context 0x..." error messages during snapshot runs of our product build. This also seems to happen sometimes when building RN, see for instance: https://www.google.nl/search?q=site%3Atravis-ci.org%2Ffacebook%2Freact-native%20CGContextSaveGState%20invalid%20context
Our guess is that at some point, the CGContextRef is autoreleased. We tried retaining the ref first, but eventually settled for pushing/popping the context as it never fails in our tests (retaining still causes seemingly unrelated failures).
We're not sure if we can provide a testplan for this change, as the FBSnapshotTestController is not tested separately.
Closes https://github.com/facebook/react-native/pull/8098
Differential Revision: D3431043
fbshipit-source-id: 61b9a7a849a020f6b8671d63781eed9418d409dc
Summary:
The tutorial has moved to a different URL, so the link currently ends up at the getting started page.
I also changed the remaining non-HTTPS urls in README.md to use HTTPS after checking they supported it. And I changed the Addons.Mozilla.org link to a language-agnostic one.
Closes https://github.com/facebook/react-native/pull/8047
Differential Revision: D3430542
Pulled By: javache
fbshipit-source-id: 4c5ccea9a5720126870a5df1be5073a6cc2f34ae
Summary:
**Motivation:**
Lots of examples on the web still have the old way to import React APIs from React Native. Also when someone upgrades to latest version of React Native without reading the release notes can get confused. This PR adds getters for `createClass` and `Component` and throws an error with a better error message when they are accessed.
![screenshot_20160614-125622](https://cloud.githubusercontent.com/assets/1174278/16034600/47c70222-3230-11e6-9fe4-1a3493708829.png)
**Test plan:**
Trying to use `ReactNative.createClass` or `ReactNative.Component` will throw an error with this error message.
There's currently a bug in `symbolicateStackTrace` which actually crashes the app after showing the error due to the `stack` being null when updating the stack trace. But that's a separate issue which should be fixed separately. For now, to prevent the crash, we need to add the following before the return statement here - https://github.com/facebook/react-native/blob/master/Libraries/JavaScriptAppEn
Closes https://github.com/facebook/react-native/pull/8099
Differential Revision: D3430468
Pulled By: javache
fbshipit-source-id: c098e51e1f2c276d87eca6da3bd91a457d7840c5
Summary:
We already do this on Android, and it allows uw to avoid doing this global object lookup for every call. Since there's only a couple of global functions we ever call, we should consider caching all of them in the new bridge.
I didn't ValueProtect/ValueUnprotect since these are already globals, and those methods are not exposed on the JSC wrapper.
Reviewed By: mhorowitz
Differential Revision: D3411487
fbshipit-source-id: 7feaf8803665b77d649e84edad875d31c5acee4b
Summary:
This is particularly important when using generated xcode project together with cocoapods (or anything that leverages a custom xcconfig)
If we do not set `$(inherited)`, then user will get cryptic "Symbol(s) not found for architecture ..." errors that will be really difficult to track down, especially for beginners. This happens because without setting `$(inherited)` we are essentially overriding settings provided on project level (rather than target level) as well as `.xcconfig` level.
**Test plan (required)**
```bash
react-native init MyProject
cd ios
pod init
```
Now go and add a pod to the `Podfile`, say
```ruby
pod 'HockeySDK'
```
And try to use it in `AppDelegate.m`
```objc
...
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
[[BITHockeyManager sharedHockeyManager] startManager];
```
Before this change, you'll get errors like this
![image](https://cloud.githubusercontent.com/assets/696842/15801450/feb3c036-2a4
Closes https://github.com/facebook/react-native/pull/7927
Differential Revision: D3430228
Pulled By: javache
fbshipit-source-id: ef453ad2e822726db0159d24ec93e301192e21de
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
Summary:
Implemented automatic IP detection for iOS, based on #6345 and #6362.
As the previous pull requests did, this works by writing the IP address of the host to a file.
Closes https://github.com/facebook/react-native/pull/8091
Differential Revision: D3427657
Pulled By: javache
fbshipit-source-id: 3f534c9b32c4d6fb9615fc2e2c3c3aef421454c5
Summary:
`polyfillLazyGlobal` used a top level this which get stripped by babel `transform-es2015-modules-commonjs` with the default config. This is mainly an issues for people not using the react native babel preset.
This also replaces a few GLOBAL with global for consistency with the rest of the file.
**Test plan**
Tested that there was an error when using `['transform-es2015-modules-commonjs', { strict: true, allowTopLevelThis: false }]` in the babel config and that it was fixed after applying my changes.
Fixes#7700
Closes https://github.com/facebook/react-native/pull/7971
Differential Revision: D3427675
Pulled By: javache
fbshipit-source-id: 48f258b0db1bf21185193bd56df453ced9242e64
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