Commit Graph

189 Commits

Author SHA1 Message Date
Nick 2a03182b1c CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Marc Horowitz 7a2698475e Replace :React with :FBReactOpenSourceKit
Reviewed By: javache

Differential Revision: D3055168

fb-gh-sync-id: 68cf6ab19ef1a2c8e7c9670474eeddd227412a34
shipit-source-id: 68cf6ab19ef1a2c8e7c9670474eeddd227412a34
2016-03-21 11:37:22 -07:00
Alon Schwarz fb8340d289 Add center ImageResizeMode option
Summary:Adds a `center` option to `Image`'s `resizeMode` prop, which doesn't enlarge images.
This is how it looks in UIExplorer:
{F60386921}

Reviewed By: dmmiller

Differential Revision: D3064284

fb-gh-sync-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
shipit-source-id: 79cd2da8f44c5b3da2e42d3bebf3131335f53c28
2016-03-19 11:25:24 -07:00
Reem Helou 9cb3ec9424 Add blur effect to RCTImageView
Summary: This diff introduces a blur radius property to the Image component on ios. If the radius specified is greater then 0 then native will apply a blur filter to the image

Reviewed By: nicklockwood

Differential Revision: D3054671

fb-gh-sync-id: d7a81ce5a08a3a2091c583f5053c6a86638b21b2
shipit-source-id: d7a81ce5a08a3a2091c583f5053c6a86638b21b2
2016-03-17 12:25:40 -07:00
Konstantin Raev 2273e012c0 Fixes OSS build: haste module -> commonJS invariant
Reviewed By: mkonicek

Differential Revision: D3058276

fb-gh-sync-id: 07b98608f4e684b0e192f64743a82717e65772ea
shipit-source-id: 07b98608f4e684b0e192f64743a82717e65772ea
2016-03-16 06:57:26 -07:00
Zahan Malkani 2209131933 Introduce custom asset resolver to resolveAssetSource(..)
Reviewed By: frantic

Differential Revision: D2989112

fb-gh-sync-id: a678d091aeb6904448c890653f57dd7944ce95c3
shipit-source-id: a678d091aeb6904448c890653f57dd7944ce95c3
2016-03-15 20:20:27 -07:00
Zahan Malkani 87245b2d40 Support the scriptURLs observed on Android for asset source resolver
Reviewed By: frantic

Differential Revision: D3005791

fb-gh-sync-id: 99acb350c8c80ebe22687294a0069891686885fc
shipit-source-id: 99acb350c8c80ebe22687294a0069891686885fc
2016-03-05 22:43:25 -08:00
Varun Vachhar d6ded2f807 Display a warning when using src property for an Image rather than source.
Summary:When using the `Image` component with a `src` property instead of `source` the component fails silently. vjeux suggested to add a warning (https://twitter.com/Vjeux/status/704509214937317378).

Tested with the UIExplorer example on iOS and Android simulators.
Closes https://github.com/facebook/react-native/pull/6221

Differential Revision: D3011659

Pulled By: mkonicek

fb-gh-sync-id: c9bae6c802c173ef85d9c4552747db994c58906e
shipit-source-id: c9bae6c802c173ef85d9c4552747db994c58906e
2016-03-04 07:32:22 -08:00
Nick Lockwood dc13115445 Dispatch module setup asynchronously to avoid blocking main thread when bridge starts
Summary:Initializing native modules can block the main thread for tens of milliseconds when it starts up, making it difficult to instantiate the bridge on demand without causing a performance blip.

This diff splits up the initialization of modules so that - although they still happen on the main thread - they don't block the thread continuously.

Reviewed By: javache

Differential Revision: D2965438

fb-gh-sync-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
shipit-source-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
2016-03-03 02:21:36 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Rui Chen 7e3266d7de Fix attributes checking for Image.android.js
Reviewed By: sahrens

Differential Revision: D2975018

fb-gh-sync-id: 226f2d3d3dcb538f0c3967346a9b226960c1d15c
shipit-source-id: 226f2d3d3dcb538f0c3967346a9b226960c1d15c
2016-02-29 18:02:35 -08:00
Nick Lockwood 738337815d Fixed issue with opaque thumbnails being given an alpha channel
Summary:Images cropped using the ImageEditor were always given an alpha channel, even if opaque.

This causes them to be saved as PNGs instead of JPEGs (increasing memory and bridge traffic) and also causes unnecessary blending when they are drawn.

Reviewed By: fkgozali

Differential Revision: D2982682

fb-gh-sync-id: b65f361efd78e35f259836111b38d914bae49847
shipit-source-id: b65f361efd78e35f259836111b38d914bae49847
2016-02-26 11:42:34 -08:00
Fada Chen 914862022c fix an image cropping bug when displaySize is specified
Summary:Diff D2647083 cleaned up image editing related logics and introduced an image cropping bug.
The bug is that the result of the image cropping will be wrong if displaySize is specified.
In particular, in Ads Manager App, we generate thumbnail by calling the image cropping function with displaySize set.
With this bug, the thumbnail we get is not correct.
This diff fixed the bug by replacing `image` with `croppedImage`. It should be a typo from D2647083

Reviewed By: zjj010104

Differential Revision: D2947730

fb-gh-sync-id: df7c7f3ddac5b053425db884f808e27b8418116e
shipit-source-id: df7c7f3ddac5b053425db884f808e27b8418116e
2016-02-18 00:38:31 -08:00
Nick Lockwood 0427c3d273 Added throttling on requests made by RCTImageLoader
Reviewed By: javache

Differential Revision: D2938143

fb-gh-sync-id: bac1185d4792dcca0012905126c9ef2aa45905d5
shipit-source-id: bac1185d4792dcca0012905126c9ef2aa45905d5
2016-02-16 12:42:34 -08:00
Nick Lockwood 915e5826ef Restricted image decoding to 2 simultaneous threads
Reviewed By: zjj010104

Differential Revision: D2922292

fb-gh-sync-id: eddd47d02fc721acc1da69e7483c6570997320b5
shipit-source-id: eddd47d02fc721acc1da69e7483c6570997320b5
2016-02-10 12:54:11 -08:00
Christopher Dro a11f980a34 Remove isRequired on source prop for Android
Summary:
Makes source required across both platforms.
Closes https://github.com/facebook/react-native/pull/5845

Reviewed By: svcscm

Differential Revision: D2920250

Pulled By: vjeux

fb-gh-sync-id: 21845b601df32dc2e12a95544afa3db4c0414746
shipit-source-id: 21845b601df32dc2e12a95544afa3db4c0414746
2016-02-09 19:16:38 -08:00
Wenjing Wang b55dcbe0af Fix CPU spike: should use UIGraphicsEndImageContext rather than UIGraphicsGetCurrentContext
Summary:
should use UIGraphicsEndImageContext rather than UIGraphicsGetCurrentContext

public

Reviewed By: nicklockwood, chaceliang

Differential Revision: D2875657

fb-gh-sync-id: 0fa059e2da3d0bb1ffe5fe50a1bdaeddafc2bbfa
2016-01-28 14:25:35 -08:00
Andreas Drivenes b85a52a461 Update Image docs and examples to the new asset system
Summary:
After the release of 0.14, static images should be placed in the source code tree and then required as explained in the [Images guide] (https://facebook.github.io/react-native/docs/images.html). This pull request updates the image documentation and examples to the new asset system. UIExplorer tested on iOS and Android.
Closes https://github.com/facebook/react-native/pull/4987

Reviewed By: svcscm

Differential Revision: D2796276

Pulled By: bestander

fb-gh-sync-id: 732ffa2f136391bb8a3e40a54b5b1ff5022c97f2
2016-01-27 13:47:45 -08:00
Konstantin Raev 1d819e9503 Open sourced <ImageEditor>, <ImageStore> for Android
Reviewed By: mkonicek

Differential Revision: D2869751

fb-gh-sync-id: 862c266601dd83ca3bf9c9bcbf107f7b17b8bdfd
2016-01-27 10:50:54 -08:00
Noam Bartov f68281a0d8 added support for overlayColor property for image
Summary:
In Android, Fresco's default rounding corners support mode is BITMAP_ONLY which doesn't work in all cases (such as animated GIF's, some scale types, etc.).
Specifying the new "overlayColor" property on an Image will cause Fresco to switch to the other rounding corners mode, OVERLAY_COLOR, and will draw rounded corners by overlaying the solid color specified.

Fresco's behaviour is explained here: http://frescolib.org/docs/rounded-corners-and-circles.html
Closes https://github.com/facebook/react-native/pull/5366

Reviewed By: svcscm

Differential Revision: D2854696

Pulled By: mkonicek

fb-gh-sync-id: 251701ee8a64acbfc22694e9d4661c40eef75725
2016-01-24 14:00:39 -08:00
Nick Lockwood 2cbc912756 Added support for width & height for text images
Summary:
public

Previously, `<Image>` elements embedded inside `<Text>` ignored all style attributes and props apart from `source`. Now, the `width`, `height` and `resizeMode` styles are observed. I've also added a transparent placeholder to be displayed while the image is loading, to prevent the layout from changing after the image has loaded.

Reviewed By: javache

Differential Revision: D2838659

fb-gh-sync-id: c27f9685b6976705ac2b24075922b2bf247e06ba
2016-01-22 11:32:32 -08:00
sunnylqm edb523c6d7 adjust getSize so that its doc can be shown on the page
Summary: Closes https://github.com/facebook/react-native/pull/5426

Reviewed By: svcscm

Differential Revision: D2848229

Pulled By: nicklockwood

fb-gh-sync-id: d1cc28af889c3b1e26a098044e85e0b10032a776
2016-01-21 08:23:36 -08:00
Nick Lockwood 21fcbbc32c Generalized image decoding and resizing logic
Summary:
public

Standardises the image decoding logic for all image sources, meaning we get the benefits of efficient downscaling of images from all sources, not just ALAssets.

Reviewed By: javache

Differential Revision: D2647083

fb-gh-sync-id: e41456f838e4c6ab709b1c1523f651a86ff6e623
2016-01-20 11:11:13 -08:00
Nick Lockwood e4c53c28ae Improved shadow performance
Summary:
public
React Native currently exposes the iOS layer shadow properties more-or-less directly, however there are a number of problems with this:

1) Performance when using these properties is poor by default. That's because iOS calculates the shadow by getting the exact pixel mask of the view, including any tranlucent content, and all of its subviews, which is very CPU and GPU-intensive.
2) The iOS shadow properties do not match the syntax or semantics of the CSS box-shadow standard, and are unlikely to be possible to implement on Android.
3) We don't expose the `layer.shadowPath` property, which is crucial to getting good performance out of layer shadows.

This diff solves problem number 1) by implementing a default `shadowPath` that matches the view border for views with an opaque background. This improves the performance of shadows by optimizing for the common usage case. I've also reinstated background color propagation for views which have shadow props - this should help ensure that this best-case scenario occurs more often.

For views with an explicit transparent background, the shadow will continue to work as it did before ( `shadowPath` will be left unset, and the shadow will be derived exactly from the pixels of the view and its subviews). This is the worst-case path for performance, however, so you should avoid it unless absolutely necessary. **Support for this may be disabled by default in future, or dropped altogether.**

For translucent images, it is suggested that you bake the shadow into the image itself, or use another mechanism to pre-generate the shadow. For text shadows, you should use the textShadow properties, which work cross-platform and have much better performance.

Problem number 2) will be solved in a future diff, possibly by renaming the iOS shadowXXX properties to boxShadowXXX, and changing the syntax and semantics to match the CSS standards.

Problem number 3) is now mostly moot, since we generate the shadowPath automatically. In future, we may provide an iOS-specific prop to set the path explicitly if there's a demand for more precise control of the shadow.

Reviewed By: weicool

Differential Revision: D2827581

fb-gh-sync-id: 853aa018e1d61d5f88304c6fc1b78f9d7e739804
2016-01-14 14:04:34 -08:00
Geoffrey Goh e730a9fdd0 Load assets from same folder as JSbundle (Android)
Summary:
https://github.com/facebook/react-native/issues/3679 was only partially fixed as the behaviour only works on iOS. This implements the same behaviour for Android. If the JSBundle was loaded from the assets folder, this will load images from the built-in resources. Else, load the image from the same folder as the JS bundle.

EDIT: For added clarity:

On iOS,
Bundle Location: 'file:///Path/To/Sample.app/main.bundle'
httpServerLocation: '/assets/module/a/'
Name: 'logo'
type: 'png'
**Resolved Asset location: '/Path/To/Sample.app/assets/module/a/logo.png'**

On Android,
Bundle Location: 'file:///sdcard/Path/To/main.bundle'
httpServerLocation: '/assets/module/a/',
name: 'logo'
type: 'png'
**Resolved Asset location: 'file:///sdcard/Path/To/drawable_mdpi/module_a_logo.png'**
Closes https://github.com/facebook/react-native/pull/4527

Reviewed By: svcscm

Differential Revision: D2788005

Pulled By: mkonicek

fb-gh-sync-id: 3f6462a7ee6370a92dd6727ac422c5de346c3ff1
2016-01-06 08:46:35 -08:00
Milen Dzhumerov 7d70b86a7b RCTImageUtils Obj-C nullability annotations
Summary:
Add Objective-C nullability annotations to RCTImageUtils

public

Reviewed By: nicklockwood

Differential Revision: D2797310

fb-gh-sync-id: 08329f70d1a09bf47865c9e7e76d7b4340eb6e80
2016-01-06 03:55:30 -08:00
Satyajit Sahoo 68147cf39c Update references to `image!` to use require syntax
Summary: Closes https://github.com/facebook/react-native/pull/5089

Reviewed By: svcscm

Differential Revision: D2798548

Pulled By: androidtrunkagent

fb-gh-sync-id: 9e561fcfc103102d4c4bfbebc463eadb2fdd561a
2016-01-04 07:41:27 -08:00
Nick Lockwood 718cd7953f Added getImageSize method
Summary:
public

This diff adds a `getSize()` method to `Image` to retrieve the width and height of an image prior to displaying it. This is useful when working with images from uncontrolled sources, and has been a much-requested feature.

In order to retrieve the image dimensions, the image may first need to be loaded or downloaded, after which it will be cached. This means that in principle you could use this method to preload images, however it is not optimized for that purpose, and may in future be implemented in a way that does not fully load/download the image data.

A fully supported way to preload images will be provided in a future diff.

The API (separate success and failure callbacks) is far from ideal, but until we agree on a unified standard, this was the most conventional way I could think of to implement it. If it returned a promise or something similar, it would be unique among all such APIS in the framework.

Please note that this has been a long time coming, in part due to much bikeshedding about what the API should look like, so while it's not unlikely that the API may change in future, I think having *some* way to do this is better than waiting until we can define the "perfect" way.

Reviewed By: vjeux

Differential Revision: D2797365

fb-gh-sync-id: 11eb1b8547773b1f8be0bc55ddf6dfedebf7fc0a
2015-12-31 18:51:30 -08:00
Nick Lockwood 55fe7ac9ae Fix flow errors
Reviewed By: gabelevi

Differential Revision: D2796260

fb-gh-sync-id: 8425e57a313326afb6f6ae5bb8b86a569f462b06
2015-12-31 07:48:29 -08:00
StefanT a162f72655 Added ColorPropType
Summary:
Problem: https://github.com/facebook/react-native/issues/4708

Solution: Added a ColorPropType that validates the color used by the dev

Notes:
1) I'm working a Win8.1 machine and couldn't build the react-native using the github repo. As soon as I figure that out, I'll probably figure how to run the tests and how to add some for this feature.
2) It's my first pull request. Be gentle :)
Closes https://github.com/facebook/react-native/pull/4866

Reviewed By: bestander, svcscm

Differential Revision: D2783672

Pulled By: nicklockwood

fb-gh-sync-id: ca22aa3c0999188075681b5d20fff0631496e238
2015-12-23 10:08:38 -08:00
Nick Lockwood 83c2e0303b Added JS wrappers for ImageStore and ImageEditor
Summary:
public
Added JS wrappers for ImageStore(Manager) and ImageEditor(Manager) so they can be required in the normal way instead of accessed directly via NativeModules.

Reviewed By: dmmiller

Differential Revision: D2773822

fb-gh-sync-id: 6eeafd3f80a87b1b91a04a2aebad6e2fd31b0e98
2015-12-23 10:08:07 -08:00
Qiao Liang edc318fcb9 added doc for image resizeMode
Summary:
based on 62e8ddc205/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java  and http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
Closes https://github.com/facebook/react-native/pull/4799

Reviewed By: svcscm

Differential Revision: D2762795

Pulled By: androidtrunkagent

fb-gh-sync-id: 2906c9f334f0afd4d58d4864a2b8472a5a871fc0
2015-12-15 17:34:29 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
zjlovezj 484fe9155b add backfaceVisibility to ImageStylePropTypes
Summary:
to eliminate to yellow box.
ViewStylePropTypes also has this prop.
0a3694ce48/Libraries/Components/View/ViewStylePropTypes.js
Closes https://github.com/facebook/react-native/pull/4765

Reviewed By: svcscm

Differential Revision: D2754433

Pulled By: androidtrunkagent

fb-gh-sync-id: 4bb53213aea6f7d629b31e0e4d4a46ae980ff219
2015-12-14 18:57:31 -08:00
Nick Lockwood ce7c0b735f Fixed image tinting
Summary:
public

A previous refactor introduced a bug where setting the tintColor of an <Image> to null no longer cleared the tint. This fixes it again.

Reviewed By: javache

Differential Revision: D2744279

fb-gh-sync-id: 1b5e0d546bf456d7b93e2ceee73c568c185c305c
2015-12-10 09:09:30 -08:00
Nick Lockwood b672294858 Added RCTImageSource
Summary:
public

The +[RCTConvert UIImage:] function, while convenient, is inherently limited by being synchronous, which means that it cannot be used to load remote images, and may not be efficient for local images either. It's also unable to access the bridge, which means that it cannot take advantage of the modular image-loading pipeline.

This diff introduces a new RCTImageSource class which can be used to pass image source objects over the bridge and defer loading until later.

I've also added automatic application of the `resolveAssetSource()` function based on prop type, and fixed up the image logic in NavigatorIOS and TabBarIOS.

Reviewed By: javache

Differential Revision: D2631541

fb-gh-sync-id: 6604635e8bb5394425102487f1ee7cd729321877
2015-12-08 03:32:30 -08:00
sathis abea6c30b4 Make style property available in Image.android.js like Image.ios.js
Summary:
Thanks ahanriat for pointing out  :)
Closes https://github.com/facebook/react-native/pull/4618

Reviewed By: svcscm

Differential Revision: D2729582

Pulled By: androidtrunkagent

fb-gh-sync-id: df7b9af24cc035c7a9618a7850d628961fcd776b
2015-12-07 10:47:28 -08:00
Olivier Notteghem a38ce5c570 match RN attachment images Feed experience with Native with spinner/fade in
Reviewed By: astreet

Differential Revision: D2722917

fb-gh-sync-id: a09b9a1a4b9a19b94471d8e93ec5bde53af7da06
2015-12-06 15:48:34 -08:00
Brent Vatne ae09a10c95 Add onLoadX support on Android
Summary: ~~This is a WIP, just finished the first bit and wanted to get some feedback to see if this approach seems appropriate, as I haven't done a lot of Android development.~~

Looks ready for review now.
Closes https://github.com/facebook/react-native/pull/3791

Reviewed By: svcscm

Differential Revision: D2672262

Pulled By: mkonicek

fb-gh-sync-id: 1e8f1cc6658fb719a68f7da455f30a7c9b1db730
2015-11-25 18:30:31 -08:00
Nick Lockwood 060664fd3d Refactored module access to allow for lazy loading
Summary: public

The `bridge.modules` dictionary provides access to all native modules, but this API requires that every module is initialized in advance so that any module can be accessed.

This diff introduces a better API that will allow modules to be initialized lazily as they are needed, and deprecates `bridge.modules` (modules that use it will still work, but should be rewritten to use `bridge.moduleClasses` or `-[bridge moduleForName/Class:` instead.

The rules are now as follows:

* Any module that overrides `init` or `setBridge:` will be initialized on the main thread when the bridge is created
* Any module that implements `constantsToExport:` will be initialized later when the config is exported (the module itself will be initialized on a background queue, but  `constantsToExport:` will still be called on the main thread.
* All other modules will be initialized lazily when a method is first called on them.

These rules may seem slightly arcane, but they have the advantage of not violating any assumptions that may have been made by existing code - any module written under the original assumption that it would be initialized synchronously on the main thread when the bridge is created should still function exactly the same, but modules that avoid overriding `init` or `setBridge:` will now be loaded lazily.

I've rewritten most of the standard modules to take advantage of this new lazy loading, with the following results:

Out of the 65 modules included in UIExplorer:

* 16 are initialized on the main thread when the bridge is created
* A further 8 are initialized when the config is exported to JS
* The remaining 41 will be initialized lazily on-demand

Reviewed By: jspahrsummers

Differential Revision: D2677695

fb-gh-sync-id: 507ae7e9fd6b563e89292c7371767c978e928f33
2015-11-25 04:49:45 -08:00
Nick Lockwood f827a513a1 Fixed double-callback for cached images
Summary: public

A missing return statement in RCTImageLoader meant that cached images would be loaded twice - once from cache and again from the source.

This was mostly innocuous, causing only a slight perf regression due to the image cache being effectively disabled, however in some cases (such as RCTImageEditingManager.cropImage) it caused the success callback to fire twice, resulting in a crash.

Reviewed By: fkgozali

Differential Revision: D2684956

fb-gh-sync-id: 7580a6fbfe00a30807951803e04bfcdbee3bb80a
2015-11-23 04:20:28 -08:00
Nick Lockwood 0fe074acbd Removed all calls to [UIImage imageWithData:] on a background thread
Summary: public

I had previously assumed (based on past experience and common wisdom) that `[UIImage imageWithData:]` was safe to call concurrently and/or off the main thread, but it seems that may not be the case (see https://github.com/AFNetworking/AFNetworking/pull/2815).

This diff replaces `[UIImage imageWithData:]` with ImageIO-based decoding wherever possible, and ensures that it is called on the main thread wherever that's not possible/convenient.

I've also serialized access to the `NSURLCache` inside `RCTImageLoader`, which was causing a separate-but-similar crash when loading images.

Reviewed By: fkgozali

Differential Revision: D2678369

fb-gh-sync-id: 74d033dafcf6c412556e4c96f5ac5d3432298b18
2015-11-20 05:17:33 -08:00
Krzysztof Magiera f2545bafc9 Use requireNativeComponent everywhere.
Reviewed By: sahrens

Differential Revision: D2663780

fb-gh-sync-id: 94a7e2265f6f869a2bdf1576dd8ea76b4c5f0b34
2015-11-18 09:43:28 -08:00
Matthieu Achard 2b657003b7 RTCImageStoreManager uses NSData instead of UIImage
Summary: Hi,

I'm currently building an app that changes metadata, does some resizes, maybe watermarking ...etc. I want to use RCTImageStoreManager to store the original image in memory and allow me to command different modifications from javascript as it gives me more flexibility. As RCTImageEditingManager does for example.

But currently the RTCImageStoreManager uses UIImage to store the image, the problem is that UIImage losses metadata.
So i suggest we change it to NSData.

Additionally I added a method to remove an image from the store.

A related PR can be found here https://github.com/lwansbrough/react-native-camera/pull/100.
Closes https://github.com/facebook/react-native/pull/3290

Reviewed By: javache

Differential Revision: D2647271

Pulled By: nicklockwood

fb-gh-sync-id: e66353ae3005423beee72ec22189dcb117fc719f
2015-11-17 09:55:31 -08:00
Pawel Sienkowski 5367e841ad Weak RCTBridge reference in RCTImageView
Reviewed By: nicklockwood

Differential Revision: D2660517

fb-gh-sync-id: 45a5e2b936cfb4b87a09ad7a756c030376d59da3
2015-11-17 09:14:30 -08:00
Nick Lockwood 5b796cec34 Reduced work done on main thread by RCTImageLoader
Summary: public

Removed redundant calls to [RCTNetwork canHandleRequest] in release mode when loading images, and improved perf for handler lookups when running in debug mode.

Reviewed By: tadeuzagallo

Differential Revision: D2663307

fb-gh-sync-id: 13285154c1c3773b32dba7894d86d14992e2fd7d
2015-11-17 07:21:29 -08:00
olivier notteghem 5217c8273f enabling progressive Jpeg rendering (part 2/2)
Reviewed By: nspaun

Differential Revision: D2658991

fb-gh-sync-id: 13a103458c30ea3e8f0cb37456d09f70f4e76e4a
2015-11-16 11:43:27 -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
Dave Miller a0268a7bfc Initial checkin for Image within Text nodes
Summary: This adds the basic support for embedding an image in a TextView.

Implementation details :

We create a ReactTextInlineImageShadowNode whenever an Image is embedded within a Text context.
That uses the same parsing code as ReactImageView (copied, not shared) to parse the source property to figure out the Uri where the resource is.

In ReactTextShadowNode we now look for the ReactTextInlineImageShadowNode and place a TextInlineImageSpan so that we can layout appropriately

Later at the time we go to setText on the TextView, we update that TextInlineImageSpan so that the proper Drawable (downloaded via Fresco) can be shown

public

Reviewed By: mkonicek

Differential Revision: D2652667

fb-gh-sync-id: 8f24924d204f78b8bc4d5d67835cc73b3c1859dd
2015-11-13 11:16:27 -08:00
Nick Lockwood 2eb8068cf1 Improved and generalized image thumbnail decoding logic
Reviewed By: jspahrsummers

Differential Revision: D2631934

fb-gh-sync-id: 3ddea328dcb0fc84b9d7b20708324f0b515f1b7f
2015-11-10 05:04:34 -08:00