Commit Graph

558 Commits

Author SHA1 Message Date
Pieter De Baets c5a44b7ca3 Move font helpers to RCTFont
Reviewed By: majak

Differential Revision: D3662804

fbshipit-source-id: 2c03a094a74c617c0d6172e327bd77d23d0d44c2
2016-08-05 12:44:20 -07:00
Pieter De Baets e30327cb13 Fix styling of system fonts
Summary:
When you call `-[RCTConvert UIFont:withFamily:...]` with a non-nil font object, we'll try to use the existing font object for system information. On iOS9+ which uses the San Francisco font, `[UIFont fontNamesForFamilyName:]` doesn't return anything useful, so we need to make sure that we detect this as a system font and use the appropriate methods. This issues is made worse by the fact that RCTTextView and friends recreate the font property for every attribute that is set (pretty horrible perf-wise).

This fixes https://github.com/facebook/react-native/issues/2140

Reviewed By: sahrens

Differential Revision: D3662751

fbshipit-source-id: c528e8945ed361a922c03f861d3c0b584658573b
2016-08-05 12:44:20 -07:00
Pieter De Baets 0222107170 Customize main thread initialization of native modules (2nd try)
Reviewed By: majak

Differential Revision: D3671197

fbshipit-source-id: e8df7669be79303d335f2c881e97310b5fed47f9
2016-08-05 11:28:32 -07:00
Pieter De Baets b83ccb5749 Reverted commit D3580025
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
2016-08-02 14:13:27 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
Pieter De Baets 47d6d289d4 Customize main thread initialization of native modules
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 18abc15b894c745f584d91da47035c6db036aafa
2016-08-02 10:27:25 -07:00
Pieter De Baets 73f3713cd0 Improve error message when packager is not running
Reviewed By: majak

Differential Revision: D3655608

fbshipit-source-id: 49401a03beb986285d288bb80ba78052a26326ef
2016-08-02 08:13:57 -07:00
Nathan Azaria 8258366a3d Add gating to various use of RCTProfileIsProfiling
Reviewed By: javache

Differential Revision: D3641529

fbshipit-source-id: 21e685ab853159d19acea57c8cd9255a04d8226f
2016-08-01 23:58:33 -07:00
David Goldman fd48bc3cff Implement multi-source Images on iOS
Summary: Mirrors Android's support for multiple sources for Image, allowing us to fetch new images as the size of the view changes.

Reviewed By: mmmulani

Differential Revision: D3615134

fbshipit-source-id: 3d0bf2b75f63a4379e0e49f2dab9aea351b31d5f
2016-07-28 14:13:46 -07:00
Pieter De Baets 82c8129627 Fix double React perflogger creation
Reviewed By: mmmulani

Differential Revision: D3599003

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

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

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

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

Reviewed By: bnham

Differential Revision: D3433647

Pulled By: javache

fbshipit-source-id: 37bd6aff20c0465c163db3cdbcaeaedff55f7b1f
2016-07-21 07:58:51 -07:00
Emil Sjolander 1aa7ad0ab8 CamelCase
Reviewed By: majak

Differential Revision: D3576069

fbshipit-source-id: cecda2cdb67f2f66ac92e336068d58731ccdb101
2016-07-20 06:43:32 -07:00
David Goldman 9d2e6a2f8a Add ability to customize error messages and stacks within the iOS redbox
Reviewed By: javache

Differential Revision: D3517605

fbshipit-source-id: a2efba80bbe1f6c74bf4e01f7807389962cb2463
2016-07-18 11:28:36 -07:00
Pieter De Baets 23e28eca11 Add completion callback to enqueueJSCall
Reviewed By: majak

Differential Revision: D3423580

fbshipit-source-id: c063c9c5d8961d5c9cb14c32d70767c67d78430a
2016-07-18 07:13:32 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
Adam Ernst 31f01c02db Eliminate "packager running predicate"
Summary: Instead of the somewhat odd concept of a "packager running predicate", just expose a class method for generating a JS bundle URL given a host, root, and options. This can be used by consumers that need custom behavior.

Reviewed By: javache

Differential Revision: D3564185

fbshipit-source-id: b1a7e66a2dada6a9eefe783b12b03fca7a330be3
2016-07-15 05:43:47 -07:00
Emil Sjolander 4e056e94ff Use library imports for csslayout
Reviewed By: javache

Differential Revision: D3561526

fbshipit-source-id: b1b420f52230c323d64406deb813ee104dd6f7b5
2016-07-15 04:43:40 -07:00
Emil Sjolander a939f310ab Name library header same as library
Reviewed By: javache

Differential Revision: D3561336

fbshipit-source-id: fd4ccd4c731443c72252f6d20286b2772fc40a3c
2016-07-14 06:13:50 -07:00
Adam Ernst 22eabe59a2 Introduce experimental API to allow overriding how packager run status is determined
Summary: The docs for this new method explain what it does.

Differential Revision: D3556890

fbshipit-source-id: b075e750cdd1e7354e0a26c03b3fd74cca52aeb7
2016-07-13 16:43:38 -07:00
Adam Ernst 16d29fe16f Minor refactor to RCTBundleURLProvider's constants
Reviewed By: javache

Differential Revision: D3556772

fbshipit-source-id: ae394c751679171345804c4d2eab8cd41cc4ba13
2016-07-13 16:43:38 -07:00
Adam Ernst b4e267a993 Refactor RCTBundleURLProvider
Summary:
- Avoid using `+initialize`, use dispatch_once instead; it should be equivalent but more performant.
- Don't even let the `isPackagerRunning:` and `guessPackagerHost` methods exist unless `RCT_DEV` is on; they didn't do anything interesting when it is off.

Reviewed By: javache

Differential Revision: D3556645

fbshipit-source-id: 7dcdb4ae27f6625010e15846d757269f6f04155c
2016-07-13 16:43:38 -07:00
Adam Ernst 235dd0051d Remove allowLoadingNonRAMBundles
Differential Revision: D3555963

fbshipit-source-id: 24c23e8522c293aad030cd98e0c4ebcb76c54271
2016-07-13 16:43:38 -07:00
Adam Ernst 37d03396c6 Improve error message for non-file URLs
Summary: Include the actual scheme instead of "non-file".

Reviewed By: javache

Differential Revision: D3555812

fbshipit-source-id: 3ae0490f2d8fae01a551ba2877789dc15818fc50
2016-07-13 16:43:38 -07:00
yueshuaijie 8612d7640d Add WebView.dataDetectorTypes prop.
Summary:
WebView component detect phone numbers in html as URL links by default. But sometimes we don't want this behavior.
This PR add dataDetectorTypes as a prop of WebView, so one can specify value of this prop as one or more of phoneNumber/link/address/calendarEvent/none/all
This prop maps to UIWebView.dataDetectorTypes
Closes https://github.com/facebook/react-native/pull/8743

Differential Revision: D3556440

fbshipit-source-id: 55f01d2cdd785381f261a9dc931aa9311f0ad1d4
2016-07-13 14:43:25 -07:00
Pieter De Baets 7b7ecdf337 Cleanup warnings
Reviewed By: majak

Differential Revision: D3542606

fbshipit-source-id: 41246a012a32fafc4ddbb307c7b9919e3c203393
2016-07-12 05:59:12 -07:00
Adam Ernst 3be8c957b0 Minor cleanup to make loader unaware of bridge
Summary: The loader should be a utility that stands alone. The bridge uses the loader, not the other way around.

Reviewed By: bnham

Differential Revision: D3546157

fbshipit-source-id: 91016afb629df1f8c83c8fca6f42649be0b046b0
2016-07-12 05:28:37 -07:00
Adam Ernst c7a590655c Expose a method to synchronously load bundle if possible
Summary:
This diff exposes a new experimental method `[RCTJavaScriptLoader +attemptSynchronousLoadOfBundleAtURL:sourceLength:error:]`. It may be used if you know that a specific call site must load its JavaScript synchronously, or else fail entirely.

This new API will succeed for file URLs that point to a RAM bundle. It will fail for non-RAM-bundle files and for HTTP URLs.

This also cleans up the error domain and codes for this class. This should be the only externally visible change from this diff if you don't use the new API: the codes and domains you receive from the API may change slightly. They were pretty sloppy and undocumented before, so I think this change is for the better.

Reviewed By: bnham

Differential Revision: D3545956

fbshipit-source-id: 30e65f4e8330d2d68f3f50ade077fdc1db4a435e
2016-07-12 05:28:36 -07:00
Pieter De Baets 3816ced49b nil out pendingCalls when we're done with them
Reviewed By: mmmulani

Differential Revision: D3543825

fbshipit-source-id: cf2fcdb4e1536c00675fafa85d0f880313a80655
2016-07-11 13:33:58 -07:00
Pieter De Baets 81f59dfdc2 Remove code for testing without JS bundle
Reviewed By: mmmulani

Differential Revision: D3542347

fbshipit-source-id: d0dcfb65645faf515e6e48e6ff733646e1bcf907
2016-07-11 13:33:55 -07:00
Pieter De Baets 2ae23d9f36 Flush pending calls off the main-thread
Reviewed By: majak

Differential Revision: D3535193

fbshipit-source-id: 8c4736629eab3c723641f0c3fb449c168cd492a1
2016-07-11 13:33:52 -07:00
Pieter De Baets 7b718b03eb Allow RCTDisplayLink to pause more often
Summary:
By default we run the the JS display link, even if there are no modules listening. Given that most listeners will be lazily constructed, let's make it paused by default.

Since RCTTiming almost never unpauses due to some long-lived timers, implement a sleep timer that pauses the displaylink but uses an NSTimer to wake up in time.

Reviewed By: mhorowitz

Differential Revision: D3235044

fbshipit-source-id: 4a340fea552ada1bd8bc0d83b596a7df6f992387
2016-07-11 08:28:24 -07:00
Alex Kotliarskyi e5650560c0 Class for JS stack frames instead of dictionaries
Summary:
Currently React Native codebase treats JS stack traces as array of dictionaries.

This diff switches the Red Box to use new `RCTJSStackFrame` for internal data representation, while keeping the exposed API unchanged. The next step would be to replace the rest of manual parsing and usage of dictionaries.

The new class has ability to parse the stack from raw strings or dictionaries.

Depends on D3429031

Reviewed By: javache

Differential Revision: D3473199

fbshipit-source-id: 90d2a4f5e8e054b75c99905f35c2ee54927bb311
2016-07-11 06:13:32 -07:00
Nathan Azaria c8b5880102 Renamed updateObject:forKey to updateValue:forKey
Reviewed By: javache

Differential Revision: D3534820

fbshipit-source-id: 32afa39aedd43319fb5933ee0b169a41f4c8cd19
2016-07-11 03:43:23 -07:00
Nathan Azaria defc34a28b Removed calls to RCTBundleURLProvider setDefaults
Reviewed By: javache

Differential Revision: D3534799

fbshipit-source-id: 0c784cd9a993c6379e49087906ebf670ddd4f8cd
2016-07-11 02:58:32 -07:00
Pieter De Baets 4aedcc7670 Fix double completion callback in RCTJavascriptLoader
Reviewed By: foghina, mmmulani

Differential Revision: D3541511

fbshipit-source-id: 9a0a4be635ca910cb1a5c875a0f4a2b82c51cf71
2016-07-10 12:28:24 -07:00
Adam Ernst 7e1ea48379 Make executeAsyncBlockOnJavaScriptQueue required
Summary: This leaves no optional methods on `RCTJavaScriptExecutor`, which is certainly a good thing.

Reviewed By: majak

Differential Revision: D3518915

fbshipit-source-id: e606b9076c3299f81a225a181ea244148a1832cb
2016-07-07 13:43:39 -07:00
Adam Ernst a203cf4791 Make addSynchronousHookWithName private
Summary: It's not widely used, and you can do something equivalent anyway by using existing public API.

Reviewed By: javache

Differential Revision: D3518896

fbshipit-source-id: 6995a5d840aecfff4ffd78ac43f3f592a4f47f91
2016-07-07 13:43:39 -07:00
Adam Ernst 65120d7052 Avoid dispatching to the global queue to read the 4 byte RAM bundle magic number
Summary: Reading four bytes is not slow. Don't bother dispatching for that.

Reviewed By: javache

Differential Revision: D3518405

fbshipit-source-id: 910079cec2a1f624dd71760438765bd035055229
2016-07-07 13:43:38 -07:00
Adam Ernst 77752a0399 Move locals closer to point they are used
Summary: No need to have these way at the top; they're not used until later.

Reviewed By: majak

Differential Revision: D3518364

fbshipit-source-id: 3e7461665e90dea5c6d323d45b1ffb11fb610b09
2016-07-07 13:43:38 -07:00
Adam Ernst b3ac5f06d2 Close RAM bundle as soon as we read the magic number
Summary: No need to keep it open; it just makes it harder to reason about error handling.

Reviewed By: majak

Differential Revision: D3518200

fbshipit-source-id: dc1af6eb0f75de7e9f73513ed1dd522048f76670
2016-07-07 13:43:38 -07:00
Skotch Vail bcf4bb6edd Automated changes to remove implicit capture of self in blocks: Libraries/FBReactKit/BUCK
Reviewed By: javache

Differential Revision: D3442470

fbshipit-source-id: 584a2bb3df5f7122166778b8fd44fae45560491e
2016-07-07 12:44:14 -07:00
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
Nathan Azaria a9a0ff267f Move setDefaults call to constructor.
Reviewed By: javache

Differential Revision: D3514703

fbshipit-source-id: 8195778b23868eae36a55edc2d5d4f148b36a12e
2016-07-04 10:58:25 -07:00
Michael McKinley 6424c8b2e0 Remove CUIICatalog invalid asset name supplied error
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

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

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

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

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

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

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

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7535

Differential Revision: D3509757

fbshipit-source-id: 70ff6c9c137c766ccb1173921f08571f48cb4f0b
2016-07-01 11:29:50 -07:00
Marc Horowitz d1d9045eb4 Display JS exceptions and stacks in a red box.
Reviewed By: javache

Differential Revision: D3429031

fbshipit-source-id: a7ffd71151d8d78ccf8f0cc45807762b601cd112
2016-06-30 19:43:28 -07:00
Nathan Azaria 9845f49581 Fixed setDefaults not being called in React Native apps, fixed typo
Reviewed By: javache

Differential Revision: D3469296

fbshipit-source-id: 032472fede4bfbd051b0f725f35368b22edcc130
2016-06-22 07:13:26 -07:00
Nathan Azaria cfa9d5ef34 Added nil check to RCTModuleData
Reviewed By: javache

Differential Revision: D3456536

fbshipit-source-id: b23e618cf5b4a33822579b456c0f50a41a1c7a31
2016-06-20 05:44:19 -07:00
Siqi Liu 1e88c1261c Disable the double R shortcut to reload JS in iOS
Summary: Disable double R shortcut temporarily to fix a bug.

Reviewed By: majak

Differential Revision: D3428043

fbshipit-source-id: 23795b72433230e49d5ab559c0cb828bce8196ea
2016-06-14 05:30:30 -07:00
Nathan Azaria 8c29a52c54 Implemented automatic IP detection for iOS
Summary:
Implemented automatic IP detection for iOS, based on #6345 and #6362.
As the previous pull requests did, this works by writing the IP address of the host to a file.
Closes https://github.com/facebook/react-native/pull/8091

Differential Revision: D3427657

Pulled By: javache

fbshipit-source-id: 3f534c9b32c4d6fb9615fc2e2c3c3aef421454c5
2016-06-13 15:58:36 -07:00
Pieter De Baets d7fc58f32c Add RCT_PROFILE define
Reviewed By: tadeuzagallo

Differential Revision: D3423593

fbshipit-source-id: cc04add1bee16fbb4c2491bd229f23244fe3e7bd
2016-06-13 04:28:38 -07:00