Commit Graph

14 Commits

Author SHA1 Message Date
Ludo Fardel 0b348095b6 blurRadius for Image
Summary:
This adds blurRadius support for <Image>, similar to iOS.
The heavy-lifting was done by lambdapioneer in the stack of diffs ending with
D3924013, we're just patching this in.
Two notes: we might need to apply two postprocessors going forward, will tackle
that in a separate diff, so we can ship this asap.
However, we need a new version of fresco to be released in order
to ship this.

Reviewed By: lexs

Differential Revision: D3936438

fbshipit-source-id: 353bf1f1120ebd5f4f8266c5a20188b41478a741
2017-03-02 07:47:21 -08:00
Bhuwan Khattar a23a3c319c Add @providesModule annotations
Summary: Adding providesModule annotations to files that don't have a `providesModule` annotation but are in directories that packager crawls.

Reviewed By: cpojer

Differential Revision: D4612455

fbshipit-source-id: b23f0d6bbe2d26f480e93b56b67c6c8b1075e9f7
2017-02-27 14:04:56 -08:00
Peter Salanki 52d8851fc8 Cache policy control for image source
Summary:
In the context of an app an image exists in three resolutions on the server: `thumb` (30px) `feed` (300px) `full` (900px). When looking at an individual item a user can come either from the feed, via a permalink or from other parts of the app. This allows a situation where the `feed` image might or might not already be loaded somewhere in the app. In the detail view I want to render `thumb` with a blur (to quickly display something), then the `feed` image if it exists to have something decent to display until `full` loads. However it is quite a waste to load the `feed` image if it isn't already in cache, and will slow down the time until `full` is loaded. It is possible to track the navigation from feed->detail and that the `feed` image has actually completed loading by the feed component however as component hierarchies grow this turns into quite a lot of prop passing and bad separation of concerns.

NSURLRequests accepts a [Cache Policy](https://developer.apple.com/reference/fo
Closes https://github.com/facebook/react-native/pull/10844

Differential Revision: D4425959

Pulled By: lacker

fbshipit-source-id: 679835439c761a2fc894f56eb6d744c036cf0b49
2017-01-17 17:13:31 -08:00
Alex Kotliarskyi cab88104a3 Cleanup before image! codemod
Reviewed By: fkgozali

Differential Revision: D4196297

fbshipit-source-id: 5c32646dfe858f34c185a917e7d081a60777f242
2016-11-22 21:13:52 -08:00
Alex Kotliarskyi 7f0071ae58 Fix UIExplorer tests (image loading failure)
Reviewed By: jingc

Differential Revision: D4209282

fbshipit-source-id: 113612b8d9d8304c17a699ff416b66cf9ab1fdca
2016-11-18 21:13:34 -08:00
Jitae Kim 52d90da75e Modify image url from http to https on examples
Summary:
Modify image url from http to https on examples

> App Transport Security (ATS) is enabled by default for apps linked against the iOS 9.0 or OS X v10.11 SDKs or later, as indicated by the default Boolean value of NO for the NSAllowsArbitraryLoads key. This key is at the root level of the NSAppTransportSecurity dictionary.
With ATS enabled, HTTP connections must use HTTPS (RFC 2818). Attempts to connect using insecure HTTP fail. ATS employs the Transport Layer Security (TLS) protocol version 1.2 (RFC 5246). For background on secure Internet connections, read HTTPS Server Trust Evaluation.
https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35
Closes https://github.com/facebook/react-native/pull/10714

Differential Revision: D4124471

Pulled By: hramos

fbshipit-source-id: a7cc9d0267906747b00a1d88245af52c967c7b11
2016-11-03 08:13:37 -07:00
Andrei Coman 17405b9774 Fix image example
Summary: Bundled images is ios only, legacy image was not present in android resources.

Reviewed By: javache

Differential Revision: D3930349

fbshipit-source-id: 663019351615b173621ef27dbf67ec595f8a590f
2016-09-29 07:28:55 -07:00
Pieter De Baets 46b54fd7a8 Support bundle argument for image loading
Reviewed By: mmmulani

Differential Revision: D3768798

fbshipit-source-id: 5b35f06957cebfe74aca90fe6a456f7f739509a9
2016-08-31 17:43:49 -07:00
Pieter De Baets 84f68c338a Send down image source to RCTImageView onLoad callback on iOS
Summary: This allows the onLoad callback to know which image has actually loaded. This is only for iOS at the moment - implementing this for Android will require quite a bit more work.

Reviewed By: majak

Differential Revision: D3738759

fbshipit-source-id: b1fc2bd0dc5de90096debeab02b8f795739a4547
2016-08-22 10:58:49 -07:00
Pieter De Baets fba96ab990 Use image references consistently in UIExplorer
Reviewed By: davidaurelio

Differential Revision: D3728780

fbshipit-source-id: 4da6a0417eea1ccd0ec0d25574959661f05decb1
2016-08-17 04:43:52 -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
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
Brent Vatne a564af853f Throw flow error when trying to access a style that is not defined on a stylesheet
Summary:
I thought it would be useful to help clear out references to no longer used styles and also catch typos on style names to have flow error when we try to access a style that isn't defined.

Example:

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because `continer` is misspelled
    return (
      <View style={styles.continer} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

```javascript
export default class AuthenticationScreen extends React.Component {
  render() {
    // This throws an error because no fancyContainer style is defined
    return (
      <View style={[styles.container, styles.fancyContainer]} />
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
}
```

All credit goes to jeffmo in this tweet: https://twitter.com/lbljeffmo/status/755179096271888385

Also included in the PR is some cleanup on styles that
Closes https://github.com/facebook/react-native/pull/8876

Differential Revision: D3584983

Pulled By: yungsters

fbshipit-source-id: 0ee0e12ff3d976c137d932688e323c26690e0a52
2016-07-18 23:28:25 -07:00
Pieter De Baets 2f73ca8f76 Cleanup UIExplorer folder
Summary: Move all JS to a js/ subfolder so we get some overview of this folder again.

Reviewed By: bestander

Differential Revision: D3542598

fbshipit-source-id: 7637133fe4152f4d39e461b443b38510272d5bc8
2016-07-12 05:59:13 -07:00