diff --git a/releases/next/docs/actionsheetios.html b/releases/next/docs/actionsheetios.html index 351a82bf34b..3490afa76d7 100644 --- a/releases/next/docs/actionsheetios.html +++ b/releases/next/docs/actionsheetios.html @@ -114,9 +114,9 @@ class ShareActionSheetExample extends ] }, (error) => alert(error), - (success, method) => { + (completed, method) => { var text; - if (success) { + if (completed) { text = `Shared via ${method}`; } else { text = 'You didn\'t share'; @@ -155,9 +155,9 @@ class ShareScreenshotExample extends ] }, (error) => alert(error), - (success, method) => { + (completed, method) => { var text; - if (success) { + if (completed) { text = `Shared via ${method}`; } else { text = 'You didn\'t share'; diff --git a/releases/next/docs/images.html b/releases/next/docs/images.html index e044052a9fe..f69383f6599 100644 --- a/releases/next/docs/images.html +++ b/releases/next/docs/images.html @@ -1,4 +1,4 @@ -Images

Images #

Static Image Resources #

React Native provides a unified way of managing images in your iOS and Android apps. To add a static image to your app, place it somewhere in your source code tree and reference it like this:

<Image source={require('./my-icon.png')} />

The image name is resolved the same way JS modules are resolved. In the example above, the packager will look for my-icon.png in the same folder as the component that requires it. Also, if you have my-icon.ios.png and my-icon.android.png, the packager will pick the correct file for the platform.

You can also use the @2x and @3x suffixes to provide images for different screen densities. If you have the following file structure:

. +Images

Images #

Static Image Resources #

React Native provides a unified way of managing images and other media assets in your iOS and Android apps. To add a static image to your app, place it somewhere in your source code tree and reference it like this:

<Image source={require('./my-icon.png')} />

The image name is resolved the same way JS modules are resolved. In the example above, the packager will look for my-icon.png in the same folder as the component that requires it. Also, if you have my-icon.ios.png and my-icon.android.png, the packager will pick the correct file for the platform.

You can also use the @2x and @3x suffixes to provide images for different screen densities. If you have the following file structure:

. ├── button.js └── img ├── check@2x.png @@ -11,7 +11,7 @@ // GOOD var icon = this.props.active ? require('./my-icon-active.png') : require('./my-icon-inactive.png'); -<Image source={icon} />

Note that image sources required this way include size (width, height) info for the Image. If you need to scale the image dynamically (i.e. via flex), you may need to manually set { width: undefined, height: undefined } on the style attribute.

Images From Hybrid App's Resources #

If you are building a hybrid app (some UIs in React Native, some UIs in platform code) you can still use images that are already bundled into the app (via Xcode asset catalogs or Android drawable folder):

<Image source={{uri: 'app_icon'}} style={{width: 40, height: 40}} />

This approach provides no safety checks. It's up to you to guarantee that those images are available in the application. Also you have to specify image dimensions manually.

Network Images #

Many of the images you will display in your app will not be available at compile time, or you will want to load some dynamically to keep the binary size down. Unlike with static resources, you will need to manually specify the dimensions of your image. It's highly recommended that you use https as well in order to satisfy App Transport Security requirements on iOS.

// GOOD +<Image source={icon} />

Note that image sources required this way include size (width, height) info for the Image. If you need to scale the image dynamically (i.e. via flex), you may need to manually set { width: undefined, height: undefined } on the style attribute.

Static Non-Image Resources #

The require syntax described above can be used to statically include audio, video or document files in your project as well. Most common file types are supported including .mp3, .wav, .mp4, .mov, .html and .pdf (see the packager defaults file for the full list).

A caveat is that videos must use absolute positioning instead of flexGrow, since size info is not currently passed for non-image assets. This limitation doesn't occur for videos that are linked directly into Xcode or the Assets folder for Android.

Images From Hybrid App's Resources #

If you are building a hybrid app (some UIs in React Native, some UIs in platform code) you can still use images that are already bundled into the app (via Xcode asset catalogs or Android drawable folder):

<Image source={{uri: 'app_icon'}} style={{width: 40, height: 40}} />

This approach provides no safety checks. It's up to you to guarantee that those images are available in the application. Also you have to specify image dimensions manually.

Network Images #

Many of the images you will display in your app will not be available at compile time, or you will want to load some dynamically to keep the binary size down. Unlike with static resources, you will need to manually specify the dimensions of your image. It's highly recommended that you use https as well in order to satisfy App Transport Security requirements on iOS.

// GOOD <Image source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} style={{width: 400, height: 400}} />