Summary:
As per janicduplessis recommendation, provide a new synchronous method to replace the necessary synchronous calls and use a warning in the comments (and method name).
**Motivation**
There are currently a number of XCode warnings that show up in a fresh 0.40 install of a react native project. While the project can still be run, this contributes negatively to the development experience -- valid warnings may be ignored and new ones may be added as per https://en.wikipedia.org/wiki/Broken_windows_theory
This addresses one of the warnings, by providing the functionality of a deprecated method in two specific cases where we can't avoid doing synchronous work on the main queue. See https://github.com/facebook/react-native/issues/11736 for more context.
**Test plan (required)**
I ran a project that relied on screen size and it didn't crash...happy to do more involved testing if someone can share better methodology.
Closes https://github.com/facebook/react-native/pull/11817
Differential Revision: D4402911
fbshipit-source-id: 9fd8b3f50d34984b765fe22b1f4512e103ba55a9
Summary:
Fixes the build warning:
```react-native/React/Modules/RCTRedBox.m:406:58: Conversion from value of type 'NSArray<RCTJSStackFrame *> *' to incompatible type 'NSArray<NSDictionary *> *```
This appears because the compiler is left to infer the type of `stack`, and it does so as `NSArray<RCTJSStackFrame *>` based on [RCTRedBox.m#L390](https://github.com/facebook/react-native/blob/master/React/Modules/RCTRedBox.m#L390). In reality `stack` may be either of two types and the function body deals with normalisation.
Mark the stack as explicitly `NSArray<id>` to prevent inference so we're free to make the decision to cast to more specific types.
Closes https://github.com/facebook/react-native/pull/11807
Differential Revision: D4402916
fbshipit-source-id: 356343f244af7638b9b9e91c2c5b7e68de0cbd33
Summary:
`UIActivityViewConroller.completionHandler` has been [deprecated](https://developer.apple.com/reference/uikit/uiactivityviewcontroller/1622010-completionhandler) since iOS 8, when it was replaced by `completionWithItemsHandler`.
Tested the build using `UIExplorer` and XCode 8.2 but I've never seen and can't work out how to activate the `UIActivityViewController` this method relates to, so I haven't tested a real run.
Closes https://github.com/facebook/react-native/pull/11798
Differential Revision: D4396618
fbshipit-source-id: 92a993c434637ede2d5779f4154feb00d2c78d06
Summary:
Motivation: reduce build noise that might worry new users or hide real problems.
This deals with four of the warnings currently in the iOS build. The `__unused` additions are standard and self-explanatory, following the style used elsewhere in RN. I've used `#pragma unused` to deal with parameters named by macros.
Tested by building and running the `UIExplorer` example app in XCode 8.2
Closes https://github.com/facebook/react-native/pull/11797
Differential Revision: D4396611
fbshipit-source-id: 728e9ebb94d147f7a2cbc674a25fe67e66e2e8b2
Summary:
This fixes a broken link in the docs.
Closes https://github.com/facebook/react-native/pull/11453
Differential Revision: D4394773
Pulled By: lacker
fbshipit-source-id: 07b3aaa25017912063ac9e65f336c56a902d7144
Summary:
Sending global events with `eventDispatcher` has been [deprecated](d9737571c4) since 0.28, with a recommendation to subclass `RCTEventEmitter` instead, but there were no docs for this.
This updates the iOS native module to use the recommended way, and also documents the use of `stopObserving` and `startObserving`.
Tested and working in a real app.
cc nicklockwood
Closes https://github.com/facebook/react-native/pull/11792
Differential Revision: D4394626
fbshipit-source-id: 68b26d35944a521bf683a50ec1ab21f03b5e99d8
Summary:
Adds a high performance source map builder that has certain restrictions compared to the `'source-map'` package:
- mappings have to be in the order of the generated source
- source files have to be started/ended separately on the generator. That means building up mappings is optimized for blocks of mappings that all belong to the same source file (or no file)
The implementation avoids allocation of complex value, i.e. strings and objects as much as possible by preallocating a buffer and using numeric character values throughout. The buffer is converted to a string only at the end.
This implementation is ~5✕ faster than using `'source-map'`.
Reviewed By: jeanlauliac
Differential Revision: D4392260
fbshipit-source-id: 406381302d951b919243a2b15e8bb75981e9f979
Summary: Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a enum). Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
Reviewed By: cwdick
Differential Revision: D4392272
fbshipit-source-id: 22b92ac8f3eb7114e81dbd9b0bec9044c3d43da5
Summary:
This is step one on merging the `rnpm` config with the `cli config`. The plan is to remove two sources of truth (rnpm package.json config and rn-cli Javascript config)
Rationale:
As of now, we have `rnpm` config, that used to live in the `local-cli/core/config/index.js` and the `rn-cli` config, living in `default.config.js` and `utils/Config.js`.
This PR moves all the things into one file, called `local-cli/core', simplifies things, enhances types (Config now has better types, added missing properties and fixed descriptions).
One notable addition is that users can now opt-in to override the commands that are loaded at the package level. Previously it was only possible to add a command by writing a plugin. Now, you can just tweak the `rn-cli.config.js`.
This is one of the several improvements I have on my roadmap, with better documentation for the CLI as well.
Closes https://github.com/facebook/react-native/pull/11564
Differential Revision: D4360095
fbshipit-source-id: feaec7c88df63e51cef1f9620c7eedeb738d3d00
Summary:
Currently, while running `react-native run-android` command, React Native's packager is launched, and there is not any way to disable the current behaviour. This is handled somehow on iOS by adding an environment variable `RCT_NO_LAUNCH_PACKAGER` (see #6180).
This is a cross-platform solution that adds the `--no-packager` option both to `run-ios` and `run-android`, which prevents the packager from being launched.
This was tested by building with and without the option, on both environments (Android and iOS) using the device and simulator, working as expected.
Closes https://github.com/facebook/react-native/pull/11735
Differential Revision: D4392170
Pulled By: ericvicenti
fbshipit-source-id: 1c31f109f18715b84cd5ab1b6d5fd758cd0a6efb
Summary:
Hello,
This PR adds a property to the `ListView` to enable and disable to sticky sections headers behaviour. Current this is enabled by default and there is no way to disable it. It has been previously discussed in #1974 where there was a suggestion to add the `ListView` inside `ScrollView`. This is bad for performance, but some people were using that as a workaround. satya164 suggested someone submitting a PR, which is why I'm here 😉
I have tested the property manually by adding `stickySectionHeaders={false}` to the `<ListView> Paging` example in `UIExplorer`. I have also tested that the current behaviour still stands, so this is a non-breaking change.
I have also checked that the website displays the new documentation.
I couldn't see anywhere to add automated tests to this, but if there is feel free to point it out and I'll update this PR.
I tried running `npm run lint` to check the code style, but it spat out loads and loads of errors. I presume I have something set up incorrectly. Feel
Closes https://github.com/facebook/react-native/pull/11700
Differential Revision: D4380916
fbshipit-source-id: 7782043afc9f0108c81f97952fed60b153479cac
Summary:
This PR adds the `testID` prop to the `Button` component in order to allow end-to-end tests.
Closes https://github.com/facebook/react-native/pull/11526
Differential Revision: D4392137
Pulled By: ericvicenti
fbshipit-source-id: d3f864aacee319e520af226cd063edef452f6fc8
Summary:
I see there is a string matching inconsistency in `Libraries/CustomComponents/Navigator/Navigator.js` and `Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js`, which caused a bug resulting in gestures not working for vertical SceneConfigs. This PR fixes the inconsistency, and the bug.
**Motivation for making this change**
When working with the navigator, I was using the `VerticalUpSwipeJump` Navigator SceneConfig. The gesture to pop to the previous scene (in this case `jumpBack`) was not working.
**How I tested?**
I changed these strings (as shown in this PR) and swiped down. After these changes, everything worked as expected.
**Example**
In `Libraries/CustomComponents/Navigator/Navigator.js`, we check for gesture direction strings `bottom-to-top` and `top-to-bottom` in multiple places, but nowhere do we ever check for `up-to-down` and `down-to-up`.
```
var isTravelVertical = gesture.direction === 'top-to-bottom' || gesture.direction === 'bottom-to-top';
var isTravelInverted =
Closes https://github.com/facebook/react-native/pull/11192
Differential Revision: D4392103
Pulled By: ericvicenti
fbshipit-source-id: fd80578031f94b1b409815481c82e481c7ff2f13
Summary:
It seems that the `requestPermission` and `checkPermission` APIs from PermissionsAndroid have been deprecated in react-native 0.40.0., but they are still used in the description and example.
This commit updates the description and the example to use the new APIs.
Closes https://github.com/facebook/react-native/pull/11722
Differential Revision: D4392031
Pulled By: ericvicenti
fbshipit-source-id: e3ceebb1ef557e05dab40bb883013be4ec80bed6
Summary:
In Android, components using an elevation > 0 are able to hide the YellowBox. Especially bad when they happen to hide the dismiss button of the inspector.
Closes https://github.com/facebook/react-native/pull/11777
Differential Revision: D4392027
Pulled By: ericvicenti
fbshipit-source-id: 96ab98520cd54b9bb683d984f9990bf0e90b9a37
Summary:
I noticed that after starting a new game the board is not correctly layouted:
![-08-2017 21-39-21](https://cloud.githubusercontent.com/assets/3778452/21752532/06afc648-d5eb-11e6-9f8a-ccdad00d3a6f.gif)
Maybe this bug was introduced after the change of flex behaviour in 0.36.
Just replacing empty view with null fixed it.
**Test plan (required)**
- launch the TicTacToe app
- complete a round
- press on new game
a new board should be centred both vertically and horizontally
Closes https://github.com/facebook/react-native/pull/11775
Differential Revision: D4392024
Pulled By: ericvicenti
fbshipit-source-id: d2742d6ecafd786c38212adeb3c952f18a0e6f2b
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322
Reviewed By: cosmin1123
Differential Revision: D4391434
Pulled By: emilsjolander
fbshipit-source-id: e33f6f7b2bbaad29553100b7a5bb424496372110
Summary:
Compared to what was planned, I added the `overflow` value which seemed missing. I had to modify the implementation a bit for all values which are backed by a `YGValue`, but we should probably enable the pixel dimensions in Objective-C and Swift somehow later.
Closes https://github.com/facebook/yoga/pull/322
Reviewed By: dshahidehpour
Differential Revision: D4386906
Pulled By: emilsjolander
fbshipit-source-id: 05ac0e571ef3a8ff0be31469e449a7b23f102218
Summary:
Currently, < WebView > allows you to pass JS to execute within the view. This works great, but there currently is not a way to execute JS after the page is loaded. We needed this for our app.
We noticed that the WebView had messaging support added (see #9762) . Initially, this seemed like more than enough functionality for our use case - just write a function that's injected on initial load that accepts a message with JS, and `eval()` it. However, this broke once we realized that Content Security Policy can block the use of eval on pages. The native methods iOS provide to inject JS allow you to inject JS without CSP interfering. So, we just wrapped the native methods on iOS (and later Android) and it worked for our use case. The method injectJavaScript was born.
Now, after I wrote this code, I realized that #8798 exists and hadn't been merged because of a lack of tests. I commend what was done in #8798 as it sorely solves a problem (injecting JS after the initial load) and has more features than what I'
Closes https://github.com/facebook/react-native/pull/11358
Differential Revision: D4390425
fbshipit-source-id: 02813127f8cf60fd84229cb26eeea7f8922d03b3
Summary:
RCTRootView supports a property `passThroughTouches` which when set, allows
touches to propagate to sibling views. To allow touches to reach RCTRootView,
we also need to set `pointerEvents` on the RCTViews wrapping the child views.
Reviewed By: javache
Differential Revision: D4385443
fbshipit-source-id: 6291d8614870168f1c4cdf0ef5ff6e42e4a8ef63
Summary:
Currently the master Podspec is broken because tvOS files are being included, to avoid this compile error the file is being excluded.
c92ad5f6ae
Thats the commit which introduced the breakage anything later that that will fail. Aka RN 0.41 will fail because of this.
**Test plan (required)**
Tested on new project against master
// cc ide
Closes https://github.com/facebook/react-native/pull/11667
Differential Revision: D4375453
Pulled By: ericvicenti
fbshipit-source-id: 035cdb8ef36054b40d1aaf59551cdc2e16f0cb19
Summary:
Update docs to prevent build process from failing when collaborators do not have MYAPP_RELEASE_STORE_FILE in their env.
Build process often fails when following the existing documentation on setting the signingConfigs in build.gradle, as not all collaborators have the required ENV set in their gradle.properties
Closes https://github.com/facebook/react-native/pull/11716
Differential Revision: D4389150
Pulled By: hramos
fbshipit-source-id: 37941382950fac41f19d19317f49769588b135b4
Summary:
Delivery.com is a well known local delivery app that heavily uses React Native.
Want to get Delivery.com iOS and Android apps featured!
Closes https://github.com/facebook/react-native/pull/11752
Differential Revision: D4388844
Pulled By: hramos
fbshipit-source-id: 9e5915d357be445af4f3a92c59791586651d3405