Commit Graph

18 Commits

Author SHA1 Message Date
Shruti Malugu edbb48c67a Replacing all instances of [UIApplication sharedApplication] wi…
Summary:
…th RCTSharedApplication()

Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
          Using React Native latest version with Cocoapods 1.2.0 causes the following error inside iOS app extensions

> /react-native/React/Modules/RCTAccessibilityManager.m:67:70: ‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.

Moving the use of [UIApplication sharedApplication] to RCTSharedApplication() which is safe on app extension

- [ ] Provide a **test plan** demonstrating that the code is solid.
        I am not sure how to test such that all the features which touch the modified code are tested.

- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?
    Using React Native latest v
Closes https://github.com/facebook/react-native/pull/13227

Differential Revision: D4816338

Pulled By: javache

fbshipit-source-id: e3e3c77882990ad1817b0b633521cff52571ecd0
2017-04-01 03:34:41 -07:00
Marc Horowitz ba149d7277 Tease apart React and RCTBatchedBridge targets
Reviewed By: javache

Differential Revision: D4679655

fbshipit-source-id: 8123488c2d50dd7cc2329b5131e99998fe1f1e2f
2017-03-21 18:31:23 -07:00
Eloy Durán 19caaba1d5 Fixes current CI failures and allows tree shaking of native dev support code.
Summary:
* The dev support code moved into a `DevSupport` subspec, meaning that only if the subspec is specified in the user’s Podfile will the packager client, dev menu, etc be included. This is mainly done through checks for header availability.

  It also improves the weird situation where you had to specify the `RCTWebSocket` subspec if you wanted to be able to use the packager client during development.

* I removed hardcoding the release version in the podspec on release, because the podspec still relies on `package.json` when evaluating, so there’s no real point in not also getting the version number from there. This should remove any requirement to perform maintenance of the OSS release script regarding the podspec.
Closes https://github.com/facebook/react-native/pull/12602

Differential Revision: D4621021

Pulled By: ericvicenti

fbshipit-source-id: 6c208371fc40ea607809a6ab05dd3714ed9980cf
2017-02-27 14:04:58 -08:00
Ben Roth 6a14f0b449 Add RCTDevSettings module
Summary:
This decouples non-UI logic from RCTDevMenu into a new module RCTDevSettings.

**Motivation**: This allows developers to change dev settings without depending on the built-in dev menu, e.g. if they want to introduce their own UI, or have other devtools logic that doesn't depend on an action sheet.

It also introduces the RCTDevSettingsDataSource protocol for storing dev tools preferences. This could allow a developer to implement alternative behaviors, e.g. loading the settings from some other config, changing settings based on the user, deciding not to persist some settings, or something else.

The included data source implementation, RCTDevSettingsUserDefaultsDataSource, uses NSUserDefaults and is backwards compatible with the older implementation, so **no workflows or dependent code will break, and old saved settings will persist.**

The RCTDevMenu interface has not changed and is therefore also backwards-compatible, though
some methods are now deprecated.

In order to ensure that RCTDevSettings
Closes https://github.com/facebook/react-native/pull/11613

Reviewed By: mmmulani

Differential Revision: D4571773

Pulled By: javache

fbshipit-source-id: 25555d0a6eaa81f694343e079ed02439e5845fbc
2017-02-24 07:00:16 -08:00
Ciprian Pãtru dcf7f631f4 Enable perf monitor for CxxBridge
Reviewed By: javache

Differential Revision: D4510939

fbshipit-source-id: f90dc5c97b98ce68cb2c21e5f283790880b032a4
2017-02-09 12:47:04 -08:00
Pieter De Baets 9681583cf3 Disable RCTPerfMonitor on new bridge
Reviewed By: mhorowitz

Differential Revision: D4446988

fbshipit-source-id: f36360b1ea049e64e2a6a9bffce0af8d0ab6839a
2017-01-23 10:13:31 -08:00
Skotch Vail bcf4bb6edd Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK
Reviewed By: javache

Differential Revision: D3442470

fbshipit-source-id: 584a2bb3df5f7122166778b8fd44fae45560491e
2016-07-07 12:44:14 -07:00
Alexey Lang 97299260b6 Refactor RCTPerformanceLogger to avoid having global state
Reviewed By: javache

Differential Revision: D3509004

fbshipit-source-id: c4ab12b3f1defa32c2b1c211e775f6782ede4b7f
2016-07-07 07:29:57 -07:00
Nick Lockwood e72163f0f2 Added explicit init to observer modules
Summary:
Modules which call JS methods directly, or use `sendDeviceEventWithName:`, can trigger effects in JS without ever being referenced from the JS code. This breaks some assumptions in my earlier diff about when modules can be lazily loaded.

Pending a better solution, I've put explicit `init` methods in these modules to ensure they are eagerly initialized (the downside to this is that they'll still be initialized even if they are never used).

Reviewed By: javache

Differential Revision: D3258232

fb-gh-sync-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
fbshipit-source-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
2016-05-04 07:07:24 -07:00
Nick Lockwood 34ec6a91a9 Move setBridge: off main thread
Summary:
Previously, if a module implemented `setBridge:` we assumed that it needs to be initialised on the main thread. This assumption was not really warranted however, and it was a barrier to deferring module initialization.

This diff tweaks the rules so that only modules that override `init` or `constantsToExport**` are assumed to require main thread initialization, and others can be created lazily when they are first used.

WARNING: this will be a breaking change to any 3rd party modules that are assuming `setBridge:` is called on the main thread. Those modules should be rewritten to move any code that requires the main thread into `init` or `constantsToExport` instead.

`**` We will also be examining whether `constantsToExport` can be done lazily, but for now any module that uses it will still be created eagerly when the bridge starts up.

Reviewed By: javache

Differential Revision: D3240682

fb-gh-sync-id: 48f309e3158bbccb52141032baf70def3e609371
fbshipit-source-id: 48f309e3158bbccb52141032baf70def3e609371
2016-05-03 09:09:21 -07:00
Alexey Lang 24f7d88c98 Fix showing RCTPerformanceLogger data
Reviewed By: nicklockwood

Differential Revision: D3064023

fb-gh-sync-id: df9358dddfcc79e12a65a8b9c182615be64fc468
shipit-source-id: df9358dddfcc79e12a65a8b9c182615be64fc468
2016-03-17 07:27:27 -07:00
wenzhao.yin 50141f9d3f fix RCTPerfMonitor display unit error
Summary:The  RCTPerformanceLogger log the time in ms not us. Especially the unit of RCTPLBundleSize is byte.
Closes https://github.com/facebook/react-native/pull/5919

Differential Revision: D2982116

Pulled By: nicklockwood

fb-gh-sync-id: 18aad5ff2eb83c6f302b2c10382bf214b51df133
shipit-source-id: 18aad5ff2eb83c6f302b2c10382bf214b51df133
2016-02-26 04:54:32 -08:00
Tadeu Zagallo 809627379b Rename RCTContextExecutor to RCTJSCExecutor
Summary:
public

Rename the executor to so it actually says something about the implementation.

Reviewed By: jspahrsummers, nicklockwood

Differential Revision: D2759688

fb-gh-sync-id: 5b1ac447e75109fbbc2ee71c804710d9926785aa
2015-12-16 02:51:28 -08:00
Nick Lockwood fa0b45c58b Replaced RCTSparseArray with NSDictionary
Reviewed By: jspahrsummers

Differential Revision: D2651920

fb-gh-sync-id: 953e2ea33abfc7a3a553da95b13e9ab2bccc5a1c
2015-11-14 10:28:28 -08:00
Nick Lockwood c5b990f65f Added lightweight generic annotations
Summary: public

Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.

Fixed some type bugs and improved bridge validation in a few places.

Reviewed By: javache

Differential Revision: D2600189

fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
2015-11-03 14:49:30 -08:00
Tadeu Zagallo 287e0e3c49 Add RCTPerformanceLogger data to PerfMonitor
Summary: public

Add information the times recorded by RCTPerformanceLogger to RCTPerfMonitor,
tap the monitor to show a table view with the data.

Reviewed By: jspahrsummers

Differential Revision: D2595372

fb-gh-sync-id: dc3b73af71b6d7f258e4e5991116bbc6cedc21fb
2015-10-30 16:57:30 -07:00
Tadeu Zagallo a044ade333 Update button and add comments to Perf Monitor
Summary: public

Rename the dev menu button and add comments to the private method
used.

Reviewed By: ndfred

Differential Revision: D2576599

fb-gh-sync-id: cd5cde7562dcbc243663ac68d2b9cac5c0a984ab
2015-10-24 14:03:27 -07:00
Tadeu Zagallo 9069bdf1c2 Introduce Perf Monitor
Summary: public

Kill `RCTPerfStats` and introduce the new `RCTPerfMonitor`, including memory
usage, JSC heap size, number of RN views in screen, FPS (both on UI and JS threads)
and more to come.

It removes all the previous traces that were previous spread across the bridge
and the dev menu and moves everything to be more contained, so the whole thing
can be safely striped in production.

Reviewed By: nicklockwood

Differential Revision: D2575158

fb-gh-sync-id: 6a6d0c4422adbddeeefddd32ec3409a7095ff2a9
2015-10-23 10:56:56 -07:00