Compare commits

...
Author SHA1 Message Date
Mike Grabowski a9357ccdbd [0.40.0] Bump version numbers 2017-01-04 12:08:04 +01:00
Anton KarpovandMike Grabowski 54786493d7 fix babel 'strict mode' error
Summary:
need to remove function declaration in a lexically nested statement
because babel uses 'use strict' by default now
Closes https://github.com/facebook/react-native/pull/11390

Differential Revision: D4308275

fbshipit-source-id: 0d073361d25b23fb67f001225feb72532af38683
2017-01-04 12:07:56 +01:00
Konstantin Raev 4e2166b4f0 [0.40.0-rc.6] Bump version numbers 2016-12-29 12:14:06 +00:00
Konstantin Raev 951c1af809 Disabled unit tests that need yoga libs when running
Reviewed By: hramos

Differential Revision: D4346826

fbshipit-source-id: 70855a44b27d25e49615914a845cf04fc63e322d
2016-12-29 11:57:43 +00:00
James Ide 32249e419d [0.40.0-rc.5] Bump version numbers 2016-12-28 22:46:19 -08:00
Konstantin RaevandJames Ide 6ab5a175ca boost is downloaded from https://github.com/react-native-community/boost
Summary:
Improvement over https://github.com/facebook/react-native/pull/11469.
Depends on https://github.com/react-native-community/boost-for-react-native/issues/1, **don't merge before it is fixed**.

It would be more in line with other dependencies  to depend only on github for thirdparty bridge dependencies.

**Test plan (required)**

- Circle (testing with caches cleaned)
- ./gradlew ReactAndroid:packageReactNdkLibsForBuck (check twice to make sure caches work)
REACT_NATIVE_BOOST_PATH=./path-to-local-boost/
- ./gradlew ReactAndroid:packageReactNdkLibsForBuck (check twice to make sure caches work)
Closes https://github.com/facebook/react-native/pull/11511

Differential Revision: D4348098

fbshipit-source-id: 5c2f25cc395ae0cad19d56b7c0b2b102513580fb
2016-12-28 22:46:18 -08:00
Konstantin RaevandJames Ide 4a2d8d4831 Switched to npm hosted boost lib
Summary:
Boost is officially hosted on SourceForge which has ab SSL problem that Gradle complains about and also it is sometimes unavailable.
I switched to using npm hosted (yarnpkg mirrored for performance) boost lib exactly the same as from Source Forge.

Other alternatives considered:
- CDN e.g. mirror.nienbo.com started responding with 4XX code when requested by Gradle
- File sharing like DropBox are not for mass anonymous downloads
- Github is not good for binary files and is throttled for anonymous raw file downloads
- S3 or similar. Requires amazon account for maintenance and does not expose semver API and other nice features that npm has

In the future I'd like to try Yarn as dependency management tool for bridge builds, this could be the first step.

**Test plan (required)**

- Circle (testing with caches cleaned)
- `./gradlew ReactAndroid:packageReactNdkLibsForBuck` (check twice to make sure caches work)
- `REACT_NATIVE_BOOST_PATH=./bridge-dependencies/node_modules/boost-react-native-bundle ./
Closes https://github.com/facebook/react-native/pull/11469

Differential Revision: D4339446

Pulled By: mkonicek

fbshipit-source-id: ccc9196e9b675c16a235a318c4861aaa4e263d6e
2016-12-28 22:46:18 -08:00
James Ide bcdf00ef33 [Podspec] Make Core subspec use a Ruby string array for exclude_files 2016-12-28 22:25:45 -08:00
Tomas RoosandJames Ide 2debfa1429 Updated imports to libyoga*.a in HelloWorld
Summary:
Fixes #11605

HelloWorld refers to CSSLayout even thought master has moved on and the library is now called Yoga.
Closes https://github.com/facebook/react-native/pull/11606

Differential Revision: D4365469

fbshipit-source-id: e0eaac400449f0ba767bf98f3bd8e8185fb6fd12
2016-12-28 22:16:54 -08:00
Janic DuplessisandJames Ide a0c3459be9 Move headers to project section to fix archive
Summary:
Follow up to fix some issues with 59407f3660. Headers needed to be in the `project` section instead of `private` in xcode so they don't get included in the archive.

cc javache
Closes https://github.com/facebook/react-native/pull/11395

Differential Revision: D4313048

Pulled By: javache

fbshipit-source-id: 805dbbe9f149acfe780be76e99c949c450272358
2016-12-28 22:15:43 -08:00
Martin Konicek 114054d1b0 [0.40.0-rc.4] Bump version numbers 2016-12-13 16:12:33 +00:00
Martin Konicek 5dbdb12d91 Deprecate MapView in favor of airbnb/react-native-maps
Summary:
Compared to the `<MapView>` that comes with React Native, [react-native-maps](https://github.com/airbnb/react-native-maps) work on Android and is more feature complete. It is actively maintained and used extensively (9.2k installs / month, see [JS.Coach](https://js.coach/react-native/react-native-maps?search=react-native-maps)).

We think now is a good time to switch to react-native-maps in your applications and make `react-native-maps` the official `<MapView>` implementation for React Native.

We are going to release the deprecated `<MapView>` as a separate npm module so you can migrate to `react-native-maps` at your own pace.

**Test Plan**

Checked the docs render correctly on the website:

```
cd website
npm install
npm start
```

<img width="696" alt="screenshot 2016-11-01 20 17 31" src="https://cloud.githubusercontent.com/assets/346214/19905831/480074b8-a070-11e6-8779-8e12343c2883.png">

Warning is shown:

<img width="423" alt="screenshot 2016-11-01 20 39 21" src="https://cloud.githu
Closes https://github.com/facebook/react-native/pull/10500

Differential Revision: D4119602

Pulled By: mkonicek

fbshipit-source-id: 86780a98bf999e6047565ab66a5ebbd15e499a46
2016-12-13 16:12:10 +00:00
Martin Konicek 3a882c2775 [0.40.0-rc.3] Bump version numbers 2016-12-12 13:36:36 +00:00
Eric SauterandMartin Konicek db81de61d4 Remove docs reference to incorrect align-items default
Summary:
Per https://developer.mozilla.org/en-US/docs/Web/CSS/align-items, the default for `align-items` is stretch, so I removed the reference that suggested otherwise

Similar to https://github.com/facebook/react-native/pull/9397, but this section was not updated in that PR.
Closes https://github.com/facebook/react-native/pull/11373

Differential Revision: D4299871

Pulled By: ericnakagawa

fbshipit-source-id: 1bee27b0dced192ef42e21ca8cc800d52edce195
2016-12-12 11:37:19 +00:00
Jeremi StadlerandMartin Konicek 0f7875688c Fix yarn command in git upgrade blog post
Summary:
The yarn global add needs to have global before add, it will otherwise just install in in the local project together with the global package.

https://yarnpkg.com/en/docs/cli/global
Closes https://github.com/facebook/react-native/pull/11364

Differential Revision: D4299909

Pulled By: ericnakagawa

fbshipit-source-id: 7b3a7817d2b1105003b9d48d16cf64756bfa51d5
2016-12-12 11:37:19 +00:00
Adam ErnstandMartin Konicek d9caf735ee Expose more of RCTWebSocketObserver
Reviewed By: javache

Differential Revision: D4297162

fbshipit-source-id: 97032ccf3dc6bd259ca0fa2883eff45c0c49347f
2016-12-12 11:37:19 +00:00
Adam ErnstandMartin Konicek f02bca7de9 Rename and merge files for RCTWebSocketObserver protocol
Summary: No need to have two files; merge it into one and give it an appropriate name.

Reviewed By: javache

Differential Revision: D4296716

fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
2016-12-12 11:37:19 +00:00
Adam ErnstandMartin Konicek 01058b41d7 Rename RCTWebSocketManager file to reflect its new contents
Reviewed By: javache

Differential Revision: D4296615

fbshipit-source-id: a48da3f0550398cb59478c7405fe971f9246910f
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek 53aef3eb5f Eliminate RCTWebSocketManager
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.

Reviewed By: javache

Differential Revision: D4296551

fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek 48cb8d3f92 Start exposing RCTWebSocketObserver using a protocol
Reviewed By: javache

Differential Revision: D4296387

fbshipit-source-id: 33f92c36168dcb18356d0ccdaf902a84634d94b7
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek 7a8410b551 Clean up RCTWebSocketObserver
Summary: Avoid using properties where unnecessary; stick to only one way to modify the delegate.

Reviewed By: javache

Differential Revision: D4296351

fbshipit-source-id: 94d0e3c90904ed584f691a3f28a15a7ac450c3e1
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek dd6c4b8294 Remove unused queue ivar from RCTWebSocketManager
Reviewed By: javache

Differential Revision: D4296309

fbshipit-source-id: feee004e24abdb4b3626c5304f662ec3d71118b5
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek cf6c794adf Clean up RCTWebSocketProxyDelegate a bit
Reviewed By: javache

Differential Revision: D4296294

fbshipit-source-id: b31e522c21ec490fdf98711655e5e8df22b32a12
2016-12-12 11:37:18 +00:00
Jean LauliacandMartin Konicek b6478a3458 packager: Resolver&co: @flow
Reviewed By: davidaurelio

Differential Revision: D4285448

fbshipit-source-id: ec9bc6fd3c6d6eae89347762bff8b5b24662394b
2016-12-12 11:37:18 +00:00
Ashok MenonandMartin Konicek 85478b56c5 Listen to Compiled Source Errors in JSCExecutor fallback code.
Reviewed By: javache

Differential Revision: D4284537

fbshipit-source-id: 247717ef55fb6bc0a34a01626c790bd23fd18598
2016-12-12 11:37:18 +00:00
Pieter De BaetsandMartin Konicek 0f99ddfbd2 Fix RN tvOS build
Reviewed By: mkonicek

Differential Revision: D4298869

fbshipit-source-id: fd132b2c1b656707b2dc750888c09e262b503111
2016-12-12 11:37:18 +00:00
David AurelioandMartin Konicek 3d31c411e4 Add fbjs definitions to flow config
Reviewed By: zertosh

Differential Revision: D4291805

fbshipit-source-id: 3dcb8ffe6132bd04a3048edae64e9d273c2dcae4
2016-12-12 11:37:18 +00:00
Travis StanleyandMartin Konicek 7d2a461c2a update comment to reflect change in function name to renderQuickActions
Summary:
Minor error in commen
Closes https://github.com/facebook/react-native/pull/11351

Differential Revision: D4293263

Pulled By: ericnakagawa

fbshipit-source-id: 19559b210336bfd05794a7585c0133a075e06398
2016-12-12 11:37:18 +00:00
Maxime LapointeandMartin Konicek 276485b0c0 Reworking keyboardShouldPersistTaps to have a middle ground
Summary:
Right now, the ScrollView's keyboard hiding behavior is either all or nothing: Hide the keyboard on any tap, or do nothing ever. This PR introduces a third mode to keyboardShouldPersistTaps which is much closer to what I consider should be the default.

In the new behavior, the tap responding is done in the bubbling phase (instead of the capture phase like =true). As a result, a child can handle the tap. If no child does, then the ScrollView will receive the tap and will hide the keyboard. As a result, changing TextInput focus works as a user expects, with a single tap and without keyboard hiding. But taping on Text or on the empty part of the ScrollView hides the keyboard and removes the focus.

You can view the behavior in a monkey patched ScrollView demo on rnplay:
https://rnplay.org/apps/E90UYw
https://rnplay.org/apps/UGzhKA

In order to have a uniform props set, i added 3 values to the keyboardShouldPersistTaps:
'never' and 'always' are the same as false and true.
'handled' is the new behavior.

I don't
Closes https://github.com/facebook/react-native/pull/10628

Differential Revision: D4294945

Pulled By: ericvicenti

fbshipit-source-id: 1a753014156cac1a23fabfa8e1faa9a768868ef2
2016-12-12 11:37:18 +00:00
Christoph PojerandMartin Konicek ee92b5c045 Add missing slash.
Summary:
This should be there for consistency.
Closes https://github.com/facebook/react-native/pull/11357

Differential Revision: D4294530

Pulled By: kentaromiura

fbshipit-source-id: 6219a7c69a65dde21d96bc032fc9a327386a85ca
2016-12-12 11:37:18 +00:00
Adam ErnstandMartin Konicek 221fab5317 Refactor reload command in React Native
Summary: Introduces an API to register a weakly-held listener for the reload (Cmd+R) command. This allows external infrastructure to hook into the reload command before the `RCTBridge` object is even created.

Reviewed By: javache

Differential Revision: D4286980

fbshipit-source-id: 51012fb8cbeb433dc880d9d98d847b07fdbb4c4f
2016-12-12 11:37:18 +00:00
Eming KwokandMartin Konicek 230de71e31 fix memory leak in Chrome debugging
Summary:
`RCTWebSocketExecutor` saves every WebSocket callback when sending message to chrome, but does not clear them in a debug session until the JS bridge is reloaded, and there may be thousands of blocks saved in the callback table. This PR removes them after they are called.
Closes https://github.com/facebook/react-native/pull/11341

Differential Revision: D4295710

Pulled By: javache

fbshipit-source-id: 29a02d1aba320115bbb97aee8981e34b89303c91
2016-12-12 11:37:18 +00:00
Eric Palakovich CarrandMartin Konicek be169075d9 Red Box should open PyCharm at line number of error
Summary:
This is a simple one line change.  When a red box is launching the editor, if `launchEditor.js` is aware of your editor it can also add a line number to open the file at.  So if the stacktrace shows an error on like 56 in `ako.js` then it'll try`wstorm /Users/somelady/src/project/ako.js:56` instead of `wstorm /Users/somelady/src/project/ako.js`.

This adds PyCharm's command line launcher, which is named `charm`.  There is existing logic to handle other JetBrains editors, so I just did a simple one line addition.

**Test plan (required)**

* Install PyCharm (if needed)
* Set environment variable `REACT_EDITOR` to `charm`
* Open PyCharm
* Add/replace the current `charm` command via `Tools -> Create Command-line launcher...` in PyCharm.
* Run a React Native project with an error in the source code.
* In the generated red box, click on one of the entries in the stack trace
* File should open in PyCharm at the correct line number.
Closes https://github.com/facebook/react-native/pull/11275

Differential Revision: D4295724

Pulled By: javache

fbshipit-source-id: 29dec525f76c2f0a3ee203cac67408eecc8ac6b6
2016-12-12 11:37:17 +00:00
Mike GrabowskiandMartin Konicek 4a216f65bf Better error for ART <Group />
Summary: Fixes #3815

Differential Revision: D4295976

Pulled By: javache

fbshipit-source-id: 034690d3bee75217d820d3361136a410a812cd2c
2016-12-12 11:37:17 +00:00
Andrew YangandMartin Konicek 43d6e8feb9 Update gradle-download-task from 2.0.0 to 3.1.2 to fix boost zip down…
Summary:
Small pull request

 **motivation**
The doc 'Building React Native from source' is not up to date now.

While i try to build from the source my self, the gradle-download-task(2.0.0) will always fail to download boost zip with a failure of 403.

After i upgrade the gradle-download-task to 3.1.2, the download works well.

**Test plan (required)**
I tested to build the source myself, it works.

This is non-code update, it is document update, hope to help other people who get the same download failure.

**Code formatting**
Non-code update PR.
Closes https://github.com/facebook/react-native/pull/11298

Differential Revision: D4288387

fbshipit-source-id: 5e6feef1ea80f7e3feddcc7e4abf2b5cea82f08f
2016-12-12 11:37:17 +00:00
Pieter De BaetsandMartin Konicek cd2b384ec4 Remove deprecated RCTReloadNotification
Reviewed By: adamjernst

Differential Revision: D4294180

fbshipit-source-id: 6837597df2a798661c993c6f63ec430989954de6
2016-12-12 11:37:17 +00:00
Pieter De BaetsandMartin Konicek 63d5bcb49b Redo exported headers and include paths for opensource
Summary:
Xcode really sucks, per some discussion on https://github.com/facebook/react-native/commit/e1577df1fd70049ce7f288f91f6e2b18d512ff4d and https://developer.apple.com/library/content/technotes/tn2215/_index.html, if you use the headers phase, and mark headers in your static library as public, they will actually end up in the final package that's built and you can't submit to the app store! This changes our xcode setup to use a copy files phase instead.

I've also changed the header include path to be $(BUILT_PRODUCTS_DIR)/include, which is added to the include path by Xcode by default, so 3rd party libraries should not be impacted by these changes anymore.

Reviewed By: mkonicek

Differential Revision: D4291607

fbshipit-source-id: 969b9ebcbeb8161f85427f8c429e198d9d0fae30
2016-12-12 11:37:17 +00:00
Andres SuarezandMartin Konicek f0b7dabb7e Remove requestIdleCallback/cancelIdleCallback flow lib
Summary: As of flow 0.36.0, `requestIdleCallback` and `cancelIdleCallback` are part of the builtin lib defs. https://github.com/facebook/flow/pull/2800

Reviewed By: yungsters

Differential Revision: D4280306

fbshipit-source-id: 30328675c7dbfe12f603321f1196c87800a19ba8
2016-12-12 11:37:17 +00:00
Michał GregorczykandMartin Konicek 25fb2baa62 Do not call toString on functions in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D4292618

fbshipit-source-id: cd7cd1a88aeb2c800f2c2941c79855992613ec84
2016-12-12 11:37:17 +00:00
Eric VicentiandMartin Konicek dce77a30e5 Docs: Revise language around mobile web
Summary:
Addresses some criticism: https://twitter.com/ryanflorence/status/806236197731172352

As the author of this original text, I promise no offense was meant towards mobile web technologies.

I just want to help people build apps that feel great.
Closes https://github.com/facebook/react-native/pull/11353

Differential Revision: D4292705

Pulled By: lacker

fbshipit-source-id: 7b86865e4e98cfc37e052e1c02e0b2c3e800d4fc
2016-12-12 11:37:17 +00:00
Martin KonicekandMartin Konicek 296d13308f Upselling ListView in ScrollView's docs
Summary:
Internal research at FB has shown that many devs don't know why they should use ListView instead of ScrollView, or that ListView even exists. This PR changes ScrollView's docs to upsell ListView.

I could put this as a separate guide in the docs, but I think this place will have the best possible reach for target audience.

Suggestions welcome. Let me know if it doesn't make sense or is too verbose.
Closes https://github.com/facebook/react-native/pull/11349

Differential Revision: D4292109

Pulled By: mkonicek

fbshipit-source-id: e4a14e5a55333c9282d0e407461505e71e850b20
2016-12-12 11:37:17 +00:00
Lukas PiatkowskiandMartin Konicek d919eb746e Fix SamplingProfiler and HeapCapture for apps that lazy load react modules
Reviewed By: cwdick

Differential Revision: D4291903

fbshipit-source-id: 684ced8d6370494191cdb182a8e172680d69d17b
2016-12-12 11:37:17 +00:00
Martin Konicek 8fb2440570 Remove dependency on Yeoman
Summary:
We stopped using Yeoman in https://github.com/facebook/react-native/pull/10786

I almost forgot to remove the now-unused dependency :)

**Test Plan**

- Published react-native to Sinopia
- Ran `react-native init MyApp`
- The app was generated correctly
- The app's node_modules folder doesn't contain Yeoman

Reviewed By: cpojer

Differential Revision: D4291619

fbshipit-source-id: 44c1ef8035fa2d8c40d4e8c505207245e1a95d3c
2016-12-12 11:37:13 +00:00
Don YuandMartin Konicek e06b8db79d Implement onViewAppear by creating a new EventListener on ReactRootView listening for when it's attached to a RN Instance
Reviewed By: AaaChiuuu

Differential Revision: D4269272

fbshipit-source-id: 6dd54f8ab7befebd54e82ef355119ba302b9bfe5
2016-12-12 11:37:09 +00:00
Emil SjolanderandMartin Konicek 5144bf0e5a Rename directories
Reviewed By: gkassabli

Differential Revision: D4284681

fbshipit-source-id: f0c6855c2c6e4389b7867f48f72cbb697830fc5a
2016-12-12 11:37:09 +00:00
David AurelioandMartin Konicek 37edcb24be Use absolute paths from repo root
Summary: Rather than using relative paths from the build root, this switches all paths to absolute paths from the build root. This makes integration with a lot of tooling easier.

Reviewed By: jeanlauliac

Differential Revision: D4285474

fbshipit-source-id: 80d20e0f6dc61a310e72112b9654628bff81a4f0
2016-12-12 11:37:08 +00:00
Emil SjolanderandMartin Konicek 7b5a51e6f5 Remove init from api
Reviewed By: gkassabli

Differential Revision: D4276177

fbshipit-source-id: c4404d0534f381dfacee0625b2847d38de58e038
2016-12-12 11:37:08 +00:00
Martin Konicek 63804db713 CLI: Show npm / yarn output during 'react-native-init' when installing React and Jest
Summary:
I missed this while doing the Yeoman wipeout.

Currently we just print:

    Installing React...
    Installing Jest...

This diff makes it print the output of those commands.

**Test Plan**

Published react-native to Sinopia, ran `react-native init MyApp`, saw the output:

    Installing Jest...
    ⸨░░░░░░░░░░░░░░░⸩ ⠸ normalizeTree: ...

Reviewed By: bestander

Differential Revision: D4286640

fbshipit-source-id: e554f03a4729c2de85eba527f10f4b727de722e4
2016-12-12 11:37:08 +00:00
Martin Konicek 8f0aed6fa0 Allow configuring the way CLI installs react-native
Summary:
- Added an option to override the install command in CI environments (see comment in code)
- Simplify the verbose mode
- Simplify how options are passed round

Test plan (only tested on Mac OS):

    react-native init TestApp
    react-native init TestApp --version 0.36

In both cases the app was generated, package.json contained the correct version (latest, or 0.36).

    react-native init TestApp --verbose

Saw progress bar.

    react-native init InstallCommandTest --installCommand "npm install bad-package-doesnt-exist"

404 error is printed to stdout correctly.

    react-native init TestApp --installCommand "npm install react-native"

The app was generated.

    react-native init InstallCommandTest --installCommand "npm install react-native --verbose" --verbose

Saw verbose output from npm.

Reviewed By: bestander

Differential Revision: D4284642

fbshipit-source-id: f2cdee52ab64831ae3ca064d50f23c5f73a0301f
2016-12-12 11:37:08 +00:00
John ShelleyandMartin Konicek e335ca0c14 Android - Fix Overlay for Marshmallow 23+
Summary:
Currently any React Native apps that target API 23 or greater will crash on the first initial debug/dev build due to the overlay permission.

Sadly there isn't a concrete "request permission" baked into the Marshmallow permission system.
However, we can launch the overlay screen without starting the react app and once its turned on start the app.

 - https://github.com/facebook/react-native/issues/10454 - targetSdkVersion 23 lead crash / App crash for targeting 23+
 - https://github.com/facebook/react-native/pull/10479 - Add the overlay permission information / Larger discussion around targeting API 23+
- Intent to Overlay permission goes directly to the app in question, rather then the general full listing of applications. This allows a developer who is not familiar with the system to easily toggle the overlay without getting confused.

**Test plan (required)**
* Ran UIExplorer App on fresh install with Target 23
```
cd react-native
./gradlew :Examples:UI
Closes https://github.com/facebook/react-native/pull/11316

Differential Revision: D4286351

fbshipit-source-id: 024e97c08c40ee23646dd153794fcde7127b2308
2016-12-12 11:37:08 +00:00
Pieter De BaetsandMartin Konicek fd144a29aa Fix target configuration in React.xcodeproj
Summary: The target config inside React.xcodeproj was messed up, with source files being included in multiple or wrong targets. I went over the files in React.xcodeproj and verified that each .m file was included only once and was in the right target and .h were in the right projects.

Reviewed By: majak

Differential Revision: D4284673

fbshipit-source-id: 99af61083c6ca81311e30f0ea0045d4e7bffc20c
2016-12-12 11:37:08 +00:00
NelenandMartin Konicek ed3b71fc59 Added mocked functions to StatusBarManager
Summary:
**Description:**
Jest tests that use that StatusBar failing because the status bar functions aren't mocked.
Errors I ran into:
`TypeError: StatusBarManager. setNetworkActivityIndicatorVisible is not a function`
`TypeError: StatusBarManager. setHidden is not a function`
`TypeError: StatusBarManager. setStyle is not a function`

**Fix:**
Added mocks for all the functions that the StatusBar offers according to the docs: https://facebook.github.io/react-native/docs/statusbar.html

**Test plan (required)**
Verify that the tests using StatusBar and its functions succeed.
Closes https://github.com/facebook/react-native/pull/11322

Differential Revision: D4284536

Pulled By: cpojer

fbshipit-source-id: b67be8c0595d91ee9aca4784f457c0959d7e45d5
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek a5e6433983 Add bundle building logic
Summary: Adds the necessary functionality to serialize a series of `Module`s to a bundle and a source map in the context of the new Buck/Packager integration

Reviewed By: cpojer

Differential Revision: D4265867

fbshipit-source-id: f2d3e4ffed64a3dca817101faad7bced9f16edc7
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek 6c65cda628 Support relative paths in haste map
Summary: Since all paths are relative when building with the new Buck integration, `HasteMap` needed support for these.

Reviewed By: cpojer

Differential Revision: D4265888

fbshipit-source-id: 2d454bfd3866028d8d2c268c0fd318b148951dc9
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek c74f00e78c Add source map helper
Summary: Adds a helper to produce index source maps for Buck builds

Reviewed By: cpojer

Differential Revision: D4265911

fbshipit-source-id: 9ca3c49876df5db039bae823c0458c98e6e05619
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek 6df804c8b0 Don’t use spaces when amending module wrapper
Summary: since we use the same module wrapper amendment function for dev and prod builds, and code is already minified at this point, we minify ourselves by leaving out space.

Reviewed By: cpojer

Differential Revision: D4265967

fbshipit-source-id: 719a3bbfbc02c9af1bb3fa08317b2f1b92c141a5
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek 88409f6bda ModuleGraph: Also call back with module objects of entry points
Summary:
This changes the callback value of `Graph` function so that it also contains a separate property with `Module` instances of the entry points.

Having references to the entry point modules allows to e.g. create require calls to them dynamically to kick of bundle execution.

The commit also contains a refactoring of the `Graph` function and its helpers that reduces the need for extensive parameter passing and long nested functions.

Reviewed By: cpojer

Differential Revision: D4250772

fbshipit-source-id: 2edca77bbef2308d3176a62123b8cecd70e2c8c7
2016-12-12 11:37:08 +00:00
Jan KassensandMartin Konicek 8439a12a91 delete signedsource.js
Summary:
This module is not actually used inside of React Native. Projects that use this,
can now depend on https://www.npmjs.com/package/signedsource

Reviewed By: yungsters

Differential Revision: D4272511

fbshipit-source-id: 93eb74aa4ccfa8ef8743de2cfa92b5403de91e0a
2016-12-12 11:37:08 +00:00
Nicolas CuilleryandMartin Konicek 18487e83f6 Mention Yarn in blog post
Summary:
An original idea from GantMan #11311
Closes https://github.com/facebook/react-native/pull/11313

Differential Revision: D4281207

Pulled By: mkonicek

fbshipit-source-id: e878c0ace65c0f4614e0325f7f2f0b660559e754
2016-12-12 11:37:08 +00:00
David AurelioandMartin Konicek c3e2c3000e Remove hmr require from initialization code
Reviewed By: cpojer

Differential Revision: D4265897

fbshipit-source-id: c39caeae875e6f5f5322542601e97cdf78f90dc6
2016-12-12 11:37:08 +00:00
Emil SjolanderandMartin Konicek 05c7e2f6b7 Fix last missing reference to libcsslayout
Reviewed By: bestander

Differential Revision: D4279530

fbshipit-source-id: 809a6317f02bc2a770f50c8cb048aa3e2dfcf33f
2016-12-12 11:37:07 +00:00
Martin Konicek d552adfa49 Revert to downloading Boost from SourceForge for now
Summary: The unpkg mirror started returning HTTP 403 Forbidden for some reason.

Reviewed By: mkonicek

Differential Revision:
D4278637
Ninja: OSS only, tests already broken

fbshipit-source-id: 7dbfce40e8246f2a021ebe2592d24fa86c12bf21
2016-12-12 11:37:07 +00:00
Pieter De BaetsandMartin Konicek 90249980bb Remove REACT_HEADERS from RN BUCK file
Reviewed By: emilsjolander

Differential Revision: D4231819

fbshipit-source-id: 78c1316d8e2bd8d9c0947b1c1c4dc857b74824ae
2016-12-12 11:37:07 +00:00
Adam ComellaandMartin Konicek d043775d00 iOS: Fix dequeueTasks crash in image loader
Summary:
This fixes a crash occurring [on this line](https://github.com/facebook/react-native/blob/f9f32eb426b5385e199ef6e1d2b610dfe20e60e7/Libraries/Image/RCTImageLoader.m#L253). It was reported in a comment in #10433.

The problem is that `task` is deallocated at this point and is unsafe to use. Removing it from `_pendingTasks` dropped its ref count to 0. [The ARC docs](http://clang.llvm.org/docs/AutomaticReferenceCounting.html#fast-enumeration-iteration-variables) state that, by default, loop variables in fast enumeration loops are not retained. That's why `task`'s ref count is 0.

It's likely we ran into this bug because the code disobeyed the [reverseObjectEnumerator docs](https://developer.apple.com/reference/foundation/nsarray/1415734-reverseobjectenumerator) which state that "you must not modify the array during enumeration". The default retention policy for fast enumeration seems to assume you follow this.

To fix this bug and avoid other potential pitfalls, the code now follows the docs and `_pendingTa
Closes https://github.com/facebook/react-native/pull/11296

Differential Revision: D4277167

Pulled By: javache

fbshipit-source-id: 1211b32935bab7f4080dc00b88d85348786e859a
2016-12-12 11:37:07 +00:00
gl8997@gmail.comandMartin Konicek 64328398b3 Update type check for NavigationCardStack
Summary:
The typecheck inside of NavigationCard is PropTypes.any while in NavigationCardStack it is  View.propTypes.style.

let's make them consistent to avoid unnecessary warnings. (e.g. trying to pass a animationStyle as cardStyle)
Closes https://github.com/facebook/react-native/pull/9808

Differential Revision: D4277323

Pulled By: ericvicenti

fbshipit-source-id: c30b4a21675cad98c19f5c6522e286d776bfa20d
2016-12-12 11:37:07 +00:00
Emil SjolanderandMartin Konicek 61a63c966b Fix an error initializing needsCrossTrailingPos
Reviewed By: gkassabli

Differential Revision: D4271422

fbshipit-source-id: e8d72af742d96829684958780eb56e2c375df20c
2016-12-12 11:37:07 +00:00
Andres SuarezandMartin Konicek 08c88fa80c Remove unused deps
Reviewed By: davidaurelio

Differential Revision: D4267485

fbshipit-source-id: 1118328960258969c775f61f598341d1d48d336a
2016-12-12 11:37:07 +00:00
Martin Konicek 2f4faa7d6a Blogpost about react-native-git-upgrade
Reviewed By: mkonicek

Differential Revision:
D4277012
Ninja: OSS blog

fbshipit-source-id: bdb7db675f208f1103f0c34b9d71d3b0fdd5e875
2016-12-12 11:37:07 +00:00
Emil SjolanderandMartin Konicek 7d8bfb290b Fix library name of yogacore
Reviewed By: bestander

Differential Revision: D4276884

fbshipit-source-id: c791aa3bb27fcf4b48d84427011eae6119fe6edf
2016-12-12 11:37:07 +00:00
Martin Konicek 6320637e22 Git upgrade: Tweak wording
Reviewed By: mkonicek

Differential Revision:
D4276739
Ninja: OSS

fbshipit-source-id: 7480a3ee77ed8f6ab0d35f92b43a806bfe29a151
2016-12-12 11:37:07 +00:00
Martin Konicek 4ba4d45e30 Fix a bug in determining if yarn is available
Reviewed By: mkonicek

Differential Revision:
D4276707
Ninja: OSS

fbshipit-source-id: 79cb2942f27179681d1a8ebfd3bc5a97f544f7af
2016-12-12 11:37:00 +00:00
Martin Konicek a68f3e2631 Git upgrade: Tweak README, bump version, fix a bug
Reviewed By: mkonicek

Differential Revision:
D4276644
Ninja: OSS only

fbshipit-source-id: 7bed331770d06addedf51e2ed09d0b9bde5b45ad
2016-12-12 11:36:39 +00:00
Emil SjolanderandMartin Konicek 90f2060285 Add #pragma once and extern C to YGEnums.h
Reviewed By: gkassabli

Differential Revision: D4274156

fbshipit-source-id: 9fa0ae146bb9e5bd40d93fa3c56f83424ebd2bf9
2016-12-12 11:36:39 +00:00
Martin Konicek db416bea98 Git upgrade: add a README
Reviewed By: mkonicek

Differential Revision:
D4276245
Ninja: OSS docs only

fbshipit-source-id: b7a7561932e3209dc34322f12a512eb5724791c3
2016-12-12 11:36:39 +00:00
Emil SjolanderandMartin Konicek b5283785ec Update java package name to yoga
Differential Revision: D4271420

fbshipit-source-id: b3cf150569a2331868410339cd19e5c694f2059e
2016-12-12 11:36:39 +00:00
David AurelioandMartin Konicek f82bbe1dc1 Load Indexed RAM format on android
Reviewed By: javache

Differential Revision: D4268243

fbshipit-source-id: fc969cfc69810d0477c926ffc79c23584fcbd7eb
2016-12-12 11:36:39 +00:00
Martin Konicek 0916a54597 Unpublish blogpost that was published too early
Reviewed By: mkonicek

Differential Revision:
D4274302
Ninja: OSS only

fbshipit-source-id: 874c2c8ddbae93f6b6e362ccedcd3951267c455d
2016-12-12 11:36:39 +00:00
Emil SjolanderandMartin Konicek 91fdac273f Update yoga library name
Reviewed By: bestander

Differential Revision: D4273387

fbshipit-source-id: 91373c6ef1e94b330fa249235ba97fec480e17c7
2016-12-12 11:36:39 +00:00
Jake DawkinsandMartin Konicek 4dea89271e Fix iOS Picker Item Colors
Summary:
I want to resolve #11170 by passing the `color` prop from `PickerIOS.Item` to its implementation.

In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before.

I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop.

![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif)

The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact:

![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif)
Closes https://github.com/facebook/react-native/pull/11260

Differential Revision: D4272370

fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
2016-12-12 11:36:39 +00:00
Tim YungandMartin Konicek 6ffa235c05 JS: Modernize SignedSource
Reviewed By: cpojer

Differential Revision: D4271506

fbshipit-source-id: b3eff94de9ce2c179d62d57eace9a40797aed397
2016-12-12 11:36:39 +00:00
Tim YungandMartin Konicek 01a694e089 RN: Delete Dead sign Module
Reviewed By: cpojer

Differential Revision: D4271550

fbshipit-source-id: ffab21055f3e51fccf8640a568703aa8cc20bd0f
2016-12-12 11:36:39 +00:00
Emil SjolanderandMartin Konicek 2c26dffa79 Rename java API
Reviewed By: IanChilds

Differential Revision: D4265345

fbshipit-source-id: 69ecfd8fac214f86b8b70647b9b909acd83d78b5
2016-12-12 11:36:38 +00:00
Emil SjolanderandMartin Konicek 99f972f33f Rename C api
Differential Revision: D4259190

fbshipit-source-id: 26c8b356ca464d4304f5f9dc4192bff10cea2dc9
2016-12-12 11:36:38 +00:00
David AurelioandMartin Konicek 06e9fa1c97 JSIndexedRAMBundle: Don't read null bytes for scripts
Summary:
`JSIndexedRAMBundle` used to read scripts including the terminating null bytes. That worked on iOS, but not on Android, where we have an ascii-only optimization.
This changes that behavior to only read the actual script data excluding the terminal null.

Reviewed By: javache

Differential Revision: D4265374

fbshipit-source-id: 7e6f943666aee610d79939cef09b103305803c69
2016-12-12 11:36:38 +00:00
Connor GarberandMartin Konicek 1e113735a6 Android home path reminder visible twice on linux
Summary:
The line
`Please make sure you export the correct path for 'ANDROID_HOME' if you did not install the Android SDK using Android Studio.`
was visible twice (one on top of another) in the docs when viewing linux instructions. I removed the block that set it visible on both linux and windows and incorporated it into the existing windows block.
Closes https://github.com/facebook/react-native/pull/11276

Differential Revision: D4269783

Pulled By: hramos

fbshipit-source-id: 423fca3219567cf96d91aefc43d1ddabb2403728
2016-12-12 11:36:38 +00:00
Sagiv OfekandMartin Konicek 36ceb3997b Add more info link for warnedMissingNativeAnimated
Summary:
Add link with more details of how to resolve warnedMissingNativeAnimated warning.
Closes https://github.com/facebook/react-native/pull/11224

Differential Revision: D4268352

fbshipit-source-id: 679574570aea2f4ec7083247d5b6dcba378e8560
2016-12-12 11:36:38 +00:00
Damien VarronandMartin Konicek 6152fffcbd Add missing closing brace in docs
Summary:
This is a minor documentation fix

fixes #11150
Closes https://github.com/facebook/react-native/pull/11253

Differential Revision: D4268276

fbshipit-source-id: 67c8f9b4c77a2c781c09376bf4fc15a61b3db490
2016-12-12 11:36:38 +00:00
Ben KalmanandMartin Konicek b966807b02 Add missing backtick in PanResponder.js docs
Summary: Closes https://github.com/facebook/react-native/pull/11274

Differential Revision: D4268360

fbshipit-source-id: 8d92300830e4568de14350a539c11b8773c425c0
2016-12-12 11:36:38 +00:00
Ben ClaytonandMartin Konicek 7b3e67def0 <Text> Expose Android's includeFontPadding property to JavaScript.
Summary:
By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.

We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected.

Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer.
Closes https://github.com/facebook/react-native/pull/9323

Differential Revision: D4266713

Pulled By: lacker

fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
2016-12-12 11:36:38 +00:00
Nicolas CuilleryandMartin Konicek 7fe5229a1d Announcement of react-native-git-upgrade
Summary:
Ping mkonicek

![fireshot capture 4 - easy upgrades relying on git_ - http___localhost_8079_react-native_](https://cloud.githubusercontent.com/assets/4425455/20825225/fe93bcb2-b862-11e6-8f0d-123ef2c9071f.png)
Closes https://github.com/facebook/react-native/pull/11263

Differential Revision: D4265603

Pulled By: mkonicek

fbshipit-source-id: 8e496f0d76536744f2b25848a974f240bb5fae3e
2016-12-12 11:36:38 +00:00
Mike GrabowskiandMartin Konicek 1ddd202923 Update docs with releases information
Summary:
We have changed the release schedule but haven't updated docs yet. This is a small PR that aims to fix it where applicable.

Likely to be cherry-picked to 0.40 branch since its the new one following that system.

Differential Revision: D4266155

Pulled By: mkonicek

fbshipit-source-id: 952af7a0f35a3d984aeadb6efe02f0990830ed8b
2016-12-12 11:36:38 +00:00
Jean LauliacandMartin Konicek 1167c7b8dd packager: Server/index.js: moar @flow
Summary:
Let's continue to bring Flow goodness to the codebase, as it will facilitate future refactorings.

I fixed a few of the typing issues by changing the local logic at times, but in a way that should not cause any difference globally.

Reviewed By: cpojer

Differential Revision: D4265347

fbshipit-source-id: a2a7afd7d93cf00ba58e8c9879a9bb6d5bf30358
2016-12-12 11:36:38 +00:00
Andrew ImmandMartin Konicek 5b37c3edb0 Allow custom platforms for the RN Packager on a per-project basis
Reviewed By: cpojer

Differential Revision: D4255979

fbshipit-source-id: bf900b67ee30e2f994e96c9a6103ed2e53a87f88
2016-12-12 11:36:38 +00:00
Charles DickandMartin Konicek cd8cfc3d32 ignore heap captures
Reviewed By: mkonicek

Differential Revision: D4265530

fbshipit-source-id: 0933fea4ee2c2ee89805ab9c8d8819a928087c7b
2016-12-12 11:36:38 +00:00
Nicolas CuilleryandMartin Konicek c2db59e317 Fix the parse error when specifying an unknown version.
Summary:
**Motivation**

When running `react-native-git-upgrade` with an unknown version, the error message isn't very helpful

**Test Plan**

- Publish the `master` branch to Sinopia
- Run `react-native-git-upgrade 0.666.0` inside a RN project
- Error message is `SyntaxError: Unexpected end of JSON input`
- Publish this branch to Sinopia
- Run `react-native-git-upgrade 0.666.0` inside a RN project
- Error message should be `Error: The specified version of React Native 0.666.0 doesn't exist.
Re-run the react-native-git-upgrade command with an existing version,
for example: "react-native-git-upgrade 0.38.0",
or without arguments to upgrade to the latest: "react-native-git-upgrade".`
Closes https://github.com/facebook/react-native/pull/11264

Differential Revision: D4265553

Pulled By: mkonicek

fbshipit-source-id: 8597eb09cc3397bfa6d2205a9b3bb30acfad530f
2016-12-12 11:36:38 +00:00
Nicolas CuilleryandMartin Konicek 6751779906 Remove trailing space in template file
Summary:
Simple removal of a trailing space in a template file which leads to a warning when using `react-native-gitupgrade`:
<img width="1187" alt="capture d ecran 2016-12-02 a 12 44 26" src="https://cloud.githubusercontent.com/assets/4425455/20832904/2c039f80-b88d-11e6-855a-78287d29585f.png">

**Test plan**
To repro:
- Install the `react-native-git-upgrade` package (see #11110)
- Upgrade from 0.39.0 to 0.40.0-rc.0

Ping mkonicek
Closes https://github.com/facebook/react-native/pull/11270

Differential Revision: D4265540

Pulled By: mkonicek

fbshipit-source-id: 7b05f2de4711818b25fcd09260ae9c75d187d9ad
2016-12-12 11:36:37 +00:00
Jean LauliacandMartin Konicek 46f8eb0a31 packager: make legocastle script to write to the global cache
Reviewed By: davidaurelio

Differential Revision: D4251001

fbshipit-source-id: bde1e50c82c2cb8f2c2577139061498c809aa37e
2016-12-12 11:36:37 +00:00
Emil SjolanderandMartin Konicek d414fdc906 Rename enums
Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
2016-12-12 11:36:37 +00:00
Emil SjolanderandMartin Konicek 11a2b21e84 Remove force_static
Reviewed By: gkassabli

Differential Revision: D4258293

fbshipit-source-id: 053f9e607503707830e3766b1f268ab31d3081ff
2016-12-12 11:36:37 +00:00
Mike GrabowskiandMartin Konicek 3d0680b701 Update releases to refer to month instead of two weeks
Summary: We also have to update internal guides.

Differential Revision: D4265258

fbshipit-source-id: 72ee394138464f8145075b499b862561e7a2ed40
2016-12-12 11:36:37 +00:00
Janic DuplessisandMartin Konicek d77b4fd0c8 Fix packager asset requests on windows
Summary:
6554ad5983 broke assets on windows, this fixes it and add a test to avoid regressions.

Ideally we'd run all the Dependency graph tests on both posix and win32 filesystems but that would probably require doing some sort of factory function to create the tests because I don't think we want to duplicate every test (file is big enough already :)). So for now I just copied that one test and changed the paths manually.

**Test plan**
Run the new test without the fix -> fails
Run the new test with the fix -> succeeds
Closes https://github.com/facebook/react-native/pull/11254

Differential Revision: D4265157

Pulled By: cpojer

fbshipit-source-id: 511470276bd950c2943e94c2dce6840df0fe6d69
2016-12-12 11:36:37 +00:00
Martin Konicek ca403f0a5f Use Yarn if available
Summary:
**Motivation**

If the project is using yarn to manage its dependencies, we should be running 'yarn add' to upgrade the React Native dependency, rather than 'npm install'.

**Test plan (required)**

Running in a project that's in a bad state:

    Error: react-native version in "package.json" (0.29.2) doesn't match the installed version in "node_modules" (0.38.0).
    Try running "yarn" to fix this.

Removed yarn.lock file, ran again:

    Error: react-native version in "package.json" (0.29.2) doesn't match the installed version in "node_modules" (0.38.0).
    Try running "npm install" to fix this.

Running inside a folder that doesn't contain a `package.json` file:

    Error: Unable to find "/Users/mkonicek/Zero29App/package.json" or "/Users/mkonicek/Zero29App/node_modules/react-native/package.json". Make sure you ran "yarn" and that you are inside a React Native project.

Removed yarn.lock file, ran again:

    Error: Unable to find "/Users/mkonicek/Zero29App/package.json" or "/Users/
Closes https://github.com/facebook/react-native/pull/11225

Differential Revision: D4261102

Pulled By: mkonicek

fbshipit-source-id: b44ae91fe46f2c81b14616ca2868cc171692c895
2016-12-12 11:36:37 +00:00
Adam ComellaandMartin Konicek 70d4023856 iOS: Fix an image loader crash
Summary:
Fixes #10433

The code didn't account for the fact that cancelLoad is set by two different threads. It gets set on the URL request queue when the request completes successfully and it gets set on the UI queue during cancelation. This oversight lead to a couple of different kinds of crashes.

1. Attempt to invoke a nil function -- We check that cancelLoad is non-nil and on the next line we call it. However, cancelLoad could have been set to nil by the other thread between the time it was verified to be non-nil and the time it was called. Consequently, the program will attempt to call nil and crash.

2. Block deallocated while it's executing -- Suppose cancelLoad points to a block, it is verified to be non-nil, and it is successfully invoked. In the middle of executing the block, cancelLoad, the last reference to the block, is set to nil. This causes the block to be deallocated and its captured values to be freed. However, the block continues executing and the next time it attempts to use a captured value
Closes https://github.com/facebook/react-native/pull/11145

Differential Revision: D4261499

Pulled By: javache

fbshipit-source-id: 46424c6dd8cfa085cef32d945308de07798040bc
2016-12-12 11:36:37 +00:00
Héctor RamosandMartin Konicek e65d528077 Fix blocks mixed up between mac, linux and windows in Getting Started doc
Summary:
Fixes #11220
Closes https://github.com/facebook/react-native/pull/11229

Differential Revision: D4253097

Pulled By: hramos

fbshipit-source-id: 9821912e25cbf2f3a5a86ea8dc27a85d070af34f
2016-12-12 11:36:37 +00:00
Ray CohenandMartin Konicek 3ee5c5b144 update android gradle plugin version to 2.2.2
Summary:
Similar to https://github.com/facebook/react-native/commit/6bfabee0f848b3126f02729a16c42e2ff0976d12 but upgrading to 2.2.2 which is the what android studio suggests using

http://tools.android.com/tech-docs/new-build-system

<img width="625" alt="screen shot 2016-12-01 at 3 06 25 pm" src="https://cloud.githubusercontent.com/assets/20404/20810456/d1e759e8-b7d7-11e6-9fa3-fc79f1112f5e.png">
Closes https://github.com/facebook/react-native/pull/11252

Differential Revision: D4262769

fbshipit-source-id: 78bc910a573fcf5b2722d3b29a5604639029a662
2016-12-12 11:36:37 +00:00
Martin Konicek 55782575cb [0.40.0-rc.2] Bump version numbers 2016-12-08 11:43:37 +00:00
Martin Konicek 7ea40aa0cc Remove dependency on Yeoman
Summary:
We stopped using Yeoman in https://github.com/facebook/react-native/pull/10786

I almost forgot to remove the now-unused dependency :)

**Test Plan**

- Published react-native to Sinopia
- Ran `react-native init MyApp`
- The app was generated correctly
- The app's node_modules folder doesn't contain Yeoman

Reviewed By: cpojer

Differential Revision: D4291619

fbshipit-source-id: 44c1ef8035fa2d8c40d4e8c505207245e1a95d3c
2016-12-08 11:43:12 +00:00
Martin Konicek e7ae12454d [0.40.0-rc.1] Bump version numbers 2016-12-05 14:18:31 +00:00
Martin Konicek 9b534082ca Fix a bug in determining if yarn is available
Reviewed By: mkonicek

Differential Revision:
D4276707
Ninja: OSS

fbshipit-source-id: 79cb2942f27179681d1a8ebfd3bc5a97f544f7af
2016-12-05 14:17:46 +00:00
Mike Grabowski 9233d85ec5 [0.40.0-rc.0] Bump version numbers 2016-12-02 02:15:45 +01:00
239 changed files with 11178 additions and 9079 deletions
@@ -3,9 +3,23 @@
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../../React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
@@ -23,10 +37,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@@ -42,11 +56,11 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@@ -65,10 +79,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
+1 -1
View File
@@ -299,7 +299,7 @@ var SearchScreen = React.createClass({
onEndReached={this.onEndReached}
automaticallyAdjustContentInsets={false}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps={true}
keyboardShouldPersistTaps="handled"
showsVerticalScrollIndicator={false}
/>;
@@ -3,9 +3,23 @@
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
parallelizeBuildables = "NO"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "83CBBA2D1A601D0E00E9B192"
BuildableName = "libReact.a"
BlueprintName = "React"
ReferencedContainer = "container:../../React/React.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
@@ -23,10 +37,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
@@ -42,11 +56,11 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
@@ -65,10 +79,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
@@ -95,7 +95,6 @@
2DD323E11DA2DDBF000FE1B8 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; };
2DD323E21DA2DDBF000FE1B8 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB61A68108700A75B9A /* Info.plist */; };
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323B51DA2DD8B000FE1B8 /* libRCTAnimation-tvOS.a */; };
2DD323E41DA2DE3F000FE1B8 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; };
2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BF1DA2DD8B000FE1B8 /* libRCTLinking-tvOS.a */; };
2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C31DA2DD8B000FE1B8 /* libRCTNetwork-tvOS.a */; };
2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323C81DA2DD8B000FE1B8 /* libRCTSettings-tvOS.a */; };
@@ -109,6 +108,7 @@
3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; };
3D299BAF1D33EBFA00FA1057 /* RCTLoggingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D299BAE1D33EBFA00FA1057 /* RCTLoggingTests.m */; };
3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; };
3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DD323BB1DA2DD8B000FE1B8 /* libRCTImage-tvOS.a */; };
3D56F9F11D6F6E9B00F53A06 /* UIExplorerBundle.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F83E1D6F6AE000E69E0E /* UIExplorerBundle.bundle */; };
3DB99D0C1BA0340600302749 /* UIExplorerIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB99D0B1BA0340600302749 /* UIExplorerIntegrationTests.m */; };
3DD981D61D33C6FB007DC7BE /* TestBundle.js in Resources */ = {isa = PBXBuildFile; fileRef = 3DD981D51D33C6FB007DC7BE /* TestBundle.js */; };
@@ -337,14 +337,14 @@
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3C059A1DE3340900C268FA;
remoteInfo = CSSLayout;
remoteInfo = yoga;
};
3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 14AADEFF1AC3DB95002390C9 /* React.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3D3C06751DE3340C00C268FA;
remoteInfo = "CSSLayout-tvOS";
remoteInfo = "yoga-tvOS";
};
58005BED1ABA80530062E044 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -513,15 +513,15 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2DD323EA1DA2DE3F000FE1B8 /* libReact-tvOS.a in Frameworks */,
2DD323E31DA2DE3F000FE1B8 /* libRCTAnimation-tvOS.a in Frameworks */,
2DD323E41DA2DE3F000FE1B8 /* libRCTImage-tvOS.a in Frameworks */,
3D302F221DF8285100D6DDAE /* libRCTImage-tvOS.a in Frameworks */,
2DD323E51DA2DE3F000FE1B8 /* libRCTLinking-tvOS.a in Frameworks */,
2DD323E61DA2DE3F000FE1B8 /* libRCTNetwork-tvOS.a in Frameworks */,
3D05746D1DE6008900184BB4 /* libRCTPushNotification-tvOS.a in Frameworks */,
2DD323E71DA2DE3F000FE1B8 /* libRCTSettings-tvOS.a in Frameworks */,
2DD323E81DA2DE3F000FE1B8 /* libRCTText-tvOS.a in Frameworks */,
2DD323E91DA2DE3F000FE1B8 /* libRCTWebSocket-tvOS.a in Frameworks */,
2DD323EA1DA2DE3F000FE1B8 /* libReact-tvOS.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -726,8 +726,8 @@
children = (
14AADF041AC3DB95002390C9 /* libReact.a */,
2DD323D91DA2DD8B000FE1B8 /* libReact-tvOS.a */,
3D3C08811DE3424E00C268FA /* libCSSLayout.a */,
3D3C08831DE3424E00C268FA /* libCSSLayout-tvOS.a */,
3D3C08811DE3424E00C268FA /* libyoga.a */,
3D3C08831DE3424E00C268FA /* libyoga-tvOS.a */,
3D05748C1DE6008900184BB4 /* libcxxreact.a */,
3D05748E1DE6008900184BB4 /* libcxxreact-tvOS.a */,
3D0574901DE6008900184BB4 /* libjschelpers.a */,
@@ -1290,17 +1290,17 @@
remoteRef = 3D0574911DE6008900184BB4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3D3C08811DE3424E00C268FA /* libCSSLayout.a */ = {
3D3C08811DE3424E00C268FA /* libyoga.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libCSSLayout.a;
path = libyoga.a;
remoteRef = 3D3C08801DE3424E00C268FA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
3D3C08831DE3424E00C268FA /* libCSSLayout-tvOS.a */ = {
3D3C08831DE3424E00C268FA /* libyoga-tvOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libCSSLayout-tvOS.a";
path = "libyoga-tvOS.a";
remoteRef = 3D3C08821DE3424E00C268FA /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
@@ -1627,6 +1627,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = V9WTTPBFK9;
INFOPLIST_FILE = "$(SRCROOT)/UIExplorer/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(inherited)";
@@ -1892,7 +1893,6 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -1952,7 +1952,6 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
BuildableName = "libReact-tvOS.a"
BuildableName = "libReact.a"
BlueprintName = "React-tvOS"
ReferencedContainer = "container:../../React/React.xcodeproj">
</BuildableReference>
@@ -28,10 +28,10 @@
{
[super setUp];
self.parentView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionColumn);
CSSNodeStyleSetWidth(node, 440);
CSSNodeStyleSetHeight(node, 440);
self.parentView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlexDirection(node, YGFlexDirectionColumn);
YGNodeStyleSetWidth(node, 440);
YGNodeStyleSetHeight(node, 440);
}];
self.parentView.reactTag = @1; // must be valid rootView tag
}
@@ -50,43 +50,43 @@
//
- (void)testApplyingLayoutRecursivelyToShadowView
{
RCTShadowView *leftView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *leftView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 2);
CSSNodeStyleSetMargin(node, CSSEdgeLeft, 10);
CSSNodeStyleSetMargin(node, CSSEdgeRight, 10);
RCTShadowView *centerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 2);
YGNodeStyleSetMargin(node, YGEdgeLeft, 10);
YGNodeStyleSetMargin(node, YGEdgeRight, 10);
}];
RCTShadowView *rightView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *rightView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlexDirection(node, CSSFlexDirectionRow);
CSSNodeStyleSetFlex(node, 2);
CSSNodeStyleSetMargin(node, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(node, CSSEdgeBottom, 10);
RCTShadowView *mainView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlexDirection(node, YGFlexDirectionRow);
YGNodeStyleSetFlex(node, 2);
YGNodeStyleSetMargin(node, YGEdgeTop, 10);
YGNodeStyleSetMargin(node, YGEdgeBottom, 10);
}];
[mainView insertReactSubview:leftView atIndex:0];
[mainView insertReactSubview:centerView atIndex:1];
[mainView insertReactSubview:rightView atIndex:2];
RCTShadowView *headerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *headerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
RCTShadowView *footerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *footerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(self.parentView.cssNode, CSSEdgeBottom, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeLeft, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeTop, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeRight, 10);
YGNodeStyleSetPadding(self.parentView.cssNode, YGEdgeBottom, 10);
[self.parentView insertReactSubview:headerView atIndex:0];
[self.parentView insertReactSubview:mainView atIndex:1];
@@ -108,18 +108,18 @@
- (void)testAncestorCheck
{
RCTShadowView *centerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *centerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
RCTShadowView *mainView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *mainView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
[mainView insertReactSubview:centerView atIndex:0];
RCTShadowView *footerView = [self _shadowViewWithConfig:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
RCTShadowView *footerView = [self _shadowViewWithConfig:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}];
[self.parentView insertReactSubview:mainView atIndex:0];
@@ -131,10 +131,10 @@
- (void)testAssignsSuggestedWidthDimension
{
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
CSSNodeStyleSetHeight(node, 10);
[self _withShadowViewWithStyle:^(YGNodeRef node) {
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
YGNodeStyleSetHeight(node, 10);
}
assertRelativeLayout:CGRectMake(0, 0, 3, 10)
withIntrinsicContentSize:CGSizeMake(3, UIViewNoIntrinsicMetric)];
@@ -142,10 +142,10 @@
- (void)testAssignsSuggestedHeightDimension
{
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
CSSNodeStyleSetWidth(node, 10);
[self _withShadowViewWithStyle:^(YGNodeRef node) {
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
YGNodeStyleSetWidth(node, 10);
}
assertRelativeLayout:CGRectMake(0, 0, 10, 4)
withIntrinsicContentSize:CGSizeMake(UIViewNoIntrinsicMetric, 4)];
@@ -153,11 +153,11 @@
- (void)testDoesNotOverrideDimensionStyleWithSuggestedDimensions
{
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
CSSNodeStyleSetPosition(node, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(node, CSSEdgeTop, 0);
CSSNodeStyleSetWidth(node, 10);
CSSNodeStyleSetHeight(node, 10);
[self _withShadowViewWithStyle:^(YGNodeRef node) {
YGNodeStyleSetPosition(node, YGEdgeLeft, 0);
YGNodeStyleSetPosition(node, YGEdgeTop, 0);
YGNodeStyleSetWidth(node, 10);
YGNodeStyleSetHeight(node, 10);
}
assertRelativeLayout:CGRectMake(0, 0, 10, 10)
withIntrinsicContentSize:CGSizeMake(3, 4)];
@@ -165,16 +165,16 @@
- (void)testDoesNotAssignSuggestedDimensionsWhenStyledWithFlexAttribute
{
float parentWidth = CSSNodeStyleGetWidth(self.parentView.cssNode);
float parentHeight = CSSNodeStyleGetHeight(self.parentView.cssNode);
[self _withShadowViewWithStyle:^(CSSNodeRef node) {
CSSNodeStyleSetFlex(node, 1);
float parentWidth = YGNodeStyleGetWidth(self.parentView.cssNode);
float parentHeight = YGNodeStyleGetHeight(self.parentView.cssNode);
[self _withShadowViewWithStyle:^(YGNodeRef node) {
YGNodeStyleSetFlex(node, 1);
}
assertRelativeLayout:CGRectMake(0, 0, parentWidth, parentHeight)
withIntrinsicContentSize:CGSizeMake(3, 4)];
}
- (void)_withShadowViewWithStyle:(void(^)(CSSNodeRef node))configBlock
- (void)_withShadowViewWithStyle:(void(^)(YGNodeRef node))configBlock
assertRelativeLayout:(CGRect)expectedRect
withIntrinsicContentSize:(CGSize)contentSize
{
@@ -189,7 +189,7 @@
NSStringFromCGRect(actualRect));
}
- (RCTRootShadowView *)_shadowViewWithConfig:(void(^)(CSSNodeRef node))configBlock
- (RCTRootShadowView *)_shadowViewWithConfig:(void(^)(YGNodeRef node))configBlock
{
RCTRootShadowView *shadowView = [RCTRootShadowView new];
configBlock(shadowView.cssNode);
@@ -411,6 +411,23 @@ class TextExample extends React.Component {
This very long text should be truncated with dots in the beginning.
</Text>
</UIExplorerBlock>
<UIExplorerBlock title="Include Font Padding">
<View style={{flexDirection: 'row', justifyContent: 'space-around', marginBottom: 10}}>
<View style={{alignItems: 'center'}}>
<Text style={styles.includeFontPaddingText}>
Ey
</Text>
<Text>Default</Text>
</View>
<View style={{alignItems: 'center'}}>
<Text style={[styles.includeFontPaddingText, {includeFontPadding: false, marginLeft: 10}]}>
Ey
</Text>
<Text>includeFontPadding: false</Text>
</View>
</View>
<Text>By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.</Text>
</UIExplorerBlock>
</UIExplorerPage>
);
}
@@ -421,6 +438,14 @@ var styles = StyleSheet.create({
left: 5,
backgroundColor: 'rgba(100, 100, 100, 0.3)'
},
includeFontPaddingText: {
fontSize: 120,
fontFamily: 'sans-serif',
backgroundColor: '#EEEEEE',
color: '#000000',
textAlignVertical: 'center',
alignSelf: 'center',
}
});
module.exports = TextExample;
@@ -82,7 +82,7 @@ class UIExplorerExampleList extends React.Component {
renderRow={this._renderExampleRow.bind(this)}
renderSectionHeader={this._renderSectionHeader}
enableEmptySections={true}
keyboardShouldPersistTaps={true}
keyboardShouldPersistTaps="handled"
automaticallyAdjustContentInsets={false}
keyboardDismissMode="on-drag"
/>
+1 -3
View File
@@ -35,13 +35,11 @@ var UIExplorerTitle = require('./UIExplorerTitle');
class UIExplorerPage extends React.Component {
props: {
keyboardShouldPersistTaps?: boolean,
noScroll?: boolean,
noSpacer?: boolean,
};
static propTypes = {
keyboardShouldPersistTaps: React.PropTypes.bool,
noScroll: React.PropTypes.bool,
noSpacer: React.PropTypes.bool,
};
@@ -55,7 +53,7 @@ class UIExplorerPage extends React.Component {
ContentWrapper = (ScrollView: ReactClass<any>);
// $FlowFixMe found when converting React.createClass to ES6
wrapperProps.automaticallyAdjustContentInsets = !this.props.title;
wrapperProps.keyboardShouldPersistTaps = true;
wrapperProps.keyboardShouldPersistTaps = 'handled';
wrapperProps.keyboardDismissMode = 'interactive';
}
var title = this.props.title ?
+2 -12
View File
@@ -275,15 +275,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -314,14 +310,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -331,7 +323,6 @@
buildSettings = {
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -340,7 +331,6 @@
buildSettings = {
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
+1 -1
View File
@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "UIView+React.h"
#import <React/UIView+React.h>
/**
* ART nodes are implemented as empty UIViews but this is just an implementation detail to fit
+2 -1
View File
@@ -9,8 +9,9 @@
#import "ARTSurfaceView.h"
#import <React/RCTLog.h>
#import "ARTNode.h"
#import "RCTLog.h"
@implementation ARTSurfaceView
+1 -1
View File
@@ -9,7 +9,7 @@
#import "ARTBrush.h"
#import "RCTDefines.h"
#import <React/RCTDefines.h>
@implementation ARTBrush
+2 -1
View File
@@ -9,8 +9,9 @@
#import "ARTLinearGradient.h"
#import <React/RCTLog.h>
#import "RCTConvert+ART.h"
#import "RCTLog.h"
@implementation ARTLinearGradient
{
+2 -1
View File
@@ -9,8 +9,9 @@
#import "ARTPattern.h"
#import <React/RCTLog.h>
#import "RCTConvert+ART.h"
#import "RCTLog.h"
@implementation ARTPattern
{
+2 -1
View File
@@ -9,8 +9,9 @@
#import "ARTRadialGradient.h"
#import <React/RCTLog.h>
#import "RCTConvert+ART.h"
#import "RCTLog.h"
@implementation ARTRadialGradient
{
+2 -1
View File
@@ -9,8 +9,9 @@
#import "ARTSolidColor.h"
#import <React/RCTLog.h>
#import "RCTConvert+ART.h"
#import "RCTLog.h"
@implementation ARTSolidColor
{
+2 -1
View File
@@ -9,10 +9,11 @@
#import <QuartzCore/QuartzCore.h>
#import <React/RCTConvert.h>
#import "ARTBrush.h"
#import "ARTCGFloatArray.h"
#import "ARTTextFrame.h"
#import "RCTConvert.h"
@interface RCTConvert (ART)
+3 -2
View File
@@ -9,12 +9,13 @@
#import "RCTConvert+ART.h"
#import <React/RCTFont.h>
#import <React/RCTLog.h>
#import "ARTLinearGradient.h"
#import "ARTPattern.h"
#import "ARTRadialGradient.h"
#import "ARTSolidColor.h"
#import "RCTLog.h"
#import "RCTFont.h"
@implementation RCTConvert (ART)
+17
View File
@@ -19,6 +19,7 @@ var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var createReactNativeComponentClass = require('createReactNativeComponentClass');
var merge = require('merge');
var invariant = require('fbjs/lib/invariant');
// Diff Helpers
@@ -137,6 +138,14 @@ function childrenAsString(children) {
// Surface - Root node of all ART
class Surface extends React.Component {
static childContextTypes = {
isInSurface: React.PropTypes.bool,
};
getChildContext() {
return { isInSurface: true };
}
render() {
var props = this.props;
var w = extractNumber(props.width, 0);
@@ -203,8 +212,16 @@ function extractOpacity(props) {
// ReactART.
class Group extends React.Component {
static contextTypes = {
isInSurface: React.PropTypes.bool.isRequired,
};
render() {
var props = this.props;
invariant(
this.context.isInSurface,
'ART: <Group /> must be a child of a <Surface />'
);
return (
<NativeGroup
opacity={extractOpacity(props)}
+3 -2
View File
@@ -7,8 +7,9 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "ARTNode.h"
#import "RCTViewManager.h"
#import <React/RCTViewManager.h>
@class ARTNode;
@interface ARTNodeManager : RCTViewManager
@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTViewManager.h"
#import <React/RCTViewManager.h>
@interface ARTSurfaceViewManager : RCTViewManager
@@ -132,11 +132,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Wextra",
"-Wall",
@@ -173,10 +173,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Wextra",
@@ -193,7 +193,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTActionSheet;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -205,7 +204,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTActionSheet;
RUN_CLANG_STATIC_ANALYZER = NO;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -156,11 +156,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -197,10 +197,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -216,7 +216,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -226,7 +225,6 @@
CLANG_STATIC_ANALYZER_MODE = deep;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -42,7 +42,8 @@ function shouldUseNativeDriver(config: AnimationConfig | EventConfig): boolean {
'Animated: `useNativeDriver` is not supported because the native ' +
'animated module is missing. Falling back to JS-based animation. To ' +
'resolve this, add `RCTAnimation` module to this app, or remove ' +
'`useNativeDriver`.'
'`useNativeDriver`. ' +
'More info: https://github.com/facebook/react-native/issues/11094#issuecomment-263240420'
);
warnedMissingNativeAnimated = true;
}
@@ -174,11 +174,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include/**";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -215,10 +215,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include/**";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -238,7 +238,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTCameraRoll;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -253,7 +252,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTCameraRoll;
RUN_CLANG_STATIC_ANALYZER = NO;
SKIP_INSTALL = YES;
};
name = Release;
};
+14 -2
View File
@@ -54,8 +54,7 @@ export type AnnotationDragState = $Enum<{
/**
* **IMPORTANT: This component is now DEPRECATED and will be removed
* in January 2017 (React Native version 0.42). This component only supports
* iOS.**
* in React Native version 0.42. This component only supports iOS.**
*
* **Please use
* [react-native-maps](https://github.com/airbnb/react-native-maps) by Airbnb
@@ -86,6 +85,19 @@ export type AnnotationDragState = $Enum<{
const MapView = React.createClass({
componentWillMount: function() {
console.warn(
'MapView is now deprecated and will be removed from React Native in version 0.42. ' +
'Please use the react-native-maps module which is more feature complete ' +
'and works on Android too: https://github.com/airbnb/react-native-maps\n' +
'It is actively maintained and used extensively.\n\n' +
'Once MapView is removed from React Native in v0.42, we will release the ' +
'code as deprecated-react-native-ios-mapview. You will be able to ' +
'continue using that and migrate to react-native-maps your own pace later.\n\n' +
'For more info, check out https://github.com/facebook/react-native/pull/10500'
);
},
mixins: [NativeMethodsMixin],
propTypes: {
+7 -1
View File
@@ -18,6 +18,7 @@ var StyleSheet = require('StyleSheet');
var StyleSheetPropType = require('StyleSheetPropType');
var TextStylePropTypes = require('TextStylePropTypes');
var View = require('View');
var processColor = require('processColor');
var itemStylePropType = StyleSheetPropType(TextStylePropTypes);
var requireNativeComponent = require('requireNativeComponent');
@@ -48,7 +49,11 @@ var PickerIOS = React.createClass({
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
items.push({value: child.props.value, label: child.props.label});
items.push({
value: child.props.value,
label: child.props.label,
textColor: processColor(child.props.color),
});
});
return {selectedIndex, items};
},
@@ -95,6 +100,7 @@ PickerIOS.Item = class extends React.Component {
static propTypes = {
value: React.PropTypes.any, // string or integer basically
label: React.PropTypes.string,
color: React.PropTypes.string,
};
render() {
+23 -4
View File
@@ -18,6 +18,7 @@ var ReactNative = require('ReactNative');
var Subscribable = require('Subscribable');
var TextInputState = require('TextInputState');
var UIManager = require('UIManager');
var warning = require('fbjs/lib/warning');
var { getInstanceFromNode } = require('ReactNativeComponentTree');
var { ScrollViewManager } = require('NativeModules');
@@ -134,7 +135,7 @@ var ScrollResponderMixin = {
// - Determine if the scroll view has been scrolled and therefore should
// refuse to give up its responder lock.
// - Determine if releasing should dismiss the keyboard when we are in
// tap-to-dismiss mode (!this.props.keyboardShouldPersistTaps).
// tap-to-dismiss mode (this.props.keyboardShouldPersistTaps !== 'always').
observedScrollSinceBecomingResponder: false,
becameResponderWhileAnimating: false,
};
@@ -172,7 +173,14 @@ var ScrollResponderMixin = {
* true.
*
*/
scrollResponderHandleStartShouldSetResponder: function(): boolean {
scrollResponderHandleStartShouldSetResponder: function(e: Event): boolean {
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
if (this.props.keyboardShouldPersistTaps === 'handled' &&
currentlyFocusedTextInput != null &&
e.target !== currentlyFocusedTextInput) {
return true;
}
return false;
},
@@ -190,7 +198,10 @@ var ScrollResponderMixin = {
scrollResponderHandleStartShouldSetResponderCapture: function(e: Event): boolean {
// First see if we want to eat taps while the keyboard is up
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
if (!this.props.keyboardShouldPersistTaps &&
var {keyboardShouldPersistTaps} = this.props;
var keyboardNeverPersistTaps = !keyboardShouldPersistTaps ||
keyboardShouldPersistTaps === 'never';
if (keyboardNeverPersistTaps &&
currentlyFocusedTextInput != null &&
!isTagInstanceOfTextInput(e.target)) {
return true;
@@ -250,7 +261,8 @@ var ScrollResponderMixin = {
// By default scroll views will unfocus a textField
// if another touch occurs outside of it
var currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
if (!this.props.keyboardShouldPersistTaps &&
if (this.props.keyboardShouldPersistTaps !== true &&
this.props.keyboardShouldPersistTaps !== 'always' &&
currentlyFocusedTextInput != null &&
e.target !== currentlyFocusedTextInput &&
!this.state.observedScrollSinceBecomingResponder &&
@@ -481,6 +493,13 @@ var ScrollResponderMixin = {
* The `keyboardWillShow` is called before input focus.
*/
componentWillMount: function() {
var {keyboardShouldPersistTaps} = this.props;
warning(
typeof keyboardShouldPersistTaps !== 'boolean',
`'keyboardShouldPersistTaps={${keyboardShouldPersistTaps}}' is deprecated. `
+ `Use 'keyboardShouldPersistTaps="${keyboardShouldPersistTaps ? "always" : "never"}"' instead`
);
this.keyboardWillOpenTo = null;
this.additionalScrollOffset = 0;
this.addListenerOn(Keyboard, 'keyboardWillShow', this.scrollResponderKeyboardWillShow);
+26 -5
View File
@@ -44,6 +44,21 @@ const requireNativeComponent = require('requireNativeComponent');
*
* Doesn't yet support other contained responders from blocking this scroll
* view from becoming the responder.
*
*
* `<ScrollView>` vs `<ListView>` - which one to use?
* ScrollView simply renders all its react child components at once. That
* makes it very easy to understand and use.
* On the other hand, this has a performance downside. Imagine you have a very
* long list of items you want to display, worth of couple of your ScrollViews
* heights. Creating JS components and native views upfront for all its items,
* which may not even be shown, will contribute to slow rendering of your
* screen and increased memory usage.
*
* This is where ListView comes into play. ListView renders items lazily,
* just when they are about to appear. This laziness comes at cost of a more
* complicated API, which is worth it unless you are rendering a small fixed
* set of items.
*/
const ScrollView = React.createClass({
propTypes: {
@@ -177,12 +192,18 @@ const ScrollView = React.createClass({
'on-drag',
]),
/**
* When false, tapping outside of the focused text input when the keyboard
* is up dismisses the keyboard. When true, the keyboard will not dismiss
* automatically, and the scroll view will not catch taps, but children of
* the scroll view can catch taps. The default value is false.
* Determines when the keyboard should stay visible after a tap.
*
* - 'never' (the default), tapping outside of the focused text input when the keyboard
* is up dismisses the keyboard. When this happens, children won't receive the tap.
* - 'always', the keyboard will not dismiss automatically, and the scroll view will not
* catch taps, but children of the scroll view can catch taps.
* - 'handled', the keyboard will not dismiss automatically when the tap was handled by
* a children, (or captured by an ancestor).
* - false, deprecated, use 'never' instead
* - true, deprecated, use 'always' instead
*/
keyboardShouldPersistTaps: PropTypes.bool,
keyboardShouldPersistTaps: PropTypes.oneOf(['always', 'never', 'handled', false, true]),
/**
* The maximum allowed zoom scale. The default value is 1.0.
* @platform ios
+2 -3
View File
@@ -109,7 +109,7 @@ require('RCTLog');
// Set up error handler
if (!global.__fbDisableExceptionsManager) {
function handleError(e, isFatal) {
const handleError = (e, isFatal) => {
try {
ExceptionsManager.handleException(e, isFatal);
} catch (ee) {
@@ -118,7 +118,7 @@ if (!global.__fbDisableExceptionsManager) {
/* eslint-enable no-console-disallow */
throw e;
}
}
};
const ErrorUtils = require('ErrorUtils');
ErrorUtils.setGlobalHandler(handleError);
@@ -200,7 +200,6 @@ if (__DEV__) {
}
require('RCTDebugComponentOwnership');
require('react-transform-hmr');
}
// Set up inspector
@@ -131,7 +131,7 @@ class NavigationCardStack extends React.Component<DefaultProps, Props, void> {
/**
* Custom style applied to the card.
*/
cardStyle: View.propTypes.style,
cardStyle: PropTypes.any,
/**
* Direction of the cards movement. Value could be `horizontal` or
@@ -178,7 +178,7 @@ class SwipeableListView extends React.Component {
_renderRow = (rowData: Object, sectionID: string, rowID: string): React.Element<any> => {
const slideoutView = this.props.renderQuickActions(rowData, sectionID, rowID);
// If renderRowSlideout is unspecified or returns falsey, don't allow swipe
// If renderQuickActions is unspecified or returns falsey, don't allow swipe
if (!slideoutView) {
return this.props.renderRow(rowData, sectionID, rowID);
}
@@ -132,11 +132,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -173,10 +173,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -191,9 +191,8 @@
CLANG_STATIC_ANALYZER_MODE = deep;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTGeolocation;
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -203,8 +202,7 @@
CLANG_STATIC_ANALYZER_MODE = deep;
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTGeolocation;
SKIP_INSTALL = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
@@ -27,13 +27,15 @@
2D3B5F241D9B0D1300451313 /* RCTImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 134B00A11B54232B00EC8DFB /* RCTImageUtils.m */; };
35123E6B1B59C99D00EBAD80 /* RCTImageStoreManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 35123E6A1B59C99D00EBAD80 /* RCTImageStoreManager.m */; };
354631681B69857700AA0B86 /* RCTImageEditingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 354631671B69857700AA0B86 /* RCTImageEditingManager.m */; };
3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5B01AA8C50D0002E2BE /* RCTGIFImageDecoder.h */; };
3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = EEF314701C9B0DD30049118E /* RCTImageBlurUtils.h */; };
3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = CCD34C251D4B8FE900268922 /* RCTImageCache.h */; };
3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; };
3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; };
3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; };
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; };
3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; };
3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; };
@@ -44,7 +46,7 @@
3DED3A991DE6F7A400336DD7 /* RCTImageEditingManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 354631661B69857700AA0B86 /* RCTImageEditingManager.h */; };
3DED3A9A1DE6F7A400336DD7 /* RCTImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63C1DE4B44A0058FD77 /* RCTImageLoader.h */; };
3DED3A9B1DE6F7A400336DD7 /* RCTImageStoreManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D5FA63D1DE4B44A0058FD77 /* RCTImageStoreManager.h */; };
3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DED3A9C1DE6F7A400336DD7 /* RCTImageUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 134B00A01B54232B00EC8DFB /* RCTImageUtils.h */; };
3DED3A9D1DE6F7A400336DD7 /* RCTImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A71AA8C4A30002E2BE /* RCTImageView.h */; };
3DED3A9E1DE6F7A400336DD7 /* RCTImageViewManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1304D5A91AA8C4A30002E2BE /* RCTImageViewManager.h */; };
3DED3A9F1DE6F7A400336DD7 /* RCTLocalAssetImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 13EF7F7D1BC825B1003F47DD /* RCTLocalAssetImageLoader.h */; };
@@ -53,6 +55,31 @@
EEF314721C9B0DD30049118E /* RCTImageBlurUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = EEF314711C9B0DD30049118E /* RCTImageBlurUtils.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
3D302E171DF8225500D6DDAE /* Copy Headers */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = include/RCTImage;
dstSubfolderSpec = 16;
files = (
3D302E181DF8228100D6DDAE /* RCTImageUtils.h in Copy Headers */,
);
name = "Copy Headers";
runOnlyForDeploymentPostprocessing = 0;
};
3D302F201DF8268700D6DDAE /* Copy Headers */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = include/RCTImage;
dstSubfolderSpec = 16;
files = (
3D302F211DF8269200D6DDAE /* RCTImageUtils.h in Copy Headers */,
);
name = "Copy Headers";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1304D5A71AA8C4A30002E2BE /* RCTImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageView.h; sourceTree = "<group>"; };
1304D5A81AA8C4A30002E2BE /* RCTImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageView.m; sourceTree = "<group>"; };
@@ -139,12 +166,12 @@
buildActionMask = 2147483647;
files = (
3DED3A8A1DE6F79800336DD7 /* RCTGIFImageDecoder.h in Headers */,
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */,
3DED3A8B1DE6F79800336DD7 /* RCTImageBlurUtils.h in Headers */,
3DED3A8C1DE6F79800336DD7 /* RCTImageCache.h in Headers */,
3DED3A8D1DE6F79800336DD7 /* RCTImageEditingManager.h in Headers */,
3DED3A8E1DE6F79800336DD7 /* RCTImageLoader.h in Headers */,
3DED3A8F1DE6F79800336DD7 /* RCTImageStoreManager.h in Headers */,
3DED3A901DE6F79800336DD7 /* RCTImageUtils.h in Headers */,
3DED3A911DE6F79800336DD7 /* RCTImageView.h in Headers */,
3DED3A921DE6F79800336DD7 /* RCTImageViewManager.h in Headers */,
3DED3A931DE6F79800336DD7 /* RCTLocalAssetImageLoader.h in Headers */,
@@ -178,6 +205,7 @@
buildConfigurationList = 2D2A28421D9B042B00D4039D /* Build configuration list for PBXNativeTarget "RCTImage-tvOS" */;
buildPhases = (
3DED3A951DE6F79D00336DD7 /* Headers */,
3D302F201DF8268700D6DDAE /* Copy Headers */,
2D2A28361D9B042B00D4039D /* Sources */,
);
buildRules = (
@@ -194,6 +222,7 @@
buildConfigurationList = 58B511711A9E6B3D00147676 /* Build configuration list for PBXNativeTarget "RCTImage" */;
buildPhases = (
3DED3A891DE6F78800336DD7 /* Headers */,
3D302E171DF8225500D6DDAE /* Copy Headers */,
58B511591A9E6B3D00147676 /* Sources */,
);
buildRules = (
@@ -295,7 +324,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -314,7 +342,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -358,11 +385,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -402,10 +429,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -426,7 +453,6 @@
PRODUCT_NAME = RCTImage;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -442,7 +468,6 @@
PRODUCT_NAME = RCTImage;
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTImage;
RUN_CLANG_STATIC_ANALYZER = NO;
SKIP_INSTALL = YES;
};
name = Release;
};
+20 -7
View File
@@ -236,10 +236,14 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
{
dispatch_async(_URLRequestQueue, ^{
// Remove completed tasks
NSMutableArray *tasksToRemove = nil;
for (RCTNetworkTask *task in self->_pendingTasks.reverseObjectEnumerator) {
switch (task.status) {
case RCTNetworkTaskFinished:
[self->_pendingTasks removeObject:task];
if (!tasksToRemove) {
tasksToRemove = [NSMutableArray new];
}
[tasksToRemove addObject:task];
self->_activeTasks--;
break;
case RCTNetworkTaskPending:
@@ -248,13 +252,20 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
// Check task isn't "stuck"
if (task.requestToken == nil) {
RCTLogWarn(@"Task orphaned for request %@", task.request);
[self->_pendingTasks removeObject:task];
if (!tasksToRemove) {
tasksToRemove = [NSMutableArray new];
}
[tasksToRemove addObject:task];
self->_activeTasks--;
[task cancel];
}
break;
}
}
if (tasksToRemove) {
[self->_pendingTasks removeObjectsInArray:tasksToRemove];
}
// Start queued decode
NSInteger activeDecodes = self->_scheduledDecodes - self->_pendingDecodes.count;
@@ -381,9 +392,10 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
});
return ^{
if (cancelLoad && !cancelled) {
cancelLoad();
cancelLoad = nil;
dispatch_block_t cancelLoadLocal = cancelLoad;
cancelLoad = nil;
if (cancelLoadLocal && !cancelled) {
cancelLoadLocal();
}
OSAtomicOr32Barrier(1, &cancelled);
};
@@ -515,8 +527,9 @@ static UIImage *RCTResizeImageIfNeeded(UIImage *image,
__block volatile uint32_t cancelled = 0;
__block dispatch_block_t cancelLoad = nil;
dispatch_block_t cancellationBlock = ^{
if (cancelLoad && !cancelled) {
cancelLoad();
dispatch_block_t cancelLoadLocal = cancelLoad;
if (cancelLoadLocal && !cancelled) {
cancelLoadLocal();
}
OSAtomicOr32Barrier(1, &cancelled);
};
+1 -1
View File
@@ -26,7 +26,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
* single-touch gestures resilient to extra touches, and can be used to
* recognize simple multi-touch gestures.
*
* By default, `PanResponder` holds an `InteractionManager handle to block
* By default, `PanResponder` holds an `InteractionManager` handle to block
* long-running JS events from interrupting active gestures.
*
* It provides a predictable wrapper of the responder handlers provided by the
@@ -139,7 +139,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -157,7 +156,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -196,11 +194,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -236,10 +234,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -254,7 +252,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTLinking;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -264,7 +261,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTLinking;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -292,7 +292,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -310,7 +309,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -351,11 +349,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -392,10 +390,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -410,7 +408,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTAnimation;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -420,7 +417,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTAnimation;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -181,7 +181,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -199,7 +198,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -243,11 +241,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -287,10 +285,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -307,7 +305,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTNetwork;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -318,7 +315,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTNetwork;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -92,9 +92,9 @@ export type PushNotificationEventName = $Enum<{
* }
* // Required for the notification event. You must call the completion handler after handling the remote notification.
* - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
* fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
* fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
* {
* [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
* [RCTPushNotificationManager didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
* }
* // Required for the registrationError event.
* - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
148699CF1ABD045300480536 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
3D0574931DE6009C00184BB4 /* RCTPushNotificationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 148699CE1ABD045300480536 /* RCTPushNotificationManager.m */; };
3D5FA66B1DE4B7110058FD77 /* RCTPushNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 148699CD1ABD045300480536 /* RCTPushNotificationManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -80,17 +79,6 @@
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
3D5FA66A1DE4B70C0058FD77 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
3D5FA66B1DE4B7110058FD77 /* RCTPushNotificationManager.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
3D05745E1DE6004600184BB4 /* RCTPushNotification-tvOS */ = {
isa = PBXNativeTarget;
@@ -113,7 +101,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTPushNotification" */;
buildPhases = (
3D5FA66A1DE4B70C0058FD77 /* Headers */,
58B511D71A9E6C8500147676 /* Sources */,
58B511D81A9E6C8500147676 /* Frameworks */,
58B511D91A9E6C8500147676 /* CopyFiles */,
@@ -200,7 +187,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Debug;
@@ -218,7 +204,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
name = Release;
@@ -255,11 +240,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Wextra",
"-Wall",
@@ -297,10 +282,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Wextra",
@@ -318,7 +303,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTPushNotification;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -329,7 +313,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTPushNotification;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -343,6 +326,7 @@
3D0574661DE6004600184BB4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTPushNotification" */ = {
isa = XCConfigurationList;
@@ -13,8 +13,10 @@
2D3B5F301D9B0F3D00451313 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; };
2D3B5F311D9B0F4200451313 /* UIImage+Compare.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE91AB964CD007446E2 /* UIImage+Compare.m */; };
2D3B5F321D9B0F4500451313 /* UIImage+Diff.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FEB1AB964CD007446E2 /* UIImage+Diff.m */; };
3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Public, ); }; };
3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Public, ); }; };
3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; };
3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; };
3DED3AA21DE6FC3400336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
3DED3AA41DE6FC4C00336DD7 /* RCTTestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 585135351AB3C56F00882537 /* RCTTestRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
585135371AB3C56F00882537 /* RCTTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135341AB3C56F00882537 /* RCTTestModule.m */; };
585135381AB3C57000882537 /* RCTTestRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 585135361AB3C56F00882537 /* RCTTestRunner.m */; };
58E64FED1AB964CD007446E2 /* FBSnapshotTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = 58E64FE71AB964CD007446E2 /* FBSnapshotTestController.m */; };
@@ -23,6 +25,31 @@
9913A84B1BBE833400D70E66 /* RCTSnapshotManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9913A84A1BBE833400D70E66 /* RCTSnapshotManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
3D3030271DF8299E00D6DDAE /* Copy Headers */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = include/RCTTest;
dstSubfolderSpec = 16;
files = (
3D3030281DF82A6300D6DDAE /* RCTTestRunner.h in Copy Headers */,
);
name = "Copy Headers";
runOnlyForDeploymentPostprocessing = 0;
};
3D3030291DF82A6E00D6DDAE /* Copy Headers */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = include/RCTTest;
dstSubfolderSpec = 16;
files = (
3D30302A1DF82A8300D6DDAE /* RCTTestRunner.h in Copy Headers */,
);
name = "Copy Headers";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
2D2A286E1D9B047700D4039D /* libRCTTest-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTTest-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
580C376F1AB104AF0015E709 /* libRCTTest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTTest.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -127,6 +154,7 @@
buildConfigurationList = 2D2A28761D9B047700D4039D /* Build configuration list for PBXNativeTarget "RCTTest-tvOS" */;
buildPhases = (
3DED3AA31DE6FC4700336DD7 /* Headers */,
3D3030291DF82A6E00D6DDAE /* Copy Headers */,
2D2A286A1D9B047700D4039D /* Sources */,
2D2A286B1D9B047700D4039D /* Frameworks */,
);
@@ -144,6 +172,7 @@
buildConfigurationList = 580C37831AB104AF0015E709 /* Build configuration list for PBXNativeTarget "RCTTest" */;
buildPhases = (
3DED3AA11DE6FC2200336DD7 /* Headers */,
3D3030271DF8299E00D6DDAE /* Copy Headers */,
580C376B1AB104AF0015E709 /* Sources */,
580C376C1AB104AF0015E709 /* Frameworks */,
);
@@ -236,7 +265,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -255,7 +283,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -295,11 +322,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -336,10 +363,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -360,7 +387,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -375,7 +401,6 @@
);
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include/RCTTest;
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -139,7 +139,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -157,7 +156,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -197,11 +195,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -238,10 +236,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -256,7 +254,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTSettings;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -266,7 +263,6 @@
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RCTSettings;
SKIP_INSTALL = YES;
};
name = Release;
};
+21 -21
View File
@@ -39,16 +39,16 @@ CGFloat const RCTTextAutoSizeGranularity = 0.001f;
CGFloat _effectiveLetterSpacing;
}
static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode)
static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
{
RCTShadowText *shadowText = (__bridge RCTShadowText *)CSSNodeGetContext(node);
RCTShadowText *shadowText = (__bridge RCTShadowText *)YGNodeGetContext(node);
NSTextStorage *textStorage = [shadowText buildTextStorageForWidth:width widthMode:widthMode];
[shadowText calculateTextFrame:textStorage];
NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
CGSize computedSize = [layoutManager usedRectForTextContainer:textContainer].size;
CSSSize result;
YGSize result;
result.width = RCTCeilPixelValue(computedSize.width);
if (shadowText->_effectiveLetterSpacing < 0) {
result.width -= shadowText->_effectiveLetterSpacing;
@@ -68,7 +68,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
_cachedTextStorageWidth = -1;
_cachedTextStorageWidthMode = -1;
_fontSizeMultiplier = 1.0;
CSSNodeSetMeasureFunc(self.cssNode, RCTMeasure);
YGNodeSetMeasureFunc(self.cssNode, RCTMeasure);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentSizeMultiplierDidChange:)
name:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
@@ -95,7 +95,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
- (void)contentSizeMultiplierDidChange:(NSNotification *)note
{
CSSNodeMarkDirty(self.cssNode);
YGNodeMarkDirty(self.cssNode);
[self dirtyText];
}
@@ -114,7 +114,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
NSNumber *parentTag = [[self reactSuperview] reactTag];
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:CSSMeasureModeExactly];
NSTextStorage *textStorage = [self buildTextStorageForWidth:width widthMode:YGMeasureModeExactly];
CGRect textFrame = [self calculateTextFrame:textStorage];
BOOL selectable = _selectable;
[applierBlocks addObject:^(NSDictionary<NSNumber *, UIView *> *viewRegistry) {
@@ -140,7 +140,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
return parentProperties;
}
- (void)applyLayoutNode:(CSSNodeRef)node
- (void)applyLayoutNode:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition
{
@@ -148,22 +148,22 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
[self dirtyPropagation];
}
- (void)applyLayoutToChildren:(CSSNodeRef)node
- (void)applyLayoutToChildren:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition
{
// Run layout on subviews.
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:CSSMeasureModeExactly];
NSTextStorage *textStorage = [self buildTextStorageForWidth:self.frame.size.width widthMode:YGMeasureModeExactly];
NSLayoutManager *layoutManager = textStorage.layoutManagers.firstObject;
NSTextContainer *textContainer = layoutManager.textContainers.firstObject;
NSRange glyphRange = [layoutManager glyphRangeForTextContainer:textContainer];
NSRange characterRange = [layoutManager characterRangeForGlyphRange:glyphRange actualGlyphRange:NULL];
[layoutManager.textStorage enumerateAttribute:RCTShadowViewAttributeName inRange:characterRange options:0 usingBlock:^(RCTShadowView *child, NSRange range, BOOL *_) {
if (child) {
CSSNodeRef childNode = child.cssNode;
float width = CSSNodeStyleGetWidth(childNode);
float height = CSSNodeStyleGetHeight(childNode);
if (CSSValueIsUndefined(width) || CSSValueIsUndefined(height)) {
YGNodeRef childNode = child.cssNode;
float width = YGNodeStyleGetWidth(childNode);
float height = YGNodeStyleGetHeight(childNode);
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
RCTLogError(@"Views nested within a <Text> must have a width and height");
}
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
@@ -187,7 +187,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
}];
}
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode
{
if (_cachedTextStorage && width == _cachedTextStorageWidth && widthMode == _cachedTextStorageWidthMode) {
return _cachedTextStorage;
@@ -208,7 +208,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
}
textContainer.maximumNumberOfLines = _numberOfLines;
textContainer.size = (CGSize){widthMode == CSSMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
textContainer.size = (CGSize){widthMode == YGMeasureModeUndefined ? CGFLOAT_MAX : width, CGFLOAT_MAX};
[layoutManager addTextContainer:textContainer];
[layoutManager ensureLayoutForTextContainer:textContainer];
@@ -307,9 +307,9 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:shadowRawText.text ?: @""]];
[child setTextComputed];
} else {
float width = CSSNodeStyleGetWidth(child.cssNode);
float height = CSSNodeStyleGetHeight(child.cssNode);
if (CSSValueIsUndefined(width) || CSSValueIsUndefined(height)) {
float width = YGNodeStyleGetWidth(child.cssNode);
float height = YGNodeStyleGetHeight(child.cssNode);
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
RCTLogError(@"Views nested within a <Text> must have a width and height");
}
NSTextAttachment *attachment = [NSTextAttachment new];
@@ -348,7 +348,7 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
// create a non-mutable attributedString for use by the Text system which avoids copies down the line
_cachedAttributedString = [[NSAttributedString alloc] initWithAttributedString:attributedString];
CSSNodeMarkDirty(self.cssNode);
YGNodeMarkDirty(self.cssNode);
return _cachedAttributedString;
}
@@ -403,10 +403,10 @@ static CSSSize RCTMeasure(CSSNodeRef node, float width, CSSMeasureMode widthMode
// We will climb up to the first node which style has been setted as non-inherit
if (newTextAlign == NSTextAlignmentRight || newTextAlign == NSTextAlignmentLeft) {
RCTShadowView *view = self;
while (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionInherit) {
while (view != nil && YGNodeStyleGetDirection(view.cssNode) == YGDirectionInherit) {
view = [view reactSuperview];
}
if (view != nil && CSSNodeStyleGetDirection(view.cssNode) == CSSDirectionRTL) {
if (view != nil && YGNodeStyleGetDirection(view.cssNode) == YGDirectionRTL) {
if (newTextAlign == NSTextAlignmentRight) {
newTextAlign = NSTextAlignmentLeft;
} else if (newTextAlign == NSTextAlignmentLeft) {
@@ -221,7 +221,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -239,7 +238,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -279,11 +277,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -320,10 +318,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -339,7 +337,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -349,7 +346,6 @@
CLANG_STATIC_ANALYZER_MODE = deep;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
+2 -2
View File
@@ -9,7 +9,7 @@
#import "RCTTextManager.h"
#import <CSSLayout/CSSLayout.h>
#import <yoga/Yoga.h>
#import <React/RCTAccessibilityManager.h>
#import <React/RCTAssert.h>
#import <React/RCTConvert.h>
@@ -35,7 +35,7 @@ static void collectDirtyNonTextDescendants(RCTShadowText *shadowView, NSMutableA
@interface RCTShadowText (Private)
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(CSSMeasureMode)widthMode;
- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureMode)widthMode;
@end
+7
View File
@@ -66,6 +66,13 @@ const TextStylePropTypes = {
textAlignVertical: ReactPropTypes.oneOf(
['auto' /*default*/, 'top', 'bottom', 'center']
),
/**
* Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders.
* With some fonts, this padding can make text look slightly misaligned when centered vertically.
* For best results also set `textAlignVertical` to `center`. Default is true.
* @platform android
*/
includeFontPadding: ReactPropTypes.bool,
textDecorationLine: ReactPropTypes.oneOf(
['none' /*default*/, 'underline', 'line-through', 'underline line-through']
),
+39 -40
View File
@@ -102,13 +102,13 @@ var ARGUMENT_NAMES_RE = /([^\s,]+)/g;
*
* inline(inlineMe, ['hi', 'bye']); // "hi = bye + bye;"
*
* @param {function} func Any simple function who's arguments can be replaced via a regex.
* @param {string} fnStr Source of any simple function who's arguments can be
* replaced via a regex.
* @param {array<string>} replaceWithArgs Corresponding names of variables
* within an environment, to replace `func` args with.
* @return {string} Resulting function body string.
*/
var inline = function(func, replaceWithArgs) {
var fnStr = func.toString();
var inline = function(fnStr, replaceWithArgs) {
var parameterNames = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')'))
.match(ARGUMENT_NAMES_RE) ||
[];
@@ -126,11 +126,10 @@ var inline = function(func, replaceWithArgs) {
};
/**
* Simply a convenient way to inline functions using the function's toString
* method.
* Simply a convenient way to inline functions using the inline function.
*/
var MatrixOps = {
unroll: function(matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
unroll: `function(matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
m0 = matVar[0];
m1 = matVar[1];
m2 = matVar[2];
@@ -147,29 +146,29 @@ var MatrixOps = {
m13 = matVar[13];
m14 = matVar[14];
m15 = matVar[15];
},
}`,
matrixDiffers: function(retVar, matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
matrixDiffers: `function(retVar, matVar, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
retVar = retVar ||
m0 !== matVar[0] ||
m1 !== matVar[1] ||
m2 !== matVar[2] ||
m3 !== matVar[3] ||
m4 !== matVar[4] ||
m5 !== matVar[5] ||
m6 !== matVar[6] ||
m7 !== matVar[7] ||
m8 !== matVar[8] ||
m9 !== matVar[9] ||
m10 !== matVar[10] ||
m11 !== matVar[11] ||
m12 !== matVar[12] ||
m13 !== matVar[13] ||
m14 !== matVar[14] ||
m15 !== matVar[15];
},
m0 !== matVar[0] ||
m1 !== matVar[1] ||
m2 !== matVar[2] ||
m3 !== matVar[3] ||
m4 !== matVar[4] ||
m5 !== matVar[5] ||
m6 !== matVar[6] ||
m7 !== matVar[7] ||
m8 !== matVar[8] ||
m9 !== matVar[9] ||
m10 !== matVar[10] ||
m11 !== matVar[11] ||
m12 !== matVar[12] ||
m13 !== matVar[13] ||
m14 !== matVar[14] ||
m15 !== matVar[15];
}`,
transformScale: function(matVar, opVar) {
transformScale: `function(matVar, opVar) {
// Scaling matVar by opVar
var x = opVar[0];
var y = opVar[1];
@@ -190,13 +189,13 @@ var MatrixOps = {
matVar[13] = matVar[13];
matVar[14] = matVar[14];
matVar[15] = matVar[15];
},
}`,
/**
* All of these matrix transforms are not general purpose utilities, and are
* only suitable for being inlined for the use of building up interpolators.
*/
transformTranslate: function(matVar, opVar) {
transformTranslate: `function(matVar, opVar) {
// Translating matVar by opVar
var x = opVar[0];
var y = opVar[1];
@@ -205,13 +204,13 @@ var MatrixOps = {
matVar[13] = matVar[1] * x + matVar[5] * y + matVar[9] * z + matVar[13];
matVar[14] = matVar[2] * x + matVar[6] * y + matVar[10] * z + matVar[14];
matVar[15] = matVar[3] * x + matVar[7] * y + matVar[11] * z + matVar[15];
},
}`,
/**
* @param {array} matVar Both the input, and the output matrix.
* @param {quaternion specification} q Four element array describing rotation.
*/
transformRotateRadians: function(matVar, q) {
transformRotateRadians: `function(matVar, q) {
// Rotating matVar by q
var xQuat = q[0], yQuat = q[1], zQuat = q[2], wQuat = q[3];
var x2Quat = xQuat + xQuat;
@@ -226,7 +225,7 @@ var MatrixOps = {
var wxQuat = wQuat * x2Quat;
var wyQuat = wQuat * y2Quat;
var wzQuat = wQuat * z2Quat;
// Step 1: Inlines the construction of a quaternion matrix (`quatMat`)
// Step 1: Inlines the construction of a quaternion matrix ('quatMat')
var quatMat0 = 1 - (yyQuat + zzQuat);
var quatMat1 = xyQuat + wzQuat;
var quatMat2 = xzQuat - wyQuat;
@@ -267,13 +266,13 @@ var MatrixOps = {
matVar[9] = b0 * a01 + b1 * a11 + b2 * a21;
matVar[10] = b0 * a02 + b1 * a12 + b2 * a22;
matVar[11] = b0 * a03 + b1 * a13 + b2 * a23;
}
}`
};
// Optimized version of general operation applications that can be used when
// the target matrix is known to be the identity matrix.
var MatrixOpsInitial = {
transformScale: function(matVar, opVar) {
transformScale: `function(matVar, opVar) {
// Scaling matVar known to be identity by opVar
matVar[0] = opVar[0];
matVar[1] = 0;
@@ -291,10 +290,10 @@ var MatrixOpsInitial = {
matVar[13] = 0;
matVar[14] = 0;
matVar[15] = 1;
},
}`,
transformTranslate: function(matVar, opVar) {
// Translating matVar known to be identity by opVar';
transformTranslate: `function(matVar, opVar) {
// Translating matVar known to be identity by opVar;
matVar[0] = 1;
matVar[1] = 0;
matVar[2] = 0;
@@ -311,14 +310,14 @@ var MatrixOpsInitial = {
matVar[13] = opVar[1];
matVar[14] = opVar[2];
matVar[15] = 1;
},
}`,
/**
* @param {array} matVar Both the input, and the output matrix - assumed to be
* identity.
* @param {quaternion specification} q Four element array describing rotation.
*/
transformRotateRadians: function(matVar, q) {
transformRotateRadians: `function(matVar, q) {
// Rotating matVar which is known to be identity by q
var xQuat = q[0], yQuat = q[1], zQuat = q[2], wQuat = q[3];
@@ -334,7 +333,7 @@ var MatrixOpsInitial = {
var wxQuat = wQuat * x2Quat;
var wyQuat = wQuat * y2Quat;
var wzQuat = wQuat * z2Quat;
// Step 1: Inlines the construction of a quaternion matrix (`quatMat`)
// Step 1: Inlines the construction of a quaternion matrix ('quatMat')
var quatMat0 = 1 - (yyQuat + zzQuat);
var quatMat1 = xyQuat + wzQuat;
var quatMat2 = xzQuat - wyQuat;
@@ -366,7 +365,7 @@ var MatrixOpsInitial = {
matVar[13] = 0;
matVar[14] = 0;
matVar[15] = 1;
}
}`
};
@@ -131,11 +131,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -171,10 +171,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -190,7 +190,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
RUN_CLANG_STATIC_ANALYZER = YES;
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -200,7 +199,6 @@
CLANG_STATIC_ANALYZER_MODE = deep;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -11,10 +11,10 @@
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
2D3B5F3F1D9B165B00451313 /* RCTWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */; };
2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; };
2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; };
3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; };
3DB9106F1C74B1ED00838BBE /* RCTWebSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */; };
3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -26,8 +26,8 @@
3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; };
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketModule.h; sourceTree = "<group>"; };
3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketModule.m; sourceTree = "<group>"; tabWidth = 2; };
3DB9106D1C74B1ED00838BBE /* RCTWebSocketManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketManager.h; sourceTree = "<group>"; };
3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketManager.m; sourceTree = "<group>"; };
3DB9106D1C74B1ED00838BBE /* RCTWebSocketObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketObserver.h; sourceTree = "<group>"; };
3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketObserver.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@@ -38,8 +38,8 @@
1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */,
1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */,
1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */,
3DB9106D1C74B1ED00838BBE /* RCTWebSocketManager.h */,
3DB9106E1C74B1ED00838BBE /* RCTWebSocketManager.m */,
3DB9106D1C74B1ED00838BBE /* RCTWebSocketObserver.h */,
3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */,
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */,
3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */,
3C86DF471ADF2C930047B81A /* Products */,
@@ -134,7 +134,7 @@
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */,
2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */,
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */,
2D3B5F3F1D9B165B00451313 /* RCTWebSocketManager.m in Sources */,
2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -145,7 +145,7 @@
1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */,
3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */,
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */,
3DB9106F1C74B1ED00838BBE /* RCTWebSocketManager.m in Sources */,
3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -164,7 +164,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
@@ -179,7 +178,6 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
@@ -221,11 +219,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
WARNING_CFLAGS = (
"-Werror",
"-Wall",
@@ -264,10 +262,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/usr/local/include";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
VALIDATE_PRODUCT = YES;
WARNING_CFLAGS = (
"-Werror",
@@ -283,7 +281,6 @@
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
@@ -294,7 +291,6 @@
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
@@ -141,6 +141,7 @@ RCT_EXPORT_MODULE()
RCTWSMessageCallback callback = _callbacks[messageID];
if (callback) {
callback(error, reply);
[_callbacks removeObjectForKey:messageID];
}
}
-152
View File
@@ -1,152 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTWebSocketManager.h"
#import <React/RCTConvert.h>
#import <React/RCTDefines.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import "RCTSRWebSocket.h"
#if RCT_DEV // Only supported in dev mode
#pragma mark - RCTWebSocketObserver
@interface RCTWebSocketObserver : NSObject <RCTSRWebSocketDelegate> {
NSURL *_url;
}
@property (nonatomic, strong) RCTSRWebSocket *socket;
@property (nonatomic, weak) id<RCTWebSocketProxyDelegate> delegate;
@property (nonatomic, strong) dispatch_semaphore_t socketOpenSemaphore;
- (instancetype)initWithURL:(NSURL *)url delegate:(id<RCTWebSocketProxyDelegate>)delegate;
@end
@implementation RCTWebSocketObserver
- (instancetype)initWithURL:(NSURL *)url delegate:(id<RCTWebSocketProxyDelegate>)delegate
{
if ((self = [self init])) {
_url = url;
_delegate = delegate;
}
return self;
}
- (void)start
{
[self stop];
_socket = [[RCTSRWebSocket alloc] initWithURL:_url];
_socket.delegate = self;
[_socket open];
}
- (void)stop
{
_socket.delegate = nil;
[_socket closeWithCode:1000 reason:@"Invalidated"];
_socket = nil;
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
{
if (_delegate) {
NSError *error = nil;
NSDictionary<NSString *, id> *msg = RCTJSONParse(message, &error);
if (!error) {
[_delegate socketProxy:[RCTWebSocketManager sharedInstance] didReceiveMessage:msg];
} else {
RCTLogError(@"WebSocketManager failed to parse message with error %@\n<message>\n%@\n</message>", error, message);
}
}
}
- (void)reconnect
{
__weak RCTSRWebSocket *socket = _socket;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Only reconnect if the observer wasn't stoppped while we were waiting
if (socket) {
[self start];
}
});
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
{
[self reconnect];
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
[self reconnect];
}
@end
#pragma mark - RCTWebSocketManager
@interface RCTWebSocketManager()
@property (nonatomic, strong) NSMutableDictionary *sockets;
@property (nonatomic, strong) dispatch_queue_t queue;
@end
@implementation RCTWebSocketManager
+ (instancetype)sharedInstance
{
static RCTWebSocketManager *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [self new];
});
return sharedInstance;
}
- (void)setDelegate:(id<RCTWebSocketProxyDelegate>)delegate forURL:(NSURL *)url
{
NSString *key = [url absoluteString];
RCTWebSocketObserver *observer = _sockets[key];
if (observer) {
if (!delegate) {
[observer stop];
[_sockets removeObjectForKey:key];
} else {
observer.delegate = delegate;
}
} else {
RCTWebSocketObserver *newObserver = [[RCTWebSocketObserver alloc] initWithURL:url delegate:delegate];
[newObserver start];
_sockets[key] = newObserver;
}
}
- (instancetype)init
{
if ((self = [super init])) {
_sockets = [NSMutableDictionary new];
_queue = dispatch_queue_create("com.facebook.react.WebSocketManager", DISPATCH_QUEUE_SERIAL);
}
return self;
}
@end
#endif
@@ -8,11 +8,11 @@
*/
#import <React/RCTDefines.h>
#import <React/RCTWebSocketProxy.h>
#import <React/RCTWebSocketObserverProtocol.h>
#if RCT_DEV // Only supported in dev mode
@interface RCTWebSocketManager : NSObject <RCTWebSocketProxy>
@interface RCTWebSocketObserver : NSObject <RCTWebSocketObserver>
@end
#endif
@@ -0,0 +1,92 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTWebSocketObserver.h"
#import <React/RCTConvert.h>
#import <React/RCTDefines.h>
#import <React/RCTLog.h>
#import <React/RCTUtils.h>
#import "RCTSRWebSocket.h"
#if RCT_DEV // Only supported in dev mode
@interface RCTWebSocketObserver () <RCTSRWebSocketDelegate>
@end
@implementation RCTWebSocketObserver {
NSURL *_url;
RCTSRWebSocket *_socket;
}
@synthesize delegate = _delegate;
- (instancetype)initWithURL:(NSURL *)url
{
if ((self = [self init])) {
_url = url;
}
return self;
}
- (void)start
{
[self stop];
_socket = [[RCTSRWebSocket alloc] initWithURL:_url];
_socket.delegate = self;
[_socket open];
}
- (void)stop
{
_socket.delegate = nil;
[_socket closeWithCode:1000 reason:@"Invalidated"];
_socket = nil;
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
{
if (_delegate) {
NSError *error = nil;
NSDictionary<NSString *, id> *msg = RCTJSONParse(message, &error);
if (!error) {
[_delegate didReceiveWebSocketMessage:msg];
} else {
RCTLogError(@"WebSocketManager failed to parse message with error %@\n<message>\n%@\n</message>", error, message);
}
}
}
- (void)reconnect
{
__weak RCTSRWebSocket *socket = _socket;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Only reconnect if the observer wasn't stoppped while we were waiting
if (socket) {
[self start];
}
});
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
{
[self reconnect];
}
- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
[self reconnect];
}
@end
#endif
+6 -6
View File
@@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = "React"
s.version = package['version']
s.version = "0.40.0"
s.summary = package['description']
s.description = <<-DESC
React Native apps are built using the React JS
@@ -31,10 +31,10 @@ Pod::Spec.new do |s|
s.preserve_paths = "cli.js", "Libraries/**/*.js", "lint", "linter.js", "node_modules", "package.json", "packager", "PATENTS", "react-native-cli"
s.subspec 'Core' do |ss|
ss.dependency 'React/CSSLayout'
ss.dependency 'React/yoga'
ss.dependency 'React/cxxreact'
ss.source_files = "React/**/*.{c,h,m,mm,S}"
ss.exclude_files = "**/__tests__/*", "IntegrationTests/* ReactCommon/CSSLayout/*"
ss.exclude_files = "**/__tests__/*", "IntegrationTests/*", "ReactCommon/yoga/*"
ss.frameworks = "JavaScriptCore"
ss.libraries = "stdc++"
end
@@ -50,9 +50,9 @@ Pod::Spec.new do |s|
ss.header_dir = 'cxxreact'
end
s.subspec 'CSSLayout' do |ss|
ss.source_files = 'ReactCommon/CSSLayout/**/*.{c,h}'
ss.header_dir = 'CSSLayout'
s.subspec 'yoga' do |ss|
ss.source_files = 'ReactCommon/yoga/**/*.{c,h}'
ss.header_dir = 'yoga'
end
s.subspec 'ART' do |ss|
+1 -7
View File
@@ -20,12 +20,6 @@
@class RCTEventDispatcher;
@class RCTPerformanceLogger;
/**
* This notification triggers a reload of all bridges currently running.
* Deprecated, use RCTBridge::requestReload instead.
*/
RCT_EXTERN NSString *const RCTReloadNotification DEPRECATED_ATTRIBUTE;
/**
* This notification fires when the bridge starts loading the JS bundle.
*/
@@ -203,7 +197,7 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass);
/**
* Inform the bridge, and anything subscribing to it, that it should reload.
*/
- (void)requestReload;
- (void)requestReload __deprecated_msg("Call reload instead");
/**
* Says whether bridge has started recieving calls from javascript.
+10 -13
View File
@@ -14,14 +14,13 @@
#import "RCTConvert.h"
#import "RCTEventDispatcher.h"
#import "RCTKeyCommands.h"
#import "RCTLog.h"
#import "RCTModuleData.h"
#import "RCTPerformanceLogger.h"
#import "RCTProfile.h"
#import "RCTReloadCommand.h"
#import "RCTUtils.h"
NSString *const RCTReloadNotification = @"RCTReloadNotification";
NSString *const RCTJavaScriptWillStartLoadingNotification = @"RCTJavaScriptWillStartLoadingNotification";
NSString *const RCTJavaScriptDidLoadNotification = @"RCTJavaScriptDidLoadNotification";
NSString *const RCTJavaScriptDidFailToLoadNotification = @"RCTJavaScriptDidFailToLoadNotification";
@@ -120,6 +119,9 @@ void RCTVerifyAllModulesExported(NSArray *extraModules)
}
#endif
@interface RCTBridge () <RCTReloadListener>
@end
@implementation RCTBridge
{
NSURL *_delegateBundleURL;
@@ -200,7 +202,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
* This runs only on the main thread, but crashes the subclass
* RCTAssertMainQueue();
*/
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self invalidate];
}
@@ -209,18 +210,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
RCTAssertMainQueue();
#if TARGET_IPHONE_SIMULATOR
RCTKeyCommands *commands = [RCTKeyCommands sharedInstance];
// reload in current mode
__weak typeof(self) weakSelf = self;
[commands registerKeyCommandWithInput:@"r"
modifierFlags:UIKeyModifierCommand
action:^(__unused UIKeyCommand *command) {
[weakSelf requestReload];
}];
RCTRegisterReloadCommandListener(self);
#endif
}
- (void)didReceiveReloadCommand
{
[self reload];
}
- (NSArray<Class> *)moduleClasses
{
return self.batchedBridge.moduleClasses;
@@ -273,7 +271,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
- (void)requestReload
{
[[NSNotificationCenter defaultCenter] postNotificationName:RCTReloadNotification object:self];
[self reload];
}
+7 -7
View File
@@ -10,7 +10,7 @@
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#import <CSSLayout/CSSLayout.h>
#import <yoga/Yoga.h>
#import <React/RCTAnimationType.h>
#import <React/RCTBorderStyle.h>
#import <React/RCTDefines.h>
@@ -109,13 +109,13 @@ typedef id NSPropertyList;
+ (NSPropertyList)NSPropertyList:(id)json;
typedef BOOL css_backface_visibility_t;
+ (CSSOverflow)CSSOverflow:(id)json;
+ (YGOverflow)YGOverflow:(id)json;
+ (css_backface_visibility_t)css_backface_visibility_t:(id)json;
+ (CSSFlexDirection)CSSFlexDirection:(id)json;
+ (CSSJustify)CSSJustify:(id)json;
+ (CSSAlign)CSSAlign:(id)json;
+ (CSSPositionType)CSSPositionType:(id)json;
+ (CSSWrap)CSSWrap:(id)json;
+ (YGFlexDirection)YGFlexDirection:(id)json;
+ (YGJustify)YGJustify:(id)json;
+ (YGAlign)YGAlign:(id)json;
+ (YGPositionType)YGPositionType:(id)json;
+ (YGWrap)YGWrap:(id)json;
+ (RCTPointerEvents)RCTPointerEvents:(id)json;
+ (RCTAnimationType)RCTAnimationType:(id)json;
+33 -33
View File
@@ -614,44 +614,44 @@ RCT_ENUM_CONVERTER(css_backface_visibility_t, (@{
@"visible": @YES
}), YES, boolValue)
RCT_ENUM_CONVERTER(CSSOverflow, (@{
@"hidden": @(CSSOverflowHidden),
@"visible": @(CSSOverflowVisible),
@"scroll": @(CSSOverflowScroll),
}), CSSOverflowVisible, intValue)
RCT_ENUM_CONVERTER(YGOverflow, (@{
@"hidden": @(YGOverflowHidden),
@"visible": @(YGOverflowVisible),
@"scroll": @(YGOverflowScroll),
}), YGOverflowVisible, intValue)
RCT_ENUM_CONVERTER(CSSFlexDirection, (@{
@"row": @(CSSFlexDirectionRow),
@"row-reverse": @(CSSFlexDirectionRowReverse),
@"column": @(CSSFlexDirectionColumn),
@"column-reverse": @(CSSFlexDirectionColumnReverse)
}), CSSFlexDirectionColumn, intValue)
RCT_ENUM_CONVERTER(YGFlexDirection, (@{
@"row": @(YGFlexDirectionRow),
@"row-reverse": @(YGFlexDirectionRowReverse),
@"column": @(YGFlexDirectionColumn),
@"column-reverse": @(YGFlexDirectionColumnReverse)
}), YGFlexDirectionColumn, intValue)
RCT_ENUM_CONVERTER(CSSJustify, (@{
@"flex-start": @(CSSJustifyFlexStart),
@"flex-end": @(CSSJustifyFlexEnd),
@"center": @(CSSJustifyCenter),
@"space-between": @(CSSJustifySpaceBetween),
@"space-around": @(CSSJustifySpaceAround)
}), CSSJustifyFlexStart, intValue)
RCT_ENUM_CONVERTER(YGJustify, (@{
@"flex-start": @(YGJustifyFlexStart),
@"flex-end": @(YGJustifyFlexEnd),
@"center": @(YGJustifyCenter),
@"space-between": @(YGJustifySpaceBetween),
@"space-around": @(YGJustifySpaceAround)
}), YGJustifyFlexStart, intValue)
RCT_ENUM_CONVERTER(CSSAlign, (@{
@"flex-start": @(CSSAlignFlexStart),
@"flex-end": @(CSSAlignFlexEnd),
@"center": @(CSSAlignCenter),
@"auto": @(CSSAlignAuto),
@"stretch": @(CSSAlignStretch)
}), CSSAlignFlexStart, intValue)
RCT_ENUM_CONVERTER(YGAlign, (@{
@"flex-start": @(YGAlignFlexStart),
@"flex-end": @(YGAlignFlexEnd),
@"center": @(YGAlignCenter),
@"auto": @(YGAlignAuto),
@"stretch": @(YGAlignStretch)
}), YGAlignFlexStart, intValue)
RCT_ENUM_CONVERTER(CSSPositionType, (@{
@"absolute": @(CSSPositionTypeAbsolute),
@"relative": @(CSSPositionTypeRelative)
}), CSSPositionTypeRelative, intValue)
RCT_ENUM_CONVERTER(YGPositionType, (@{
@"absolute": @(YGPositionTypeAbsolute),
@"relative": @(YGPositionTypeRelative)
}), YGPositionTypeRelative, intValue)
RCT_ENUM_CONVERTER(CSSWrap, (@{
@"wrap": @(CSSWrapWrap),
@"nowrap": @(CSSWrapNoWrap)
}), CSSWrapNoWrap, intValue)
RCT_ENUM_CONVERTER(YGWrap, (@{
@"wrap": @(YGWrapWrap),
@"nowrap": @(YGWrapNoWrap)
}), YGWrapNoWrap, intValue)
RCT_ENUM_CONVERTER(RCTPointerEvents, (@{
@"none": @(RCTPointerEventsNone),
@@ -7,14 +7,13 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
#import <React/RCTDefines.h>
#if RCT_DEV // Only supported in dev mode
@protocol RCTWebSocketProxy;
@protocol RCTWebSocketProxyDelegate
- (void)socketProxy:(id<RCTWebSocketProxy>)sender didReceiveMessage:(NSDictionary<NSString *, id> *)message;
@protocol RCTReloadListener
- (void)didReceiveReloadCommand;
@end
#endif
/** Registers a weakly-held observer of the Command+R reload key command. */
RCT_EXTERN void RCTRegisterReloadCommandListener(id<RCTReloadListener> listener);
+37
View File
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTReloadCommand.h"
#import "RCTKeyCommands.h"
void RCTRegisterReloadCommandListener(id<RCTReloadListener> listener)
{
static NSHashTable<id<RCTReloadListener>> *listeners;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
listeners = [NSHashTable weakObjectsHashTable];
[[RCTKeyCommands sharedInstance] registerKeyCommandWithInput:@"r"
modifierFlags:UIKeyModifierCommand
action:
^(__unused UIKeyCommand *command) {
NSArray<id<RCTReloadListener>> *copiedListeners;
@synchronized (listeners) { // avoid mutation-while-enumerating
copiedListeners = [listeners allObjects];
}
for (id<RCTReloadListener> l in copiedListeners) {
[l didReceiveReloadCommand];
}
}];
});
@synchronized (listeners) {
[listeners addObject:listener];
}
}
@@ -8,18 +8,18 @@
*/
#import <React/RCTDefines.h>
#import <React/RCTWebSocketProxyDelegate.h>
#if RCT_DEV // Only supported in dev mode
@protocol RCTWebSocketProxy
+ (instancetype)sharedInstance;
- (void)setDelegate:(id<RCTWebSocketProxyDelegate>)delegate forURL:(NSURL *)url;
- (instancetype)init __attribute__((unavailable("init not available, call sharedInstance instead")));
@protocol RCTWebSocketObserverDelegate
- (void)didReceiveWebSocketMessage:(NSDictionary<NSString *, id> *)message;
@end
@protocol RCTWebSocketObserver
- (instancetype)initWithURL:(NSURL *)url;
@property (nonatomic, weak) id<RCTWebSocketObserverDelegate> delegate;
- (void)start;
- (void)stop;
@end
#endif
File diff suppressed because it is too large Load Diff
+108
View File
@@ -0,0 +1,108 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
typedef enum YGFlexDirection {
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRow,
YGFlexDirectionRowReverse,
YGFlexDirectionCount,
} YGFlexDirection;
typedef enum YGMeasureMode {
YGMeasureModeUndefined,
YGMeasureModeExactly,
YGMeasureModeAtMost,
YGMeasureModeCount,
} YGMeasureMode;
typedef enum YGPrintOptions {
YGPrintOptionsLayout = 1,
YGPrintOptionsStyle = 2,
YGPrintOptionsChildren = 4,
YGPrintOptionsCount,
} YGPrintOptions;
typedef enum YGEdge {
YGEdgeLeft,
YGEdgeTop,
YGEdgeRight,
YGEdgeBottom,
YGEdgeStart,
YGEdgeEnd,
YGEdgeHorizontal,
YGEdgeVertical,
YGEdgeAll,
YGEdgeCount,
} YGEdge;
typedef enum YGPositionType {
YGPositionTypeRelative,
YGPositionTypeAbsolute,
YGPositionTypeCount,
} YGPositionType;
typedef enum YGDimension {
YGDimensionWidth,
YGDimensionHeight,
YGDimensionCount,
} YGDimension;
typedef enum YGJustify {
YGJustifyFlexStart,
YGJustifyCenter,
YGJustifyFlexEnd,
YGJustifySpaceBetween,
YGJustifySpaceAround,
YGJustifyCount,
} YGJustify;
typedef enum YGDirection {
YGDirectionInherit,
YGDirectionLTR,
YGDirectionRTL,
YGDirectionCount,
} YGDirection;
typedef enum YGLogLevel {
YGLogLevelError,
YGLogLevelWarn,
YGLogLevelInfo,
YGLogLevelDebug,
YGLogLevelVerbose,
YGLogLevelCount,
} YGLogLevel;
typedef enum YGWrap {
YGWrapNoWrap,
YGWrapWrap,
YGWrapCount,
} YGWrap;
typedef enum YGOverflow {
YGOverflowVisible,
YGOverflowHidden,
YGOverflowScroll,
YGOverflowCount,
} YGOverflow;
typedef enum YGExperimentalFeature {
YGExperimentalFeatureRounding,
YGExperimentalFeatureWebFlexBasis,
YGExperimentalFeatureCount,
} YGExperimentalFeature;
typedef enum YGAlign {
YGAlignAuto,
YGAlignFlexStart,
YGAlignCenter,
YGAlignFlexEnd,
YGAlignStretch,
YGAlignCount,
} YGAlign;
@@ -10,11 +10,11 @@
#pragma once
#ifdef __cplusplus
#define CSS_EXTERN_C_BEGIN extern "C" {
#define CSS_EXTERN_C_END }
#define YG_EXTERN_C_BEGIN extern "C" {
#define YG_EXTERN_C_END }
#else
#define CSS_EXTERN_C_BEGIN
#define CSS_EXTERN_C_END
#define YG_EXTERN_C_BEGIN
#define YG_EXTERN_C_END
#endif
#ifdef _WINDLL
@@ -28,15 +28,15 @@
#endif
#if FB_ASSERTIONS_ENABLED
#define CSS_ABORT() abort()
#define YG_ABORT() abort()
#else
#define CSS_ABORT()
#define YG_ABORT()
#endif
#ifndef CSS_ASSERT
#define CSS_ASSERT(X, message) \
if (!(X)) { \
CSSLog(CSSLogLevelError, "%s", message); \
CSS_ABORT(); \
#ifndef YG_ASSERT
#define YG_ASSERT(X, message) \
if (!(X)) { \
YGLog(YGLogLevelError, "%s", message); \
YG_ABORT(); \
}
#endif
+104
View File
@@ -0,0 +1,104 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include "YGNodeList.h"
extern YGMalloc gYGMalloc;
extern YGRealloc gYGRealloc;
extern YGFree gYGFree;
struct YGNodeList {
uint32_t capacity;
uint32_t count;
YGNodeRef *items;
};
YGNodeListRef YGNodeListNew(const uint32_t initialCapacity) {
const YGNodeListRef list = gYGMalloc(sizeof(struct YGNodeList));
YG_ASSERT(list != NULL, "Could not allocate memory for list");
list->capacity = initialCapacity;
list->count = 0;
list->items = gYGMalloc(sizeof(YGNodeRef) * list->capacity);
YG_ASSERT(list->items != NULL, "Could not allocate memory for items");
return list;
}
void YGNodeListFree(const YGNodeListRef list) {
if (list) {
gYGFree(list->items);
gYGFree(list);
}
}
uint32_t YGNodeListCount(const YGNodeListRef list) {
if (list) {
return list->count;
}
return 0;
}
void YGNodeListAdd(YGNodeListRef *listp, const YGNodeRef node) {
if (!*listp) {
*listp = YGNodeListNew(4);
}
YGNodeListInsert(listp, node, (*listp)->count);
}
void YGNodeListInsert(YGNodeListRef *listp, const YGNodeRef node, const uint32_t index) {
if (!*listp) {
*listp = YGNodeListNew(4);
}
YGNodeListRef list = *listp;
if (list->count == list->capacity) {
list->capacity *= 2;
list->items = gYGRealloc(list->items, sizeof(YGNodeRef) * list->capacity);
YG_ASSERT(list->items != NULL, "Could not extend allocation for items");
}
for (uint32_t i = list->count; i > index; i--) {
list->items[i] = list->items[i - 1];
}
list->count++;
list->items[index] = node;
}
YGNodeRef YGNodeListRemove(const YGNodeListRef list, const uint32_t index) {
const YGNodeRef removed = list->items[index];
list->items[index] = NULL;
for (uint32_t i = index; i < list->count - 1; i++) {
list->items[i] = list->items[i + 1];
list->items[i + 1] = NULL;
}
list->count--;
return removed;
}
YGNodeRef YGNodeListDelete(const YGNodeListRef list, const YGNodeRef node) {
for (uint32_t i = 0; i < list->count; i++) {
if (list->items[i] == node) {
return YGNodeListRemove(list, i);
}
}
return NULL;
}
YGNodeRef YGNodeListGet(const YGNodeListRef list, const uint32_t index) {
if (YGNodeListCount(list) > 0) {
return list->items[index];
}
return NULL;
}
+33
View File
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma once
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "YGMacros.h"
#include "Yoga.h"
YG_EXTERN_C_BEGIN
typedef struct YGNodeList *YGNodeListRef;
YGNodeListRef YGNodeListNew(const uint32_t initialCapacity);
void YGNodeListFree(const YGNodeListRef list);
uint32_t YGNodeListCount(const YGNodeListRef list);
void YGNodeListAdd(YGNodeListRef *listp, const YGNodeRef node);
void YGNodeListInsert(YGNodeListRef *listp, const YGNodeRef node, const uint32_t index);
YGNodeRef YGNodeListRemove(const YGNodeListRef list, const uint32_t index);
YGNodeRef YGNodeListDelete(const YGNodeListRef list, const YGNodeRef node);
YGNodeRef YGNodeListGet(const YGNodeListRef list, const uint32_t index);
YG_EXTERN_C_END
File diff suppressed because it is too large Load Diff
+181
View File
@@ -0,0 +1,181 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma once
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif
// Not defined in MSVC++
#ifndef NAN
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float *) __nan)
#endif
#define YGUndefined NAN
#include "YGEnums.h"
#include "YGMacros.h"
YG_EXTERN_C_BEGIN
typedef struct YGSize {
float width;
float height;
} YGSize;
typedef struct YGNode *YGNodeRef;
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode);
typedef void (*YGPrintFunc)(YGNodeRef node);
typedef int (*YGLogger)(YGLogLevel level, const char *format, va_list args);
typedef void *(*YGMalloc)(size_t size);
typedef void *(*YGCalloc)(size_t count, size_t size);
typedef void *(*YGRealloc)(void *ptr, size_t size);
typedef void (*YGFree)(void *ptr);
// YGNode
WIN_EXPORT YGNodeRef YGNodeNew(void);
WIN_EXPORT void YGNodeInit(const YGNodeRef node);
WIN_EXPORT void YGNodeFree(const YGNodeRef node);
WIN_EXPORT void YGNodeFreeRecursive(const YGNodeRef node);
WIN_EXPORT void YGNodeReset(const YGNodeRef node);
WIN_EXPORT int32_t YGNodeGetInstanceCount(void);
WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
const YGNodeRef child,
const uint32_t index);
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
WIN_EXPORT uint32_t YGNodeChildCount(const YGNodeRef node);
WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
const float availableWidth,
const float availableHeight,
const YGDirection parentDirection);
// Mark a node as dirty. Only valid for nodes with a custom measure function
// set.
// YG knows when to mark all other nodes as dirty but because nodes with
// measure functions
// depends on information not known to YG they must perform this dirty
// marking manually.
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
WIN_EXPORT bool YGValueIsUndefined(const float value);
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
const float width,
const YGMeasureMode heightMode,
const float height,
const YGMeasureMode lastWidthMode,
const float lastWidth,
const YGMeasureMode lastHeightMode,
const float lastHeight,
const float lastComputedWidth,
const float lastComputedHeight,
const float marginRow,
const float marginColumn);
WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode);
#define YG_NODE_PROPERTY(type, name, paramName) \
WIN_EXPORT void YGNodeSet##name(const YGNodeRef node, type paramName); \
WIN_EXPORT type YGNodeGet##name(const YGNodeRef node);
#define YG_NODE_STYLE_PROPERTY(type, name, paramName) \
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
const YGEdge edge, \
const type paramName); \
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
YG_NODE_PROPERTY(void *, Context, context);
YG_NODE_PROPERTY(YGMeasureFunc, MeasureFunc, measureFunc);
YG_NODE_PROPERTY(YGPrintFunc, PrintFunc, printFunc);
YG_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
YG_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
YG_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
YG_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
YG_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
YG_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
YG_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
YG_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
YG_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex);
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
YG_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
YG_NODE_STYLE_EDGE_PROPERTY(float, Position, position);
YG_NODE_STYLE_EDGE_PROPERTY(float, Margin, margin);
YG_NODE_STYLE_EDGE_PROPERTY(float, Padding, padding);
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
YG_NODE_STYLE_PROPERTY(float, Width, width);
YG_NODE_STYLE_PROPERTY(float, Height, height);
YG_NODE_STYLE_PROPERTY(float, MinWidth, minWidth);
YG_NODE_STYLE_PROPERTY(float, MinHeight, minHeight);
YG_NODE_STYLE_PROPERTY(float, MaxWidth, maxWidth);
YG_NODE_STYLE_PROPERTY(float, MaxHeight, maxHeight);
// Yoga specific properties, not compatible with flexbox specification
// Aspect ratio control the size of the undefined dimension of a node.
// - On a node with a set width/height aspect ratio control the size of the unset dimension
// - On a node with a set flex basis aspect ratio controls the size of the node in the cross axis if
// unset
// - On a node with a measure function aspect ratio works as though the measure function measures
// the flex basis
// - On a node with flex grow/shrink aspect ratio controls the size of the node in the cross axis if
// unset
// - Aspect ratio takes min/max dimensions into account
YG_NODE_STYLE_PROPERTY(float, AspectRatio, aspectRatio);
YG_NODE_LAYOUT_PROPERTY(float, Left);
YG_NODE_LAYOUT_PROPERTY(float, Top);
YG_NODE_LAYOUT_PROPERTY(float, Right);
YG_NODE_LAYOUT_PROPERTY(float, Bottom);
YG_NODE_LAYOUT_PROPERTY(float, Width);
YG_NODE_LAYOUT_PROPERTY(float, Height);
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
WIN_EXPORT void YGSetLogger(YGLogger logger);
WIN_EXPORT void YGLog(YGLogLevel level, const char *message, ...);
WIN_EXPORT void YGSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
WIN_EXPORT bool YGIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
WIN_EXPORT void
YGSetMemoryFuncs(YGMalloc cssMalloc, YGCalloc cssCalloc, YGRealloc cssRealloc, YGFree cssFree);
YG_EXTERN_C_END
+33 -8
View File
@@ -20,7 +20,7 @@
#import "RCTProfile.h"
#import "RCTRootView.h"
#import "RCTUtils.h"
#import "RCTWebSocketProxy.h"
#import "RCTWebSocketObserverProtocol.h"
#if RCT_DEV
@@ -131,7 +131,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init)
typedef void(^RCTDevMenuAlertActionHandler)(UIAlertAction *action);
@interface RCTDevMenu () <RCTBridgeModule, RCTInvalidating, RCTWebSocketProxyDelegate>
@interface RCTDevMenu () <RCTBridgeModule, RCTInvalidating, RCTWebSocketObserverDelegate>
@property (nonatomic, strong) Class executorClass;
@@ -267,21 +267,46 @@ RCT_EXPORT_MODULE()
// TODO: Move non-UI logic into separate RCTDevSettings module
- (void)connectPackager
{
Class webSocketManagerClass = objc_lookUpClass("RCTWebSocketManager");
id<RCTWebSocketProxy> webSocketManager = (id <RCTWebSocketProxy>)[webSocketManagerClass sharedInstance];
RCTAssertMainQueue();
NSURL *url = [self packagerURL];
if (url) {
[webSocketManager setDelegate:self forURL:url];
if (!url) {
return;
}
Class webSocketObserverClass = objc_lookUpClass("RCTWebSocketObserver");
if (webSocketObserverClass == Nil) {
return;
}
// If multiple RCTDevMenus are created, the most recently connected one steals the RCTWebSocketObserver.
// (Why this behavior exists is beyond me, as of this writing.)
static NSMutableDictionary<NSString *, id<RCTWebSocketObserver>> *observers = nil;
if (observers == nil) {
observers = [NSMutableDictionary new];
}
NSString *key = [url absoluteString];
id<RCTWebSocketObserver> existingObserver = observers[key];
if (existingObserver) {
existingObserver.delegate = self;
} else {
id<RCTWebSocketObserver> newObserver = [(id<RCTWebSocketObserver>)[webSocketObserverClass alloc] initWithURL:url];
newObserver.delegate = self;
[newObserver start];
observers[key] = newObserver;
}
}
- (BOOL)isSupportedVersion:(NSNumber *)version
{
NSArray<NSNumber *> *const kSupportedVersions = @[ @1 ];
return [kSupportedVersions containsObject:version];
}
- (void)socketProxy:(__unused id<RCTWebSocketProxy>)sender didReceiveMessage:(NSDictionary<NSString *, id> *)message
- (void)didReceiveWebSocketMessage:(NSDictionary<NSString *, id> *)message
{
if ([self isSupportedVersion:message[@"version"]]) {
[self processTarget:message[@"target"] action:message[@"action"] options:message[@"options"]];
@@ -563,7 +588,7 @@ RCT_EXPORT_METHOD(show)
RCT_EXPORT_METHOD(reload)
{
[_bridge requestReload];
[_bridge reload];
}
RCT_EXPORT_METHOD(debugRemotely:(BOOL)enableDebug)
+1 -1
View File
@@ -56,7 +56,7 @@ RCT_EXPORT_METHOD(reportFatalException:(NSString *)message
static NSUInteger reloadRetries = 0;
if (!RCT_DEBUG && reloadRetries < _maxReloadAttempts) {
reloadRetries++;
[_bridge requestReload];
[_bridge reload];
} else {
NSString *description = [@"Unhandled JS Exception: " stringByAppendingString:message];
NSDictionary *errorInfo = @{ NSLocalizedDescriptionKey: description, RCTJSStackTraceKey: stack };
+3 -2
View File
@@ -451,8 +451,9 @@ RCT_EXPORT_METHOD(dismiss)
[[[NSURLSession sharedSession] dataTaskWithRequest:request] resume];
}
- (void)reloadFromRedBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow {
[_bridge requestReload];
- (void)reloadFromRedBoxWindow:(__unused RCTRedBoxWindow *)redBoxWindow
{
[_bridge reload];
}
@end
+1 -1
View File
@@ -11,7 +11,7 @@
#import <AVFoundation/AVFoundation.h>
#import <CSSLayout/CSSLayout.h>
#import <yoga/Yoga.h>
#import "RCTAccessibilityManager.h"
#import "RCTAnimationType.h"
+4 -5
View File
@@ -10,7 +10,6 @@
#import "RCTProfile.h"
#import <dlfcn.h>
#import <libkern/OSAtomic.h>
#import <mach/mach.h>
#import <objc/message.h>
@@ -19,15 +18,15 @@
#import <UIKit/UIKit.h>
#import "RCTAssert.h"
#import "RCTBridge.h"
#import "RCTBridge+Private.h"
#import "RCTBridge.h"
#import "RCTComponentData.h"
#import "RCTDefines.h"
#import "RCTJSCExecutor.h"
#import "RCTLog.h"
#import "RCTModuleData.h"
#import "RCTUtils.h"
#import "RCTUIManager.h"
#import "RCTJSCExecutor.h"
#import "RCTUtils.h"
NSString *const RCTProfileDidStartProfiling = @"RCTProfileDidStartProfiling";
NSString *const RCTProfileDidEndProfiling = @"RCTProfileDidEndProfiling";
@@ -363,7 +362,7 @@ void RCTProfileUnhookModules(RCTBridge *bridge)
+ (void)reload
{
[RCTProfilingBridge() requestReload];
[RCTProfilingBridge() reload];
}
+ (void)toggle:(UIButton *)target
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -86,7 +86,9 @@ numberOfRowsInComponent:(__unused NSInteger)component
}
label.font = _font;
label.textColor = _color;
label.textColor = [RCTConvert UIColor:_items[row][@"textColor"]] ?: _color;
label.textAlignment = _textAlign;
label.text = [self pickerView:pickerView titleForRow:row forComponent:component];
return label;
+6 -6
View File
@@ -21,7 +21,7 @@
self = [super init];
if (self) {
if ([[RCTI18nUtil sharedInstance] isRTL]) {
CSSNodeStyleSetDirection(self.cssNode, CSSDirectionRTL);
YGNodeStyleSetDirection(self.cssNode, YGDirectionRTL);
}
}
return self;
@@ -33,14 +33,14 @@
case RCTRootViewSizeFlexibilityNone:
break;
case RCTRootViewSizeFlexibilityWidth:
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
YGNodeStyleSetWidth(self.cssNode, YGUndefined);
break;
case RCTRootViewSizeFlexibilityHeight:
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
YGNodeStyleSetHeight(self.cssNode, YGUndefined);
break;
case RCTRootViewSizeFlexibilityWidthAndHeight:
CSSNodeStyleSetWidth(self.cssNode, CSSUndefined);
CSSNodeStyleSetHeight(self.cssNode, CSSUndefined);
YGNodeStyleSetWidth(self.cssNode, YGUndefined);
YGNodeStyleSetHeight(self.cssNode, YGUndefined);
break;
}
}
@@ -49,7 +49,7 @@
{
[self applySizeConstraints];
CSSNodeCalculateLayout(self.cssNode, CSSUndefined, CSSUndefined, CSSDirectionInherit);
YGNodeCalculateLayout(self.cssNode, YGUndefined, YGUndefined, YGDirectionInherit);
NSMutableSet<RCTShadowView *> *viewsWithNewFrame = [NSMutableSet set];
[self applyLayoutNode:self.cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:CGPointZero];
+2 -2
View File
@@ -87,8 +87,8 @@ RCT_EXPORT_VIEW_PROPERTY(onScrollAnimationEnd, RCTDirectEventBlock)
// is set to from js we want to clip drawing or not. This piece of code ensures
// that css-layout is always treating the contents of a scroll container as
// overflow: 'scroll'.
RCT_CUSTOM_SHADOW_PROPERTY(overflow, CSSOverflow, RCTShadowView) {
view.overflow = CSSOverflowScroll;
RCT_CUSTOM_SHADOW_PROPERTY(overflow, YGOverflow, RCTShadowView) {
view.overflow = YGOverflowScroll;
}
RCT_EXPORT_METHOD(getContentSize:(nonnull NSNumber *)reactTag
+14 -14
View File
@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
#import <CSSLayout/CSSLayout.h>
#import <yoga/Yoga.h>
#import <React/RCTComponent.h>
#import <React/RCTRootView.h>
@@ -44,7 +44,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
- (void)removeReactSubview:(RCTShadowView *)subview NS_REQUIRES_SUPER;
@property (nonatomic, weak, readonly) RCTShadowView *superview;
@property (nonatomic, assign, readonly) CSSNodeRef cssNode;
@property (nonatomic, assign, readonly) YGNodeRef cssNode;
@property (nonatomic, copy) NSString *viewName;
@property (nonatomic, strong) UIColor *backgroundColor; // Used to propagate to children
@property (nonatomic, copy) RCTDirectEventBlock onLayout;
@@ -126,12 +126,12 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
/**
* Flexbox properties. All zero/disabled by default
*/
@property (nonatomic, assign) CSSFlexDirection flexDirection;
@property (nonatomic, assign) CSSJustify justifyContent;
@property (nonatomic, assign) CSSAlign alignSelf;
@property (nonatomic, assign) CSSAlign alignItems;
@property (nonatomic, assign) CSSPositionType position;
@property (nonatomic, assign) CSSWrap flexWrap;
@property (nonatomic, assign) YGFlexDirection flexDirection;
@property (nonatomic, assign) YGJustify justifyContent;
@property (nonatomic, assign) YGAlign alignSelf;
@property (nonatomic, assign) YGAlign alignItems;
@property (nonatomic, assign) YGPositionType position;
@property (nonatomic, assign) YGWrap flexWrap;
@property (nonatomic, assign) float flexGrow;
@property (nonatomic, assign) float flexShrink;
@@ -149,7 +149,7 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
/**
* Clipping properties
*/
@property (nonatomic, assign) CSSOverflow overflow;
@property (nonatomic, assign) YGOverflow overflow;
/**
* Calculate property changes that need to be propagated to the view.
@@ -183,21 +183,21 @@ typedef void (^RCTApplierBlock)(NSDictionary<NSNumber *, UIView *> *viewRegistry
* is split into two methods so subclasses can override `applyLayoutToChildren:`
* while using default implementation of `applyLayoutNode:`.
*/
- (void)applyLayoutNode:(CSSNodeRef)node
- (void)applyLayoutNode:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition NS_REQUIRES_SUPER;
/**
* Enumerate the child nodes and tell them to apply layout.
*/
- (void)applyLayoutToChildren:(CSSNodeRef)node
- (void)applyLayoutToChildren:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition;
/**
* Return whether or not this node acts as a leaf node in the eyes of CSSLayout. For example
* RCTShadowText has children which it does not want CSSLayout to lay out so in the eyes of
* CSSLayout it is a leaf node.
* Return whether or not this node acts as a leaf node in the eyes of Yoga. For example
* RCTShadowText has children which it does not want Yoga to lay out so in the eyes of
* Yoga it is a leaf node.
*/
- (BOOL)isCSSLeafNode;
+118 -118
View File
@@ -50,53 +50,53 @@ typedef NS_ENUM(unsigned int, meta_prop_t) {
// cssNode api
static void RCTPrint(CSSNodeRef node)
static void RCTPrint(YGNodeRef node)
{
RCTShadowView *shadowView = (__bridge RCTShadowView *)CSSNodeGetContext(node);
RCTShadowView *shadowView = (__bridge RCTShadowView *)YGNodeGetContext(node);
printf("%s(%zd), ", shadowView.viewName.UTF8String, shadowView.reactTag.integerValue);
}
// Enforces precedence rules, e.g. marginLeft > marginHorizontal > margin.
#define DEFINE_PROCESS_META_PROPS(type) \
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], CSSNodeRef node) { \
if (!CSSValueIsUndefined(metaProps[META_PROP_LEFT])) { \
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_LEFT]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
CSSNodeStyleSet##type(node, CSSEdgeStart, metaProps[META_PROP_ALL]); \
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], YGNodeRef node) { \
if (!YGValueIsUndefined(metaProps[META_PROP_LEFT])) { \
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_LEFT]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_ALL]); \
} else { \
CSSNodeStyleSet##type(node, CSSEdgeStart, 0); \
YGNodeStyleSet##type(node, YGEdgeStart, 0); \
} \
\
if (!CSSValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_RIGHT]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
CSSNodeStyleSet##type(node, CSSEdgeEnd, metaProps[META_PROP_ALL]); \
if (!YGValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_RIGHT]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_ALL]); \
} else { \
CSSNodeStyleSet##type(node, CSSEdgeEnd, 0); \
YGNodeStyleSet##type(node, YGEdgeEnd, 0); \
} \
\
if (!CSSValueIsUndefined(metaProps[META_PROP_TOP])) { \
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_TOP]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_VERTICAL]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
CSSNodeStyleSet##type(node, CSSEdgeTop, metaProps[META_PROP_ALL]); \
if (!YGValueIsUndefined(metaProps[META_PROP_TOP])) { \
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_TOP]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_VERTICAL]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_ALL]); \
} else { \
CSSNodeStyleSet##type(node, CSSEdgeTop, 0); \
YGNodeStyleSet##type(node, YGEdgeTop, 0); \
} \
\
if (!CSSValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_BOTTOM]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_VERTICAL]); \
} else if (!CSSValueIsUndefined(metaProps[META_PROP_ALL])) { \
CSSNodeStyleSet##type(node, CSSEdgeBottom, metaProps[META_PROP_ALL]); \
if (!YGValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_VERTICAL]); \
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_ALL]); \
} else { \
CSSNodeStyleSet##type(node, CSSEdgeBottom, 0); \
YGNodeStyleSet##type(node, YGEdgeBottom, 0); \
} \
}
@@ -133,38 +133,38 @@ DEFINE_PROCESS_META_PROPS(Border);
// width = 213.5 - 106.5 = 107
// You'll notice that this is the same width we calculated for the parent view because we've taken its position into account.
- (void)applyLayoutNode:(CSSNodeRef)node
- (void)applyLayoutNode:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition
{
if (!CSSNodeGetHasNewLayout(node)) {
if (!YGNodeGetHasNewLayout(node)) {
return;
}
CSSNodeSetHasNewLayout(node, false);
YGNodeSetHasNewLayout(node, false);
#if RCT_DEBUG
// This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly, instead of relying on flex to propagate.
// We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0.
if ((!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(node)) && CSSNodeStyleGetFlexBasis(node) == 0) &&
((!CSSValueIsUndefined(CSSNodeStyleGetWidth(node)) && CSSNodeStyleGetWidth(node) > 0 && CSSNodeLayoutGetWidth(node) == 0) ||
(!CSSValueIsUndefined(CSSNodeStyleGetHeight(node)) && CSSNodeStyleGetHeight(node) > 0 && CSSNodeLayoutGetHeight(node) == 0))) {
if ((!YGValueIsUndefined(YGNodeStyleGetFlexBasis(node)) && YGNodeStyleGetFlexBasis(node) == 0) &&
((!YGValueIsUndefined(YGNodeStyleGetWidth(node)) && YGNodeStyleGetWidth(node) > 0 && YGNodeLayoutGetWidth(node) == 0) ||
(!YGValueIsUndefined(YGNodeStyleGetHeight(node)) && YGNodeStyleGetHeight(node) > 0 && YGNodeLayoutGetHeight(node) == 0))) {
RCTLogError(@"View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: %@", self);
}
#endif
CGPoint absoluteTopLeft = {
absolutePosition.x + CSSNodeLayoutGetLeft(node),
absolutePosition.y + CSSNodeLayoutGetTop(node)
absolutePosition.x + YGNodeLayoutGetLeft(node),
absolutePosition.y + YGNodeLayoutGetTop(node)
};
CGPoint absoluteBottomRight = {
absolutePosition.x + CSSNodeLayoutGetLeft(node) + CSSNodeLayoutGetWidth(node),
absolutePosition.y + CSSNodeLayoutGetTop(node) + CSSNodeLayoutGetHeight(node)
absolutePosition.x + YGNodeLayoutGetLeft(node) + YGNodeLayoutGetWidth(node),
absolutePosition.y + YGNodeLayoutGetTop(node) + YGNodeLayoutGetHeight(node)
};
CGRect frame = {{
RCTRoundPixelValue(CSSNodeLayoutGetLeft(node)),
RCTRoundPixelValue(CSSNodeLayoutGetTop(node)),
RCTRoundPixelValue(YGNodeLayoutGetLeft(node)),
RCTRoundPixelValue(YGNodeLayoutGetTop(node)),
}, {
RCTRoundPixelValue(absoluteBottomRight.x - absoluteTopLeft.x),
RCTRoundPixelValue(absoluteBottomRight.y - absoluteTopLeft.y)
@@ -175,19 +175,19 @@ DEFINE_PROCESS_META_PROPS(Border);
[viewsWithNewFrame addObject:self];
}
absolutePosition.x += CSSNodeLayoutGetLeft(node);
absolutePosition.y += CSSNodeLayoutGetTop(node);
absolutePosition.x += YGNodeLayoutGetLeft(node);
absolutePosition.y += YGNodeLayoutGetTop(node);
[self applyLayoutToChildren:node viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition];
}
- (void)applyLayoutToChildren:(CSSNodeRef)node
- (void)applyLayoutToChildren:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition
{
for (unsigned int i = 0; i < CSSNodeChildCount(node); ++i) {
for (unsigned int i = 0; i < YGNodeChildCount(node); ++i) {
RCTShadowView *child = (RCTShadowView *)_reactSubviews[i];
[child applyLayoutNode:CSSNodeGetChild(node, i)
[child applyLayoutNode:YGNodeGetChild(node, i)
viewsWithNewFrame:viewsWithNewFrame
absolutePosition:absolutePosition];
}
@@ -261,14 +261,14 @@ DEFINE_PROCESS_META_PROPS(Border);
}
if (!CGRectEqualToRect(frame, _frame)) {
CSSNodeStyleSetPositionType(_cssNode, CSSPositionTypeAbsolute);
CSSNodeStyleSetWidth(_cssNode, frame.size.width);
CSSNodeStyleSetHeight(_cssNode, frame.size.height);
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, frame.origin.x);
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, frame.origin.y);
YGNodeStyleSetPositionType(_cssNode, YGPositionTypeAbsolute);
YGNodeStyleSetWidth(_cssNode, frame.size.width);
YGNodeStyleSetHeight(_cssNode, frame.size.height);
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, frame.origin.x);
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, frame.origin.y);
}
CSSNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, CSSDirectionInherit);
YGNodeCalculateLayout(_cssNode, frame.size.width, frame.size.height, YGDirectionInherit);
[self applyLayoutNode:_cssNode viewsWithNewFrame:viewsWithNewFrame absolutePosition:absolutePosition];
}
@@ -304,12 +304,12 @@ DEFINE_PROCESS_META_PROPS(Border);
{
if ((self = [super init])) {
_frame = CGRectMake(0, 0, CSSUndefined, CSSUndefined);
_frame = CGRectMake(0, 0, YGUndefined, YGUndefined);
for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) {
_paddingMetaProps[ii] = CSSUndefined;
_marginMetaProps[ii] = CSSUndefined;
_borderMetaProps[ii] = CSSUndefined;
_paddingMetaProps[ii] = YGUndefined;
_marginMetaProps[ii] = YGUndefined;
_borderMetaProps[ii] = YGUndefined;
}
_newView = YES;
@@ -318,9 +318,9 @@ DEFINE_PROCESS_META_PROPS(Border);
_reactSubviews = [NSMutableArray array];
_cssNode = CSSNodeNew();
CSSNodeSetContext(_cssNode, (__bridge void *)self);
CSSNodeSetPrintFunc(_cssNode, RCTPrint);
_cssNode = YGNodeNew();
YGNodeSetContext(_cssNode, (__bridge void *)self);
YGNodeSetPrintFunc(_cssNode, RCTPrint);
}
return self;
}
@@ -332,7 +332,7 @@ DEFINE_PROCESS_META_PROPS(Border);
- (void)dealloc
{
CSSNodeFree(_cssNode);
YGNodeFree(_cssNode);
}
- (BOOL)isCSSLeafNode
@@ -375,7 +375,7 @@ DEFINE_PROCESS_META_PROPS(Border);
{
[_reactSubviews insertObject:subview atIndex:atIndex];
if (![self isCSSLeafNode]) {
CSSNodeInsertChild(_cssNode, subview.cssNode, (uint32_t)atIndex);
YGNodeInsertChild(_cssNode, subview.cssNode, (uint32_t)atIndex);
}
subview->_superview = self;
_didUpdateSubviews = YES;
@@ -391,7 +391,7 @@ DEFINE_PROCESS_META_PROPS(Border);
subview->_superview = nil;
[_reactSubviews removeObject:subview];
if (![self isCSSLeafNode]) {
CSSNodeRemoveChild(_cssNode, subview.cssNode);
YGNodeRemoveChild(_cssNode, subview.cssNode);
}
}
@@ -491,27 +491,27 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
- (UIEdgeInsets)paddingAsInsets
{
if (CSSNodeLayoutGetDirection(_cssNode) == CSSDirectionRTL) {
if (YGNodeLayoutGetDirection(_cssNode) == YGDirectionRTL) {
return (UIEdgeInsets){
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
};
} else {
return (UIEdgeInsets){
CSSNodeStyleGetPadding(_cssNode, CSSEdgeTop),
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart)) ?
CSSNodeStyleGetPadding(_cssNode, CSSEdgeStart) :
CSSNodeStyleGetPadding(_cssNode, CSSEdgeLeft),
CSSNodeStyleGetPadding(_cssNode, CSSEdgeBottom),
!CSSValueIsUndefined(CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd)) ?
CSSNodeStyleGetPadding(_cssNode, CSSEdgeEnd) :
CSSNodeStyleGetPadding(_cssNode, CSSEdgeRight)
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
};
}
}
@@ -541,12 +541,12 @@ RCT_BORDER_PROPERTY(Right, RIGHT)
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
- (void)set##setProp:(float)value \
{ \
CSSNodeStyleSet##cssProp(_cssNode, value); \
YGNodeStyleSet##cssProp(_cssNode, value); \
[self dirtyText]; \
} \
- (float)getProp \
{ \
return CSSNodeStyleGet##cssProp(_cssNode); \
return YGNodeStyleGet##cssProp(_cssNode); \
}
RCT_DIMENSION_PROPERTY(Width, width, Width)
@@ -561,45 +561,45 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight)
#define RCT_POSITION_PROPERTY(setProp, getProp, edge) \
- (void)set##setProp:(float)value \
{ \
CSSNodeStyleSetPosition(_cssNode, edge, value); \
YGNodeStyleSetPosition(_cssNode, edge, value); \
[self dirtyText]; \
} \
- (float)getProp \
{ \
return CSSNodeStyleGetPosition(_cssNode, edge); \
return YGNodeStyleGetPosition(_cssNode, edge); \
}
RCT_POSITION_PROPERTY(Top, top, CSSEdgeTop)
RCT_POSITION_PROPERTY(Right, right, CSSEdgeEnd)
RCT_POSITION_PROPERTY(Bottom, bottom, CSSEdgeBottom)
RCT_POSITION_PROPERTY(Left, left, CSSEdgeStart)
RCT_POSITION_PROPERTY(Top, top, YGEdgeTop)
RCT_POSITION_PROPERTY(Right, right, YGEdgeEnd)
RCT_POSITION_PROPERTY(Bottom, bottom, YGEdgeBottom)
RCT_POSITION_PROPERTY(Left, left, YGEdgeStart)
- (void)setFrame:(CGRect)frame
{
if (!CGRectEqualToRect(frame, _frame)) {
_frame = frame;
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, CGRectGetMinX(frame));
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, CGRectGetMinY(frame));
CSSNodeStyleSetWidth(_cssNode, CGRectGetWidth(frame));
CSSNodeStyleSetHeight(_cssNode, CGRectGetHeight(frame));
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, CGRectGetMinX(frame));
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, CGRectGetMinY(frame));
YGNodeStyleSetWidth(_cssNode, CGRectGetWidth(frame));
YGNodeStyleSetHeight(_cssNode, CGRectGetHeight(frame));
}
}
static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension dimension, CGFloat amount)
static inline void RCTAssignSuggestedDimension(YGNodeRef cssNode, YGDimension dimension, CGFloat amount)
{
if (amount != UIViewNoIntrinsicMetric) {
switch (dimension) {
case CSSDimensionWidth:
if (isnan(CSSNodeStyleGetWidth(cssNode))) {
CSSNodeStyleSetWidth(cssNode, amount);
case YGDimensionWidth:
if (isnan(YGNodeStyleGetWidth(cssNode))) {
YGNodeStyleSetWidth(cssNode, amount);
}
break;
case CSSDimensionHeight:
if (isnan(CSSNodeStyleGetHeight(cssNode))) {
CSSNodeStyleSetHeight(cssNode, amount);
case YGDimensionHeight:
if (isnan(YGNodeStyleGetHeight(cssNode))) {
YGNodeStyleSetHeight(cssNode, amount);
}
break;
case CSSDimensionCount:
case YGDimensionCount:
break;
}
}
@@ -607,51 +607,51 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
- (void)setIntrinsicContentSize:(CGSize)size
{
if (CSSNodeStyleGetFlexGrow(_cssNode) == 0 && CSSNodeStyleGetFlexShrink(_cssNode) == 0) {
RCTAssignSuggestedDimension(_cssNode, CSSDimensionHeight, size.height);
RCTAssignSuggestedDimension(_cssNode, CSSDimensionWidth, size.width);
if (YGNodeStyleGetFlexGrow(_cssNode) == 0 && YGNodeStyleGetFlexShrink(_cssNode) == 0) {
RCTAssignSuggestedDimension(_cssNode, YGDimensionHeight, size.height);
RCTAssignSuggestedDimension(_cssNode, YGDimensionWidth, size.width);
}
}
- (void)setTopLeft:(CGPoint)topLeft
{
CSSNodeStyleSetPosition(_cssNode, CSSEdgeLeft, topLeft.x);
CSSNodeStyleSetPosition(_cssNode, CSSEdgeTop, topLeft.y);
YGNodeStyleSetPosition(_cssNode, YGEdgeLeft, topLeft.x);
YGNodeStyleSetPosition(_cssNode, YGEdgeTop, topLeft.y);
}
- (void)setSize:(CGSize)size
{
CSSNodeStyleSetWidth(_cssNode, size.width);
CSSNodeStyleSetHeight(_cssNode, size.height);
YGNodeStyleSetWidth(_cssNode, size.width);
YGNodeStyleSetHeight(_cssNode, size.height);
}
// Flex
- (void)setFlex:(float)value
{
CSSNodeStyleSetFlex(_cssNode, value);
YGNodeStyleSetFlex(_cssNode, value);
}
#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \
- (void)set##setProp:(type)value \
{ \
CSSNodeStyleSet##cssProp(_cssNode, value); \
YGNodeStyleSet##cssProp(_cssNode, value); \
} \
- (type)getProp \
{ \
return CSSNodeStyleGet##cssProp(_cssNode); \
return YGNodeStyleGet##cssProp(_cssNode); \
}
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float)
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float)
RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, float)
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, CSSFlexDirection)
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, CSSJustify)
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, CSSAlign)
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, CSSAlign)
RCT_STYLE_PROPERTY(Position, position, PositionType, CSSPositionType)
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, CSSWrap)
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, CSSOverflow)
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify)
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign)
RCT_STYLE_PROPERTY(AlignItems, alignItems, AlignItems, YGAlign)
RCT_STYLE_PROPERTY(Position, position, PositionType, YGPositionType)
RCT_STYLE_PROPERTY(FlexWrap, flexWrap, FlexWrap, YGWrap)
RCT_STYLE_PROPERTY(Overflow, overflow, Overflow, YGOverflow)
RCT_STYLE_PROPERTY(AspectRatio, aspectRatio, AspectRatio, float)
- (void)setBackgroundColor:(UIColor *)color
+9 -9
View File
@@ -109,10 +109,10 @@ RCT_REMAP_VIEW_PROPERTY(shadowColor, layer.shadowColor, CGColor)
RCT_REMAP_VIEW_PROPERTY(shadowOffset, layer.shadowOffset, CGSize)
RCT_REMAP_VIEW_PROPERTY(shadowOpacity, layer.shadowOpacity, float)
RCT_REMAP_VIEW_PROPERTY(shadowRadius, layer.shadowRadius, CGFloat)
RCT_CUSTOM_VIEW_PROPERTY(overflow, CSSOverflow, RCTView)
RCT_CUSTOM_VIEW_PROPERTY(overflow, YGOverflow, RCTView)
{
if (json) {
view.clipsToBounds = [RCTConvert CSSOverflow:json] != CSSOverflowVisible;
view.clipsToBounds = [RCTConvert YGOverflow:json] != YGOverflowVisible;
} else {
view.clipsToBounds = defaultView.clipsToBounds;
}
@@ -288,15 +288,15 @@ RCT_EXPORT_SHADOW_PROPERTY(flex, float)
RCT_EXPORT_SHADOW_PROPERTY(flexGrow, float)
RCT_EXPORT_SHADOW_PROPERTY(flexShrink, float)
RCT_EXPORT_SHADOW_PROPERTY(flexBasis, float)
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, CSSFlexDirection)
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, CSSWrap)
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, CSSJustify)
RCT_EXPORT_SHADOW_PROPERTY(alignItems, CSSAlign)
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, CSSAlign)
RCT_EXPORT_SHADOW_PROPERTY(position, CSSPositionType)
RCT_EXPORT_SHADOW_PROPERTY(flexDirection, YGFlexDirection)
RCT_EXPORT_SHADOW_PROPERTY(flexWrap, YGWrap)
RCT_EXPORT_SHADOW_PROPERTY(justifyContent, YGJustify)
RCT_EXPORT_SHADOW_PROPERTY(alignItems, YGAlign)
RCT_EXPORT_SHADOW_PROPERTY(alignSelf, YGAlign)
RCT_EXPORT_SHADOW_PROPERTY(position, YGPositionType)
RCT_EXPORT_SHADOW_PROPERTY(aspectRatio, float)
RCT_EXPORT_SHADOW_PROPERTY(overflow, CSSOverflow)
RCT_EXPORT_SHADOW_PROPERTY(overflow, YGOverflow)
RCT_EXPORT_SHADOW_PROPERTY(onLayout, RCTDirectEventBlock)
+4 -3
View File
@@ -35,7 +35,7 @@ JSC_DEPS = [
'//native/third-party/jsc:jsc_legacy_profiler',
]
CSSLAYOUT_TARGET = '//ReactAndroid/src/main/java/com/facebook:csslayout'
YOGA_TARGET = '//ReactAndroid/src/main/java/com/facebook:yoga'
FBGLOGINIT_TARGET = '//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit'
FBJNI_TARGET = '//ReactAndroid/src/main/jni/first-party/fb:jni'
JNI_TARGET = '//ReactAndroid/src/main/jni/first-party/jni-hack:jni-hack'
@@ -103,13 +103,14 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
'buck-out/bin'))
# RN tests use Powermock, which means they get their own ClassLoaders.
# Because the csslayout native library (or any native library) can only be loaded into one
# Because the yoga native library (or any native library) can only be loaded into one
# ClassLoader at a time, we need to run each in its own process, hence fork_mode = 'per_test'.
robolectric_test(
name = name,
use_cxx_libraries = True,
cxx_library_whitelist = [
'//ReactAndroid/src/main/jni/first-party/csslayoutjni:jni',
'//ReactCommon/yoga:yoga',
'//ReactAndroid/src/main/jni/first-party/yogajni:jni',
],
fork_mode = 'per_test',
srcs = srcs,
+6 -7
View File
@@ -35,19 +35,17 @@ task createNativeDepsDirectories {
}
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
// Use ZIP version as it's faster this way to selectively extract some parts of the archive
src 'https://unpkg.com/boost-mirror@1.57.0/boost.zip'
// alternative
// src 'http://mirror.nienbo.com/boost/boost_1_57_0.zip'
src 'https://github.com/react-native-community/boost-for-react-native/releases/download/v1.57.0-1/boost_1_57_0.tar.gz'
onlyIfNewer true
overwrite false
dest new File(downloadsDir, 'boost_1_57_0.zip')
dest new File(downloadsDir, 'boost_1_57_0.tar.gz')
}
task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
from boostPath ?: zipTree(downloadBoost.dest)
from boostPath ?: tarTree(resources.gzip(downloadBoost.dest))
from 'src/main/jni/third-party/boost/Android.mk'
include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk'
includeEmptyDirs = false
into "$thirdPartyNdkDir/boost"
}
@@ -121,7 +119,8 @@ task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy)
}
task downloadJSCHeaders(type: Download) {
def jscAPIBaseURL = 'https://svn.webkit.org/repository/webkit/!svn/bc/174650/trunk/Source/JavaScriptCore/API/'
// in sync with webkit SVN revision 174650
def jscAPIBaseURL = 'https://raw.githubusercontent.com/WebKit/webkit/38b15a3ba3c1b0798f2036f7cea36ffdc096202e/Source/JavaScriptCore/API/'
def jscHeaderFiles = ['JavaScript.h', 'JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSRetainPtr.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h']
def output = new File(downloadsDir, 'jsc')
output.mkdirs()
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0-master
VERSION_NAME=0.40.0
GROUP=com.facebook.react
POM_NAME=ReactNative
+3 -3
View File
@@ -1,8 +1,8 @@
include_defs('//ReactAndroid/DEFS')
android_library(
name = 'csslayout',
srcs = glob(['csslayout/*.java']),
name = 'yoga',
srcs = glob(['yoga/*.java']),
deps = [
react_native_dep('java/com/facebook/proguard/annotations:annotations'),
react_native_dep('libraries/soloader/java/com/facebook/soloader:soloader'),
@@ -13,5 +13,5 @@ android_library(
)
project_config(
src_target = ':csslayout',
src_target = ':yoga',
)
@@ -1,549 +0,0 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
import javax.annotation.Nullable;
import java.util.List;
import java.util.ArrayList;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader;
@DoNotStrip
public class CSSNode implements CSSNodeAPI<CSSNode> {
static {
SoLoader.loadLibrary("csslayout");
}
/**
* Get native instance count. Useful for testing only.
*/
static native int jni_CSSNodeGetInstanceCount();
static native void jni_CSSLog(int level, String message);
private static native void jni_CSSLayoutSetLogger(Object logger);
public static void setLogger(CSSLogger logger) {
jni_CSSLayoutSetLogger(logger);
}
private static native void jni_CSSLayoutSetExperimentalFeatureEnabled(
int feature,
boolean enabled);
public static void setExperimentalFeatureEnabled(
CSSExperimentalFeature feature,
boolean enabled) {
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
}
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature);
public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) {
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
}
private CSSNode mParent;
private List<CSSNode> mChildren;
private MeasureFunction mMeasureFunction;
private long mNativePointer;
private Object mData;
private boolean mHasSetPadding = false;
private boolean mHasSetMargin = false;
private boolean mHasSetBorder = false;
private boolean mHasSetPosition = false;
@DoNotStrip
private float mWidth = CSSConstants.UNDEFINED;
@DoNotStrip
private float mHeight = CSSConstants.UNDEFINED;
@DoNotStrip
private float mTop = CSSConstants.UNDEFINED;
@DoNotStrip
private float mLeft = CSSConstants.UNDEFINED;
@DoNotStrip
private int mLayoutDirection = 0;
private native long jni_CSSNodeNew();
public CSSNode() {
mNativePointer = jni_CSSNodeNew();
if (mNativePointer == 0) {
throw new IllegalStateException("Failed to allocate native memory");
}
}
private native void jni_CSSNodeFree(long nativePointer);
@Override
protected void finalize() throws Throwable {
try {
jni_CSSNodeFree(mNativePointer);
} finally {
super.finalize();
}
}
private native void jni_CSSNodeReset(long nativePointer);
@Override
public void reset() {
mHasSetPadding = false;
mHasSetMargin = false;
mHasSetBorder = false;
mHasSetPosition = false;
mWidth = CSSConstants.UNDEFINED;
mHeight = CSSConstants.UNDEFINED;
mTop = CSSConstants.UNDEFINED;
mLeft = CSSConstants.UNDEFINED;
mLayoutDirection = 0;
mMeasureFunction = null;
mData = null;
jni_CSSNodeReset(mNativePointer);
}
@Override
public int getChildCount() {
return mChildren == null ? 0 : mChildren.size();
}
@Override
public CSSNode getChildAt(int i) {
return mChildren.get(i);
}
private native void jni_CSSNodeInsertChild(long nativePointer, long childPointer, int index);
@Override
public void addChildAt(CSSNode child, int i) {
if (child.mParent != null) {
throw new IllegalStateException("Child already has a parent, it must be removed first.");
}
if (mChildren == null) {
mChildren = new ArrayList<>(4);
}
mChildren.add(i, child);
child.mParent = this;
jni_CSSNodeInsertChild(mNativePointer, child.mNativePointer, i);
}
private native void jni_CSSNodeRemoveChild(long nativePointer, long childPointer);
@Override
public CSSNode removeChildAt(int i) {
final CSSNode child = mChildren.remove(i);
child.mParent = null;
jni_CSSNodeRemoveChild(mNativePointer, child.mNativePointer);
return child;
}
@Override
public @Nullable
CSSNode getParent() {
return mParent;
}
@Override
public int indexOf(CSSNode child) {
return mChildren == null ? -1 : mChildren.indexOf(child);
}
private native void jni_CSSNodeCalculateLayout(long nativePointer);
@Override
public void calculateLayout() {
jni_CSSNodeCalculateLayout(mNativePointer);
}
private native boolean jni_CSSNodeHasNewLayout(long nativePointer);
@Override
public boolean hasNewLayout() {
return jni_CSSNodeHasNewLayout(mNativePointer);
}
private native void jni_CSSNodeMarkDirty(long nativePointer);
@Override
public void dirty() {
jni_CSSNodeMarkDirty(mNativePointer);
}
private native boolean jni_CSSNodeIsDirty(long nativePointer);
@Override
public boolean isDirty() {
return jni_CSSNodeIsDirty(mNativePointer);
}
private native void jni_CSSNodeMarkLayoutSeen(long nativePointer);
@Override
public void markLayoutSeen() {
jni_CSSNodeMarkLayoutSeen(mNativePointer);
}
private native void jni_CSSNodeCopyStyle(long dstNativePointer, long srcNativePointer);
@Override
public void copyStyle(CSSNode srcNode) {
jni_CSSNodeCopyStyle(mNativePointer, srcNode.mNativePointer);
}
private native int jni_CSSNodeStyleGetDirection(long nativePointer);
@Override
public CSSDirection getStyleDirection() {
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
}
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
@Override
public void setDirection(CSSDirection direction) {
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
}
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
@Override
public CSSFlexDirection getFlexDirection() {
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
}
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
@Override
public void setFlexDirection(CSSFlexDirection flexDirection) {
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
}
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
@Override
public CSSJustify getJustifyContent() {
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
}
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
@Override
public void setJustifyContent(CSSJustify justifyContent) {
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
}
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
@Override
public CSSAlign getAlignItems() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
}
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
@Override
public void setAlignItems(CSSAlign alignItems) {
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
}
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
@Override
public CSSAlign getAlignSelf() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
}
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
@Override
public void setAlignSelf(CSSAlign alignSelf) {
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
}
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
@Override
public CSSAlign getAlignContent() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
}
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
@Override
public void setAlignContent(CSSAlign alignContent) {
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
}
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
@Override
public CSSPositionType getPositionType() {
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
}
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
@Override
public void setPositionType(CSSPositionType positionType) {
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
}
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
@Override
public void setWrap(CSSWrap flexWrap) {
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
}
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
@Override
public CSSOverflow getOverflow() {
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
}
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
@Override
public void setOverflow(CSSOverflow overflow) {
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
}
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);
@Override
public void setFlex(float flex) {
jni_CSSNodeStyleSetFlex(mNativePointer, flex);
}
private native float jni_CSSNodeStyleGetFlexGrow(long nativePointer);
@Override
public float getFlexGrow() {
return jni_CSSNodeStyleGetFlexGrow(mNativePointer);
}
private native void jni_CSSNodeStyleSetFlexGrow(long nativePointer, float flexGrow);
@Override
public void setFlexGrow(float flexGrow) {
jni_CSSNodeStyleSetFlexGrow(mNativePointer, flexGrow);
}
private native float jni_CSSNodeStyleGetFlexShrink(long nativePointer);
@Override
public float getFlexShrink() {
return jni_CSSNodeStyleGetFlexShrink(mNativePointer);
}
private native void jni_CSSNodeStyleSetFlexShrink(long nativePointer, float flexShrink);
@Override
public void setFlexShrink(float flexShrink) {
jni_CSSNodeStyleSetFlexShrink(mNativePointer, flexShrink);
}
private native float jni_CSSNodeStyleGetFlexBasis(long nativePointer);
@Override
public float getFlexBasis() {
return jni_CSSNodeStyleGetFlexBasis(mNativePointer);
}
private native void jni_CSSNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
@Override
public void setFlexBasis(float flexBasis) {
jni_CSSNodeStyleSetFlexBasis(mNativePointer, flexBasis);
}
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
@Override
public float getMargin(CSSEdge edge) {
if (!mHasSetMargin) {
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
}
return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
}
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
@Override
public void setMargin(CSSEdge edge, float margin) {
mHasSetMargin = true;
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
}
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
@Override
public float getPadding(CSSEdge edge) {
if (!mHasSetPadding) {
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
}
return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
}
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
@Override
public void setPadding(CSSEdge edge, float padding) {
mHasSetPadding = true;
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
}
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
@Override
public float getBorder(CSSEdge edge) {
if (!mHasSetBorder) {
return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED;
}
return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
}
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
@Override
public void setBorder(CSSEdge edge, float border) {
mHasSetBorder = true;
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
}
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
@Override
public float getPosition(CSSEdge edge) {
if (!mHasSetPosition) {
return CSSConstants.UNDEFINED;
}
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
}
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
@Override
public void setPosition(CSSEdge edge, float position) {
mHasSetPosition = true;
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
}
private native float jni_CSSNodeStyleGetWidth(long nativePointer);
@Override
public float getWidth() {
return jni_CSSNodeStyleGetWidth(mNativePointer);
}
private native void jni_CSSNodeStyleSetWidth(long nativePointer, float width);
@Override
public void setWidth(float width) {
jni_CSSNodeStyleSetWidth(mNativePointer, width);
}
private native float jni_CSSNodeStyleGetHeight(long nativePointer);
@Override
public float getHeight() {
return jni_CSSNodeStyleGetHeight(mNativePointer);
}
private native void jni_CSSNodeStyleSetHeight(long nativePointer, float height);
@Override
public void setHeight(float height) {
jni_CSSNodeStyleSetHeight(mNativePointer, height);
}
private native float jni_CSSNodeStyleGetMinWidth(long nativePointer);
@Override
public float getMinWidth() {
return jni_CSSNodeStyleGetMinWidth(mNativePointer);
}
private native void jni_CSSNodeStyleSetMinWidth(long nativePointer, float minWidth);
@Override
public void setMinWidth(float minWidth) {
jni_CSSNodeStyleSetMinWidth(mNativePointer, minWidth);
}
private native float jni_CSSNodeStyleGetMinHeight(long nativePointer);
@Override
public float getMinHeight() {
return jni_CSSNodeStyleGetMinHeight(mNativePointer);
}
private native void jni_CSSNodeStyleSetMinHeight(long nativePointer, float minHeight);
@Override
public void setMinHeight(float minHeight) {
jni_CSSNodeStyleSetMinHeight(mNativePointer, minHeight);
}
private native float jni_CSSNodeStyleGetMaxWidth(long nativePointer);
@Override
public float getMaxWidth() {
return jni_CSSNodeStyleGetMaxWidth(mNativePointer);
}
private native void jni_CSSNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
@Override
public void setMaxWidth(float maxWidth) {
jni_CSSNodeStyleSetMaxWidth(mNativePointer, maxWidth);
}
private native float jni_CSSNodeStyleGetMaxHeight(long nativePointer);
@Override
public float getMaxHeight() {
return jni_CSSNodeStyleGetMaxHeight(mNativePointer);
}
private native void jni_CSSNodeStyleSetMaxHeight(long nativePointer, float maxheight);
@Override
public void setMaxHeight(float maxheight) {
jni_CSSNodeStyleSetMaxHeight(mNativePointer, maxheight);
}
private native float jni_CSSNodeStyleGetAspectRatio(long nativePointer);
public float getAspectRatio() {
return jni_CSSNodeStyleGetAspectRatio(mNativePointer);
}
private native void jni_CSSNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
public void setAspectRatio(float aspectRatio) {
jni_CSSNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
}
@Override
public float getLayoutX() {
return mLeft;
}
@Override
public float getLayoutY() {
return mTop;
}
@Override
public float getLayoutWidth() {
return mWidth;
}
@Override
public float getLayoutHeight() {
return mHeight;
}
@Override
public CSSDirection getLayoutDirection() {
return CSSDirection.values()[mLayoutDirection];
}
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
@Override
public void setMeasureFunction(MeasureFunction measureFunction) {
mMeasureFunction = measureFunction;
jni_CSSNodeSetHasMeasureFunc(mNativePointer, measureFunction != null);
}
// Implementation Note: Why this method needs to stay final
//
// We cache the jmethodid for this method in CSSLayout code. This means that even if a subclass
// were to override measure, we'd still call this implementation from layout code since the
// overriding method will have a different jmethodid. This is final to prevent that mistake.
@DoNotStrip
public final long measure(float width, int widthMode, float height, int heightMode) {
if (!isMeasureDefined()) {
throw new RuntimeException("Measure function isn't defined!");
}
return mMeasureFunction.measure(
this,
width,
CSSMeasureMode.values()[widthMode],
height,
CSSMeasureMode.values()[heightMode]);
}
@Override
public boolean isMeasureDefined() {
return mMeasureFunction != null;
}
@Override
public void setData(Object data) {
mData = data;
}
@Override
public Object getData() {
return mData;
}
}
@@ -1,92 +0,0 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
interface MeasureFunction {
/**
* Return a value created by MeasureOutput.make(width, height);
*/
long measure(
CSSNodeAPI node,
float width,
CSSMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
}
int getChildCount();
CSSNodeType getChildAt(int i);
void addChildAt(CSSNodeType child, int i);
CSSNodeType removeChildAt(int i);
CSSNodeType getParent();
int indexOf(CSSNodeType child);
void setMeasureFunction(MeasureFunction measureFunction);
boolean isMeasureDefined();
void calculateLayout();
boolean isDirty();
boolean hasNewLayout();
void dirty();
void markLayoutSeen();
void copyStyle(CSSNodeType srcNode);
CSSDirection getStyleDirection();
void setDirection(CSSDirection direction);
CSSFlexDirection getFlexDirection();
void setFlexDirection(CSSFlexDirection flexDirection);
CSSJustify getJustifyContent();
void setJustifyContent(CSSJustify justifyContent);
CSSAlign getAlignItems();
void setAlignItems(CSSAlign alignItems);
CSSAlign getAlignSelf();
void setAlignSelf(CSSAlign alignSelf);
CSSAlign getAlignContent();
void setAlignContent(CSSAlign alignContent);
CSSPositionType getPositionType();
void setPositionType(CSSPositionType positionType);
void setWrap(CSSWrap flexWrap);
void setFlex(float flex);
float getFlexGrow();
void setFlexGrow(float flexGrow);
float getFlexShrink();
void setFlexShrink(float flexShrink);
float getFlexBasis();
void setFlexBasis(float flexBasis);
float getMargin(CSSEdge edge);
void setMargin(CSSEdge edge, float margin);
float getPadding(CSSEdge edge);
void setPadding(CSSEdge edge, float padding);
float getBorder(CSSEdge edge);
void setBorder(CSSEdge edge, float border);
float getPosition(CSSEdge edge);
void setPosition(CSSEdge edge, float position);
float getWidth();
void setWidth(float width);
float getHeight();
void setHeight(float height);
float getMaxWidth();
void setMaxWidth(float maxWidth);
float getMinWidth();
void setMinWidth(float minWidth);
float getMaxHeight();
void setMaxHeight(float maxHeight);
float getMinHeight();
void setMinHeight(float minHeight);
float getLayoutX();
float getLayoutY();
float getLayoutWidth();
float getLayoutHeight();
CSSDirection getLayoutDirection();
CSSOverflow getOverflow();
void setOverflow(CSSOverflow overflow);
void setData(Object data);
Object getData();
void reset();
}
@@ -1,15 +0,0 @@
The source of truth for css-layout is: https://github.com/facebook/css-layout
The code here should be kept in sync with GitHub.
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/a1f36b53f5464c8ee7abc311765dc3ecb1b879c6
There is generated code in:
- README (this file)
- fbandroid/java/com/facebook/csslayout
- fbandroid/javatests/com/facebook/csslayout
- fbobjc/Libraries/FBReactKit/js/react-native-github/React/Layout
The code was generated by running 'make' in the css-layout folder and running:
scripts/sync-css-layout.sh <pathToGithubRepo> <pathToFbSourceRepo>
@@ -6,6 +6,7 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
@@ -29,6 +30,10 @@ import javax.annotation.Nullable;
* class doesn't implement {@link ReactApplication}.
*/
public class ReactActivityDelegate {
private final int REQUEST_OVERLAY_PERMISSION_CODE = 1111;
private static final String REDBOX_PERMISSION_GRANTED_MESSAGE =
"Overlay permissions have been granted.";
private static final String REDBOX_PERMISSION_MESSAGE =
"Overlay permissions needs to be granted in order for react native apps to run in dev mode";
@@ -79,17 +84,19 @@ public class ReactActivityDelegate {
}
protected void onCreate(Bundle savedInstanceState) {
if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) {
boolean needsOverlayPermission = false;
if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// Get permission to show redbox in dev builds.
if (!Settings.canDrawOverlays(getContext())) {
Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
getContext().startActivity(serviceIntent);
needsOverlayPermission = true;
Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getContext().getPackageName()));
FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
((Activity) getContext()).startActivityForResult(serviceIntent, REQUEST_OVERLAY_PERMISSION_CODE);
}
}
if (mMainComponentName != null) {
if (mMainComponentName != null && !needsOverlayPermission) {
loadApp(mMainComponentName);
}
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
@@ -140,6 +147,16 @@ public class ReactActivityDelegate {
if (getReactNativeHost().hasInstance()) {
getReactNativeHost().getReactInstanceManager()
.onActivityResult(getPlainActivity(), requestCode, resultCode, data);
} else {
// Did we request overlay permissions?
if (requestCode == REQUEST_OVERLAY_PERMISSION_CODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (Settings.canDrawOverlays(getContext())) {
if (mMainComponentName != null) {
loadApp(mMainComponentName);
}
Toast.makeText(getContext(), REDBOX_PERMISSION_GRANTED_MESSAGE, Toast.LENGTH_LONG).show();
}
}
}
}
@@ -191,8 +208,7 @@ public class ReactActivityDelegate {
mPermissionsCallback = new Callback() {
@Override
public void invoke(Object... args) {
if (mPermissionListener != null &&
mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
mPermissionListener = null;
}
}
@@ -56,10 +56,21 @@ import com.facebook.react.uimanager.events.EventDispatcher;
*/
public class ReactRootView extends SizeMonitoringFrameLayout implements RootView {
/**
* Listener interface for react root view events
*/
public interface ReactRootViewEventListener {
/**
* Called when the react context is attached to a ReactRootView.
*/
void onAttachedToReactInstance(ReactRootView rootView);
}
private @Nullable ReactInstanceManager mReactInstanceManager;
private @Nullable String mJSModuleName;
private @Nullable Bundle mLaunchOptions;
private @Nullable CustomGlobalLayoutListener mCustomGlobalLayoutListener;
private @Nullable ReactRootViewEventListener mRootViewEventListener;
private int mRootViewTag;
private boolean mWasMeasured = false;
private boolean mIsAttachedToInstance = false;
@@ -224,6 +235,16 @@ public class ReactRootView extends SizeMonitoringFrameLayout implements RootView
}
}
public void onAttachedToReactInstance() {
if (mRootViewEventListener != null) {
mRootViewEventListener.onAttachedToReactInstance(this);
}
}
public void setEventListener(ReactRootViewEventListener eventListener) {
mRootViewEventListener = eventListener;
}
/* package */ String getJSModuleName() {
return Assertions.assertNotNull(mJSModuleName);
}
@@ -810,6 +810,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
appParams.putDouble("rootTag", rootTag);
appParams.putMap("initialProps", initialProps);
catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
rootView.onAttachedToReactInstance();
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
@@ -22,7 +22,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;
@ReactModule(name = "JSCHeapCapture")
// This module is being called only by Java via the static method "captureHeap" that
// requires it to alreay be initialized, thus we eagerly initialize this module
@ReactModule(name = "JSCHeapCapture", needsEagerInit = true)
public class JSCHeapCapture extends ReactContextBaseJavaModule {
public interface HeapCapture extends JavaScriptModule {
void captureHeap(String path);
@@ -21,7 +21,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;
@ReactModule(name = "JSCSamplingProfiler")
// This module is being called only by Java via the static method "poke" that
// requires it to alreay be initialized, thus we eagerly initialize this module
@ReactModule(name = "JSCSamplingProfiler", needsEagerInit = true)
public class JSCSamplingProfiler extends ReactContextBaseJavaModule {
public interface SamplingProfiler extends JavaScriptModule {
void poke(int token);
@@ -9,7 +9,7 @@ android_library(
'layoutanimation/*.java'
]),
deps = [
CSSLAYOUT_TARGET,
YOGA_TARGET,
react_native_dep('java/com/facebook/systrace:systrace'),
react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
@@ -6,13 +6,13 @@ import javax.annotation.Nullable;
import java.util.Locale;
import com.facebook.csslayout.CSSAlign;
import com.facebook.csslayout.CSSConstants;
import com.facebook.csslayout.CSSFlexDirection;
import com.facebook.csslayout.CSSJustify;
import com.facebook.csslayout.CSSOverflow;
import com.facebook.csslayout.CSSPositionType;
import com.facebook.csslayout.CSSWrap;
import com.facebook.yoga.YogaAlign;
import com.facebook.yoga.YogaConstants;
import com.facebook.yoga.YogaFlexDirection;
import com.facebook.yoga.YogaJustify;
import com.facebook.yoga.YogaOverflow;
import com.facebook.yoga.YogaPositionType;
import com.facebook.yoga.YogaWrap;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
@@ -27,57 +27,57 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup;
*/
public class LayoutShadowNode extends ReactShadowNode {
@ReactProp(name = ViewProps.WIDTH, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.WIDTH, defaultFloat = YogaConstants.UNDEFINED)
public void setWidth(float width) {
if (isVirtual()) {
return;
}
setStyleWidth(CSSConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
setStyleWidth(YogaConstants.isUndefined(width) ? width : PixelUtil.toPixelFromDIP(width));
}
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.MIN_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
public void setMinWidth(float minWidth) {
if (isVirtual()) {
return;
}
setStyleMinWidth(
CSSConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
YogaConstants.isUndefined(minWidth) ? minWidth : PixelUtil.toPixelFromDIP(minWidth));
}
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.MAX_WIDTH, defaultFloat = YogaConstants.UNDEFINED)
public void setMaxWidth(float maxWidth) {
if (isVirtual()) {
return;
}
setStyleMaxWidth(
CSSConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
YogaConstants.isUndefined(maxWidth) ? maxWidth : PixelUtil.toPixelFromDIP(maxWidth));
}
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
public void setHeight(float height) {
if (isVirtual()) {
return;
}
setStyleHeight(
CSSConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
YogaConstants.isUndefined(height) ? height : PixelUtil.toPixelFromDIP(height));
}
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.MIN_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
public void setMinHeight(float minHeight) {
if (isVirtual()) {
return;
}
setStyleMinHeight(
CSSConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
YogaConstants.isUndefined(minHeight) ? minHeight : PixelUtil.toPixelFromDIP(minHeight));
}
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.MAX_HEIGHT, defaultFloat = YogaConstants.UNDEFINED)
public void setMaxHeight(float maxHeight) {
if (isVirtual()) {
return;
}
setStyleMaxHeight(
CSSConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
YogaConstants.isUndefined(maxHeight) ? maxHeight : PixelUtil.toPixelFromDIP(maxHeight));
}
@ReactProp(name = ViewProps.FLEX, defaultFloat = 0f)
@@ -112,7 +112,7 @@ public class LayoutShadowNode extends ReactShadowNode {
super.setFlexBasis(flexBasis);
}
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = CSSConstants.UNDEFINED)
@ReactProp(name = ViewProps.ASPECT_RATIO, defaultFloat = YogaConstants.UNDEFINED)
public void setAspectRatio(float aspectRatio) {
setStyleAspectRatio(aspectRatio);
}
@@ -123,7 +123,7 @@ public class LayoutShadowNode extends ReactShadowNode {
return;
}
setFlexDirection(
flexDirection == null ? CSSFlexDirection.COLUMN : CSSFlexDirection.valueOf(
flexDirection == null ? YogaFlexDirection.COLUMN : YogaFlexDirection.valueOf(
flexDirection.toUpperCase(Locale.US).replace("-", "_")));
}
@@ -133,9 +133,9 @@ public class LayoutShadowNode extends ReactShadowNode {
return;
}
if (flexWrap == null || flexWrap.equals("nowrap")) {
setFlexWrap(CSSWrap.NO_WRAP);
setFlexWrap(YogaWrap.NO_WRAP);
} else if (flexWrap.equals("wrap")) {
setFlexWrap(CSSWrap.WRAP);
setFlexWrap(YogaWrap.WRAP);
} else {
throw new IllegalArgumentException("Unknown flexWrap value: " + flexWrap);
}
@@ -146,7 +146,7 @@ public class LayoutShadowNode extends ReactShadowNode {
if (isVirtual()) {
return;
}
setAlignSelf(alignSelf == null ? CSSAlign.AUTO : CSSAlign.valueOf(
setAlignSelf(alignSelf == null ? YogaAlign.AUTO : YogaAlign.valueOf(
alignSelf.toUpperCase(Locale.US).replace("-", "_")));
}
@@ -156,7 +156,7 @@ public class LayoutShadowNode extends ReactShadowNode {
return;
}
setAlignItems(
alignItems == null ? CSSAlign.STRETCH : CSSAlign.valueOf(
alignItems == null ? YogaAlign.STRETCH : YogaAlign.valueOf(
alignItems.toUpperCase(Locale.US).replace("-", "_")));
}
@@ -165,7 +165,7 @@ public class LayoutShadowNode extends ReactShadowNode {
if (isVirtual()) {
return;
}
setJustifyContent(justifyContent == null ? CSSJustify.FLEX_START : CSSJustify.valueOf(
setJustifyContent(justifyContent == null ? YogaJustify.FLEX_START : YogaJustify.valueOf(
justifyContent.toUpperCase(Locale.US).replace("-", "_")));
}
@@ -174,7 +174,7 @@ public class LayoutShadowNode extends ReactShadowNode {
if (isVirtual()) {
return;
}
setOverflow(overflow == null ? CSSOverflow.VISIBLE : CSSOverflow.valueOf(
setOverflow(overflow == null ? YogaOverflow.VISIBLE : YogaOverflow.valueOf(
overflow.toUpperCase(Locale.US).replace("-", "_")));
}
@@ -186,7 +186,7 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.MARGIN_RIGHT,
ViewProps.MARGIN_TOP,
ViewProps.MARGIN_BOTTOM,
}, defaultFloat = CSSConstants.UNDEFINED)
}, defaultFloat = YogaConstants.UNDEFINED)
public void setMargins(int index, float margin) {
if (isVirtual()) {
return;
@@ -202,14 +202,14 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.PADDING_RIGHT,
ViewProps.PADDING_TOP,
ViewProps.PADDING_BOTTOM,
}, defaultFloat = CSSConstants.UNDEFINED)
}, defaultFloat = YogaConstants.UNDEFINED)
public void setPaddings(int index, float padding) {
if (isVirtual()) {
return;
}
setPadding(
ViewProps.PADDING_MARGIN_SPACING_TYPES[index],
CSSConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
YogaConstants.isUndefined(padding) ? padding : PixelUtil.toPixelFromDIP(padding));
}
@ReactPropGroup(names = {
@@ -218,7 +218,7 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.BORDER_RIGHT_WIDTH,
ViewProps.BORDER_TOP_WIDTH,
ViewProps.BORDER_BOTTOM_WIDTH,
}, defaultFloat = CSSConstants.UNDEFINED)
}, defaultFloat = YogaConstants.UNDEFINED)
public void setBorderWidths(int index, float borderWidth) {
if (isVirtual()) {
return;
@@ -231,14 +231,14 @@ public class LayoutShadowNode extends ReactShadowNode {
ViewProps.RIGHT,
ViewProps.TOP,
ViewProps.BOTTOM,
}, defaultFloat = CSSConstants.UNDEFINED)
}, defaultFloat = YogaConstants.UNDEFINED)
public void setPositionValues(int index, float position) {
if (isVirtual()) {
return;
}
setPosition(
ViewProps.POSITION_SPACING_TYPES[index],
CSSConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
YogaConstants.isUndefined(position) ? position : PixelUtil.toPixelFromDIP(position));
}
@ReactProp(name = ViewProps.POSITION)
@@ -246,8 +246,8 @@ public class LayoutShadowNode extends ReactShadowNode {
if (isVirtual()) {
return;
}
CSSPositionType positionType = position == null ?
CSSPositionType.RELATIVE : CSSPositionType.valueOf(position.toUpperCase(Locale.US));
YogaPositionType positionType = position == null ?
YogaPositionType.RELATIVE : YogaPositionType.valueOf(position.toUpperCase(Locale.US));
setPositionType(positionType);
}
@@ -13,25 +13,25 @@ import javax.annotation.Nullable;
import java.util.ArrayList;
import com.facebook.csslayout.CSSAlign;
import com.facebook.csslayout.CSSEdge;
import com.facebook.csslayout.CSSConstants;
import com.facebook.csslayout.CSSDirection;
import com.facebook.csslayout.CSSFlexDirection;
import com.facebook.csslayout.CSSJustify;
import com.facebook.csslayout.CSSNode;
import com.facebook.csslayout.CSSNodeAPI;
import com.facebook.csslayout.CSSOverflow;
import com.facebook.csslayout.CSSPositionType;
import com.facebook.csslayout.CSSWrap;
import com.facebook.yoga.YogaAlign;
import com.facebook.yoga.YogaEdge;
import com.facebook.yoga.YogaConstants;
import com.facebook.yoga.YogaDirection;
import com.facebook.yoga.YogaFlexDirection;
import com.facebook.yoga.YogaJustify;
import com.facebook.yoga.YogaMeasureFunction;
import com.facebook.yoga.YogaNode;
import com.facebook.yoga.YogaOverflow;
import com.facebook.yoga.YogaPositionType;
import com.facebook.yoga.YogaWrap;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
/**
* Base node class for representing virtual tree of React nodes. Shadow nodes are used primarily
* for layouting therefore it extends {@link CSSNode} to allow that. They also help with handling
* Common base subclass of {@link CSSNode} for all layout nodes for react-based view. It extends
* {@link CSSNode} by adding additional capabilities.
* for layouting therefore it extends {@link YogaNode} to allow that. They also help with handling
* Common base subclass of {@link YogaNode} for all layout nodes for react-based view. It extends
* {@link YogaNode} by adding additional capabilities.
*
* Instances of this class receive property updates from JS via @{link UIManagerModule}. Subclasses
* may use {@link #updateShadowNode} to persist some of the updated fields in the node instance that
@@ -43,7 +43,7 @@ import com.facebook.react.uimanager.annotations.ReactPropertyHolder;
* custom subclass of it if necessary.
*
* The primary use-case for {@link ReactShadowNode} nodes is to calculate layouting. Although this
* might be extended. For some examples please refer to ARTGroupCSSNode or ReactTextCSSNode.
* might be extended. For some examples please refer to ARTGroupYogaNode or ReactTextYogaNode.
*
* This class allows for the native view hierarchy to not be an exact copy of the hierarchy received
* from JS by keeping track of both JS children (e.g. {@link #getChildCount()} and separately native
@@ -72,18 +72,18 @@ public class ReactShadowNode {
private float mAbsoluteRight;
private float mAbsoluteBottom;
private final Spacing mDefaultPadding = new Spacing(0);
private final Spacing mPadding = new Spacing(CSSConstants.UNDEFINED);
private final CSSNode mCSSNode;
private final Spacing mPadding = new Spacing(YogaConstants.UNDEFINED);
private final YogaNode mYogaNode;
public ReactShadowNode() {
if (!isVirtual()) {
CSSNode node = CSSNodePool.get().acquire();
YogaNode node = YogaNodePool.get().acquire();
if (node == null) {
node = new CSSNode();
node = new YogaNode();
}
mCSSNode = node;
mYogaNode = node;
} else {
mCSSNode = null;
mYogaNode = null;
}
}
@@ -138,12 +138,12 @@ public class ReactShadowNode {
public void dirty() {
if (!isVirtual()) {
mCSSNode.dirty();
mYogaNode.dirty();
}
}
public final boolean isDirty() {
return mCSSNode != null && mCSSNode.isDirty();
return mYogaNode != null && mYogaNode.isDirty();
}
public void addChildAt(ReactShadowNode child, int i) {
@@ -159,13 +159,13 @@ public class ReactShadowNode {
// If a CSS node has measure defined, the layout algorithm will not visit its children. Even
// more, it asserts that you don't add children to nodes with measure functions.
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
CSSNode childCSSNode = child.mCSSNode;
if (childCSSNode == null) {
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
YogaNode childYogaNode = child.mYogaNode;
if (childYogaNode == null) {
throw new RuntimeException(
"Cannot add a child that doesn't have a CSS node to a node without a measure function!");
}
mCSSNode.addChildAt(childCSSNode, i);
mYogaNode.addChildAt(childYogaNode, i);
}
markUpdated();
@@ -183,8 +183,8 @@ public class ReactShadowNode {
ReactShadowNode removed = mChildren.remove(i);
removed.mParent = null;
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
mCSSNode.removeChildAt(i);
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
mYogaNode.removeChildAt(i);
}
markUpdated();
@@ -217,8 +217,8 @@ public class ReactShadowNode {
int decrease = 0;
for (int i = getChildCount() - 1; i >= 0; i--) {
if (mCSSNode != null && !mCSSNode.isMeasureDefined()) {
mCSSNode.removeChildAt(i);
if (mYogaNode != null && !mYogaNode.isMeasureDefined()) {
mYogaNode.removeChildAt(i);
}
ReactShadowNode toRemove = getChildAt(i);
toRemove.mParent = null;
@@ -339,16 +339,16 @@ public class ReactShadowNode {
}
public void calculateLayout() {
mCSSNode.calculateLayout();
mYogaNode.calculateLayout();
}
public final boolean hasNewLayout() {
return mCSSNode == null ? false : mCSSNode.hasNewLayout();
return mYogaNode == null ? false : mYogaNode.hasNewLayout();
}
public final void markLayoutSeen() {
if (mCSSNode != null) {
mCSSNode.markLayoutSeen();
if (mYogaNode != null) {
mYogaNode.markLayoutSeen();
}
}
@@ -463,19 +463,19 @@ public class ReactShadowNode {
}
public final float getLayoutX() {
return mCSSNode.getLayoutX();
return mYogaNode.getLayoutX();
}
public final float getLayoutY() {
return mCSSNode.getLayoutY();
return mYogaNode.getLayoutY();
}
public final float getLayoutWidth() {
return mCSSNode.getLayoutWidth();
return mYogaNode.getLayoutWidth();
}
public final float getLayoutHeight() {
return mCSSNode.getLayoutHeight();
return mYogaNode.getLayoutHeight();
}
/**
@@ -506,96 +506,96 @@ public class ReactShadowNode {
return Math.round(mAbsoluteBottom - mAbsoluteTop);
}
public final CSSDirection getLayoutDirection() {
return mCSSNode.getLayoutDirection();
public final YogaDirection getLayoutDirection() {
return mYogaNode.getLayoutDirection();
}
public void setLayoutDirection(CSSDirection direction) {
mCSSNode.setDirection(direction);
public void setLayoutDirection(YogaDirection direction) {
mYogaNode.setDirection(direction);
}
public final float getStyleWidth() {
return mCSSNode.getWidth();
return mYogaNode.getWidth();
}
public void setStyleWidth(float widthPx) {
mCSSNode.setWidth(widthPx);
mYogaNode.setWidth(widthPx);
}
public void setStyleMinWidth(float widthPx) {
mCSSNode.setMinWidth(widthPx);
mYogaNode.setMinWidth(widthPx);
}
public void setStyleMaxWidth(float widthPx) {
mCSSNode.setMaxWidth(widthPx);
mYogaNode.setMaxWidth(widthPx);
}
public final float getStyleHeight() {
return mCSSNode.getHeight();
return mYogaNode.getHeight();
}
public void setStyleHeight(float heightPx) {
mCSSNode.setHeight(heightPx);
mYogaNode.setHeight(heightPx);
}
public void setStyleMinHeight(float widthPx) {
mCSSNode.setMinHeight(widthPx);
mYogaNode.setMinHeight(widthPx);
}
public void setStyleMaxHeight(float widthPx) {
mCSSNode.setMaxHeight(widthPx);
mYogaNode.setMaxHeight(widthPx);
}
public void setFlex(float flex) {
mCSSNode.setFlex(flex);
mYogaNode.setFlex(flex);
}
public void setFlexGrow(float flexGrow) {
mCSSNode.setFlexGrow(flexGrow);
mYogaNode.setFlexGrow(flexGrow);
}
public void setFlexShrink(float flexShrink) {
mCSSNode.setFlexShrink(flexShrink);
mYogaNode.setFlexShrink(flexShrink);
}
public void setFlexBasis(float flexBasis) {
mCSSNode.setFlexBasis(flexBasis);
mYogaNode.setFlexBasis(flexBasis);
}
public void setStyleAspectRatio(float aspectRatio) {
mCSSNode.setAspectRatio(aspectRatio);
mYogaNode.setAspectRatio(aspectRatio);
}
public void setFlexDirection(CSSFlexDirection flexDirection) {
mCSSNode.setFlexDirection(flexDirection);
public void setFlexDirection(YogaFlexDirection flexDirection) {
mYogaNode.setFlexDirection(flexDirection);
}
public void setFlexWrap(CSSWrap wrap) {
mCSSNode.setWrap(wrap);
public void setFlexWrap(YogaWrap wrap) {
mYogaNode.setWrap(wrap);
}
public void setAlignSelf(CSSAlign alignSelf) {
mCSSNode.setAlignSelf(alignSelf);
public void setAlignSelf(YogaAlign alignSelf) {
mYogaNode.setAlignSelf(alignSelf);
}
public void setAlignItems(CSSAlign alignItems) {
mCSSNode.setAlignItems(alignItems);
public void setAlignItems(YogaAlign alignItems) {
mYogaNode.setAlignItems(alignItems);
}
public void setJustifyContent(CSSJustify justifyContent) {
mCSSNode.setJustifyContent(justifyContent);
public void setJustifyContent(YogaJustify justifyContent) {
mYogaNode.setJustifyContent(justifyContent);
}
public void setOverflow(CSSOverflow overflow) {
mCSSNode.setOverflow(overflow);
public void setOverflow(YogaOverflow overflow) {
mYogaNode.setOverflow(overflow);
}
public void setMargin(int spacingType, float margin) {
mCSSNode.setMargin(CSSEdge.fromInt(spacingType), margin);
mYogaNode.setMargin(YogaEdge.fromInt(spacingType), margin);
}
public final float getPadding(int spacingType) {
return mCSSNode.getPadding(CSSEdge.fromInt(spacingType));
return mYogaNode.getPadding(YogaEdge.fromInt(spacingType));
}
public void setDefaultPadding(int spacingType, float padding) {
@@ -614,66 +614,66 @@ public class ReactShadowNode {
spacingType == Spacing.RIGHT ||
spacingType == Spacing.START ||
spacingType == Spacing.END) {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
YogaConstants.isUndefined(mPadding.getRaw(Spacing.HORIZONTAL)) &&
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
} else {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
}
} else if (spacingType == Spacing.TOP || spacingType == Spacing.BOTTOM) {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
CSSConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType)) &&
YogaConstants.isUndefined(mPadding.getRaw(Spacing.VERTICAL)) &&
YogaConstants.isUndefined(mPadding.getRaw(Spacing.ALL))) {
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
} else {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
}
} else {
if (CSSConstants.isUndefined(mPadding.getRaw(spacingType))) {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
if (YogaConstants.isUndefined(mPadding.getRaw(spacingType))) {
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mDefaultPadding.getRaw(spacingType));
} else {
mCSSNode.setPadding(CSSEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
mYogaNode.setPadding(YogaEdge.fromInt(spacingType), mPadding.getRaw(spacingType));
}
}
}
}
public void setBorder(int spacingType, float borderWidth) {
mCSSNode.setBorder(CSSEdge.fromInt(spacingType), borderWidth);
mYogaNode.setBorder(YogaEdge.fromInt(spacingType), borderWidth);
}
public void setPosition(int spacingType, float position) {
mCSSNode.setPosition(CSSEdge.fromInt(spacingType), position);
mYogaNode.setPosition(YogaEdge.fromInt(spacingType), position);
}
public void setPositionType(CSSPositionType positionType) {
mCSSNode.setPositionType(positionType);
public void setPositionType(YogaPositionType positionType) {
mYogaNode.setPositionType(positionType);
}
public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) {
mShouldNotifyOnLayout = shouldNotifyOnLayout;
}
public void setMeasureFunction(CSSNodeAPI.MeasureFunction measureFunction) {
if ((measureFunction == null ^ mCSSNode.isMeasureDefined()) &&
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
if ((measureFunction == null ^ mYogaNode.isMeasureDefined()) &&
getChildCount() != 0) {
throw new RuntimeException(
"Since a node with a measure function does not add any native CSSLayout children, it's " +
"Since a node with a measure function does not add any native yoga children, it's " +
"not safe to transition to/from having a measure function unless a node has no children");
}
mCSSNode.setMeasureFunction(measureFunction);
mYogaNode.setMeasureFunction(measureFunction);
}
@Override
public String toString() {
return mCSSNode.toString();
return mYogaNode.toString();
}
public void dispose() {
if (mCSSNode != null) {
mCSSNode.reset();
CSSNodePool.get().release(mCSSNode);
if (mYogaNode != null) {
mYogaNode.reset();
YogaNodePool.get().release(mYogaNode);
}
}
}
@@ -9,7 +9,7 @@
package com.facebook.react.uimanager;
import com.facebook.csslayout.CSSConstants;
import com.facebook.yoga.YogaConstants;
import java.util.Arrays;
@@ -96,7 +96,7 @@ public class Spacing {
if (!FloatUtil.floatsEqual(mSpacing[spacingType], value)) {
mSpacing[spacingType] = value;
if (CSSConstants.isUndefined(value)) {
if (YogaConstants.isUndefined(value)) {
mValueFlags &= ~sFlagsMap[spacingType];
} else {
mValueFlags |= sFlagsMap[spacingType];
@@ -120,7 +120,7 @@ public class Spacing {
*/
public float get(int spacingType) {
float defaultValue = (spacingType == START || spacingType == END
? CSSConstants.UNDEFINED
? YogaConstants.UNDEFINED
: mDefaultValue);
if (mValueFlags == 0) {
@@ -159,7 +159,7 @@ public class Spacing {
* recycling {@link Spacing} instances.
*/
public void reset() {
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
Arrays.fill(mSpacing, YogaConstants.UNDEFINED);
mHasAliasesSet = false;
mValueFlags = 0;
}
@@ -178,15 +178,15 @@ public class Spacing {
private static float[] newFullSpacingArray() {
return new float[] {
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
YogaConstants.UNDEFINED,
};
}
}
@@ -14,7 +14,7 @@ import java.util.Arrays;
import java.util.List;
import com.facebook.common.logging.FLog;
import com.facebook.csslayout.CSSDirection;
import com.facebook.yoga.YogaDirection;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.animation.Animation;
import com.facebook.react.bridge.Arguments;
@@ -84,7 +84,7 @@ public class UIImplementation {
ReactShadowNode rootCSSNode = new ReactShadowNode();
I18nUtil sharedI18nUtilInstance = I18nUtil.getInstance();
if (sharedI18nUtilInstance.isRTL(mReactContext)) {
rootCSSNode.setLayoutDirection(CSSDirection.RTL);
rootCSSNode.setLayoutDirection(YogaDirection.RTL);
}
rootCSSNode.setViewClassName("Root");
return rootCSSNode;
@@ -144,7 +144,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
mEventDispatcher.onCatalystInstanceDestroyed();
getReactApplicationContext().unregisterComponentCallbacks(mMemoryTrimCallback);
CSSNodePool.get().clear();
YogaNodePool.get().clear();
}
private static Map<String, Object> createConstants(List<ViewManager> viewManagerList) {
@@ -570,7 +570,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
@Override
public void onTrimMemory(int level) {
if (level >= TRIM_MEMORY_MODERATE) {
CSSNodePool.get().clear();
YogaNodePool.get().clear();
}
}

Some files were not shown because too many files have changed in this diff Show More