diff --git a/css/react-native.css b/css/react-native.css index 4f7684bda37..e6b61be593a 100644 --- a/css/react-native.css +++ b/css/react-native.css @@ -1013,7 +1013,6 @@ h2 { text-rendering: optimizelegibility; } .docs-prevnext { - min-width: 320px; max-width: 640px; margin: 40px auto; padding-bottom: 20px; } @@ -1764,6 +1763,13 @@ input#algolia-doc-search:focus { margin: 2px; } +@supports (display:grid) { + .component-grid { + display: grid; + grid-gap: 22px; + } +} + @media only screen and (min-device-width: 768px) { .component-grid { width: 768px; @@ -1777,6 +1783,17 @@ input#algolia-doc-search:focus { margin: 0 22px 22px auto; vertical-align: top; } + + @supports (display:grid) { + .component-grid { + grid-template-columns: repeat(3, 1fr); + } + .component { + width: auto; + height: auto; + margin: 0; + } + } } /** Showcase **/ @@ -2030,6 +2047,15 @@ article li { .btn:hover { text-decoration: none !important; } +@media screen and (max-width: 373px) { + .hero .buttons-unit .button { + margin-bottom: 4px; } + + .docs-prevnext .btn { + margin-bottom: 4px; + display: block; + float: none; } } + .video-container { border-radius: 4px; background-clip: padding-box; diff --git a/docs/accessibility.html b/docs/accessibility.html index a7c9a897708..6a827bf1883 100644 --- a/docs/accessibility.html +++ b/docs/accessibility.html @@ -1,4 +1,4 @@ -Accessibility

Accessibility #

Native App Accessibility (iOS and Android) #

Both iOS and Android provide APIs for making apps accessible to people with disabilities. In addition, both platforms provide bundled assistive technologies, like the screen readers VoiceOver (iOS) and TalkBack (Android) for the visually impaired. Similarly, in React Native we have included APIs designed to provide developers with support for making apps more accessible. Take note, iOS and Android differ slightly in their approaches, and thus the React Native implementations may vary by platform.

In addition to this documentation, you might find this blog post about React Native accessibility to be useful.

Making Apps Accessible #

Accessibility properties #

accessible (iOS, Android) #

When true, indicates that the view is an accessibility element. When a view is an accessibility element, it groups its children into a single selectable component. By default, all touchable elements are accessible.

On Android, ‘accessible={true}’ property for a react-native View will be translated into native ‘focusable={true}’.

<View accessible={true}> +Accessibility - React Native

Accessibility #

Native App Accessibility (iOS and Android) #

Both iOS and Android provide APIs for making apps accessible to people with disabilities. In addition, both platforms provide bundled assistive technologies, like the screen readers VoiceOver (iOS) and TalkBack (Android) for the visually impaired. Similarly, in React Native we have included APIs designed to provide developers with support for making apps more accessible. Take note, iOS and Android differ slightly in their approaches, and thus the React Native implementations may vary by platform.

In addition to this documentation, you might find this blog post about React Native accessibility to be useful.

Making Apps Accessible #

Accessibility properties #

accessible (iOS, Android) #

When true, indicates that the view is an accessibility element. When a view is an accessibility element, it groups its children into a single selectable component. By default, all touchable elements are accessible.

On Android, ‘accessible={true}’ property for a react-native View will be translated into native ‘focusable={true}’.

<View accessible={true}> <Text>text one</Text> <Text>text two</Text> </View>

In the above example, we can't get accessibility focus separately on 'text one' and 'text two'. Instead we get focus on a parent view with 'accessible' property.

accessibilityLabel (iOS, Android) #

When a view is marked as accessible, it is a good practice to set an accessibilityLabel on the view, so that people who use VoiceOver know what element they have selected. VoiceOver will read this string when a user selects the associated element.

To use, set the accessibilityLabel property to a custom string on your View:

<TouchableOpacity accessible={true} accessibilityLabel={'Tap me!'} onPress={this._onPress}> @@ -39,7 +39,7 @@ On the other hand, if view B contains a child view C a <CustomRadioButton accessibleComponentType={this.state.radioButton} - onPress={this._onPress}/>

In the above example we've created a custom radio button that now behaves like a native one. More specifically, TalkBack now correctly announces changes to the radio button selection.

Testing VoiceOver Support (iOS) #

To enable VoiceOver, go to the Settings app on your iOS device. Tap General, then Accessibility. There you will find many tools that people use to make their devices more usable, such as bolder text, increased contrast, and VoiceOver.

To enable VoiceOver, tap on VoiceOver under "Vision" and toggle the switch that appears at the top.

At the very bottom of the Accessibility settings, there is an "Accessibility Shortcut". You can use this to toggle VoiceOver by triple clicking the Home button.

Improve this page by sending a pull request!

\ No newline at end of file diff --git a/docs/accessibilityinfo.html b/docs/accessibilityinfo.html index 7516b8133de..5af6ea3a057 100644 --- a/docs/accessibilityinfo.html +++ b/docs/accessibilityinfo.html @@ -1,4 +1,4 @@ -AccessibilityInfo

AccessibilityInfo #

Sometimes it's useful to know whether or not the device has a screen reader that is currently active. The +AccessibilityInfo - React Native

AccessibilityInfo #

Sometimes it's useful to know whether or not the device has a screen reader that is currently active. The AccessibilityInfo API is designed for this purpose. You can use it to query the current state of the screen reader as well as to register to be notified when the state of the screen reader changes.

Here's a small example illustrating how to use AccessibilityInfo:

class ScreenReaderStatusExample extends React.Component { state = { @@ -61,6 +61,6 @@ with these keys:
  • announcement: The string announced by the s apiKey: '2c98749b4a1e588efec53b2acec13025', indexName: 'react-native-versions', inputSelector: '#algolia-doc-search', - algoliaOptions: { facetFilters: [ "tags:0.48" ], hitsPerPage: 5 } + algoliaOptions: { facetFilters: [ "tags:0.49" ], hitsPerPage: 5 } }); \ No newline at end of file diff --git a/docs/actionsheetios.html b/docs/actionsheetios.html index 205fb9ce79c..0ed5c1c42b2 100644 --- a/docs/actionsheetios.html +++ b/docs/actionsheetios.html @@ -1,4 +1,4 @@ -ActionSheetIOS

    ActionSheetIOS #

    Methods #

    static showActionSheetWithOptions(options, callback) #

    Display an iOS action sheet. The options object must contain one or more +ActionSheetIOS - React Native

    ActionSheetIOS #

    Methods #

    static showActionSheetWithOptions(options, callback) #

    Display an iOS action sheet. The options object must contain one or more of:

    • options (array of strings) - a list of button titles (required)
    • cancelButtonIndex (int) - index of cancel button in options
    • destructiveButtonIndex (int) - index of destructive button in options
    • title (string) - a title to show above the action sheet
    • message (string) - a message to show below the title

    static showShareActionSheetWithOptions(options, failureCallback, successCallback) #

    Display the iOS share sheet. The options object should contain one or both of message and url and can additionally have a subject or excludedActivityTypes:

    • url (string) - a URL to share
    • message (string) - a message to share
    • subject (string) - a subject for the message
    • excludedActivityTypes (array) - the activities to exclude from the ActionSheet

    NOTE: if url points to a local file, or is a base64-encoded @@ -19,6 +19,6 @@ In this way, you can share images, videos, PDF files, etc.

    apiKey: '2c98749b4a1e588efec53b2acec13025', indexName: 'react-native-versions', inputSelector: '#algolia-doc-search', - algoliaOptions: { facetFilters: [ "tags:0.48" ], hitsPerPage: 5 } + algoliaOptions: { facetFilters: [ "tags:0.49" ], hitsPerPage: 5 } }); \ No newline at end of file diff --git a/docs/activityindicator.html b/docs/activityindicator.html index 85e2d51c6cb..bcc1523f019 100644 --- a/docs/activityindicator.html +++ b/docs/activityindicator.html @@ -1,4 +1,4 @@ -ActivityIndicator

    ActivityIndicator #

    Displays a circular loading indicator.

    Props #

    animating?: bool #

    Whether to show the indicator (true, the default) or hide it (false).

    color?: color #

    The foreground color of the spinner (default is gray).

    size?: enum('small', 'large'), number #

    Size of the indicator (default is 'small'). +ActivityIndicator - React Native

    ActivityIndicator #

    Displays a circular loading indicator.

    Props #

    animating?: bool #

    Whether to show the indicator (true, the default) or hide it (false).

    color?: color #

    The foreground color of the spinner (default is gray).

    size?: enum('small', 'large'), number #

    Size of the indicator (default is 'small'). Passing a number to the size prop is only supported on Android.

    ioshidesWhenStopped?: bool #

    Whether the indicator should hide when not animating (true by default).

    Improve this page by sending a pull request!

    \ No newline at end of file diff --git a/docs/alert.html b/docs/alert.html index d6a0b3c0bcb..0a9165ccf5b 100644 --- a/docs/alert.html +++ b/docs/alert.html @@ -1,4 +1,4 @@ -Alert

    Alert #

    Launches an alert dialog with the specified title and message.

    Optionally provide a list of buttons. Tapping any button will fire the +Alert - React Native

    Alert #

    Launches an alert dialog with the specified title and message.

    Optionally provide a list of buttons. Tapping any button will fire the respective onPress callback and dismiss the alert. By default, the only button will be an 'OK' button.

    This is an API that works both on iOS and Android and can show static alerts. To show an alert that prompts the user to enter some information, @@ -34,6 +34,6 @@ i.e. { cancelable: false }

    Example usage:

    \ No newline at end of file diff --git a/docs/alertios.html b/docs/alertios.html index c47399be798..dd60d55ee56 100644 --- a/docs/alertios.html +++ b/docs/alertios.html @@ -1,4 +1,4 @@ -AlertIOS

    AlertIOS #

    AlertIOS provides functionality to create an iOS alert dialog with a +AlertIOS - React Native

    AlertIOS #

    AlertIOS provides functionality to create an iOS alert dialog with a message or create a prompt for user input.

    Creating an iOS alert:

    AlertIOS.alert( 'Sync Complete', 'All your data are belong to us.' @@ -7,7 +7,7 @@ message or create a prompt for user input.

    Creating an iOS alert:

    null, text => console.log("You entered "+text) );

    We recommend using the Alert.alert method for -cross-platform support if you don't need to create iOS-only prompts.

    Methods #

    static alert(title: string, message?: string, callbackOrButtons?: ?(() => void), ButtonsArray, type?: AlertType) #

    Create and display a popup alert.

    Parameters:
    Name and TypeDescription
    title

    string

    The dialog's title.

    [message]

    string

    An optional message that appears below +cross-platform support if you don't need to create iOS-only prompts.

    Methods #

    static alert(title: string, message?: string, callbackOrButtons?: ?(() => void), ButtonsArray, type?: AlertType) #

    Create and display a popup alert.

    Parameters:
    Name and TypeDescription
    title

    string

    The dialog's title.

    An empty string hides the title.

    [message]

    string

    An optional message that appears below the dialog's title.

    [callbackOrButtons]

    ?(() => void) | ButtonsArray

    This optional argument should be either a single-argument function or an array of buttons. If passed a function, it will be called when the user taps 'OK'.

    If passed an array of button configurations, each button should include @@ -59,6 +59,6 @@ cross-platform support if you don't need to create iOS-only prompts.

    \ No newline at end of file diff --git a/docs/android-building-from-source.html b/docs/android-building-from-source.html index c0d54a06e53..58009256878 100644 --- a/docs/android-building-from-source.html +++ b/docs/android-building-from-source.html @@ -1,6 +1,6 @@ -Building React Native from source

    Building React Native from source #

    You will need to build React Native from source if you want to work on a new feature/bug fix, try out the latest features which are not released yet, or maintain your own fork with patches that cannot be merged to the core.

    Prerequisites #

    Assuming you have the Android SDK installed, run android to open the Android SDK Manager.

    Make sure you have the following installed:

    1. Android SDK version 23 (compileSdkVersion in build.gradle)
    2. SDK build tools version 23.0.1 (buildToolsVersion in build.gradle)
    3. Android Support Repository >= 17 (for Android Support Library)
    4. Android NDK (download links and installation instructions below)

    Point Gradle to your Android SDK: #

    Step 1: Set environment variables through your local shell.

    Note: Files may vary based on shell flavor. See below for examples from common shells.

    • bash: .bash_profile or .bashrc
    • zsh: .zprofile or .zshrc
    • ksh: .profile or $ENV

    Example:

    export ANDROID_SDK=/Users/your_unix_name/android-sdk-macosx +Building React Native from source - React Native

    Building React Native from source #

    You will need to build React Native from source if you want to work on a new feature/bug fix, try out the latest features which are not released yet, or maintain your own fork with patches that cannot be merged to the core.

    Prerequisites #

    Assuming you have the Android SDK installed, run android to open the Android SDK Manager.

    Make sure you have the following installed:

    1. Android SDK version 23 (compileSdkVersion in build.gradle)
    2. SDK build tools version 23.0.1 (buildToolsVersion in build.gradle)
    3. Android Support Repository >= 17 (for Android Support Library)
    4. Android NDK (download links and installation instructions below)

    Point Gradle to your Android SDK: #

    Step 1: Set environment variables through your local shell.

    Note: Files may vary based on shell flavor. See below for examples from common shells.

    • bash: .bash_profile or .bashrc
    • zsh: .zprofile or .zshrc
    • ksh: .profile or $ENV

    Example:

    export ANDROID_SDK=/Users/your_unix_name/android-sdk-macosx export ANDROID_NDK=/Users/your_unix_name/android-ndk/android-ndk-r10e

    Step 2: Create a local.properties file in the android directory of your react-native app with the following contents:

    Example:

    sdk.dir=/Users/your_unix_name/android-sdk-macosx -ndk.dir=/Users/your_unix_name/android-ndk/android-ndk-r10e

    Download links for Android NDK #

    1. Mac OS (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip
    2. Linux (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
    3. Windows (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip
    4. Windows (32-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86.zip

    You can find further instructions on the official page.

    Building the source #

    1. Installing the fork #

    First, you need to install react-native from your fork. For example, to install the master branch from the official repo, run the following:

    npm install --save github:facebook/react-native#master

    Alternatively, you can clone the repo to your node_modules directory and run npm install inside the cloned repo.

    2. Adding gradle dependencies #

    Add gradle-download-task as dependency in android/build.gradle:

    ... +ndk.dir=/Users/your_unix_name/android-ndk/android-ndk-r10e

    Download links for Android NDK #

    1. Mac OS (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-darwin-x86_64.zip
    2. Linux (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
    3. Windows (64-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86_64.zip
    4. Windows (32-bit) - http://dl.google.com/android/repository/android-ndk-r10e-windows-x86.zip

    You can find further instructions on the official page.

    Building the source #

    1. Installing the fork #

    First, you need to install react-native from your fork. For example, to install the master branch from the official repo, run the following:

    npm install --save github:facebook/react-native#master

    Alternatively, you can clone the repo to your node_modules directory and run npm install inside the cloned repo.

    2. Adding gradle dependencies #

    Add gradle-download-task as dependency in android/build.gradle:

    ... dependencies { classpath 'com.android.tools.build:gradle:1.3.1' classpath 'de.undercouch:gradle-download-task:3.1.2' @@ -44,6 +44,6 @@ dependencies { apiKey: '2c98749b4a1e588efec53b2acec13025', indexName: 'react-native-versions', inputSelector: '#algolia-doc-search', - algoliaOptions: { facetFilters: [ "tags:0.48" ], hitsPerPage: 5 } + algoliaOptions: { facetFilters: [ "tags:0.49" ], hitsPerPage: 5 } }); \ No newline at end of file diff --git a/docs/animated.html b/docs/animated.html index d9824063c80..ae86f60e613 100644 --- a/docs/animated.html +++ b/docs/animated.html @@ -1,7 +1,7 @@ -Animated

    Animated #

    The Animated library is designed to make animations fluid, powerful, and +Animated - React Native

    Animated #

    The Animated library is designed to make animations fluid, powerful, and easy to build and maintain. Animated focuses on declarative relationships between inputs and outputs, with configurable transforms in between, and -simple start/stop methods to control time-based animation execution.

    The simplest workflow for creating an animation is to to create an +simple start/stop methods to control time-based animation execution.

    The simplest workflow for creating an animation is to create an Animated.Value, hook it up to one or more style attributes of an animated component, and then drive updates via animations using Animated.timing():

    Animated.timing( // Animate value over time this.state.fadeAnim, // The value to drive @@ -95,57 +95,10 @@ then calls setValue on the mapped outputs. e.g.

    : Animated.event([ null, // raw event arg ignored {dx: this._panX}, // gestureState arg - ]),

    Config is an object that may have the following options:

    • listener: Optional async listener.
    • useNativeDriver: Uses the native driver when true. Default false.

    static createAnimatedComponent(Component) #

    Make any React component Animatable. Used to create Animated.View, etc.

    static attachNativeEvent(viewRef, eventName, argMapping) #

    Imperative API to attach an animated value to an event on a view. Prefer using -Animated.event with useNativeDrive: true if possible.

    static forkEvent(event, listener) #

    Advanced imperative API for snooping on animated events that are passed in through props. Use -values directly where possible.

    static unforkEvent(event, listener) #

    Properties #

    Value: AnimatedValue #

    Standard value class for driving animations. Typically initialized with -new Animated.Value(0);

    See also AnimatedValue.

    ValueXY: AnimatedValueXY #

    2D value class for driving 2D animations, such as pan gestures.

    See also AnimatedValueXY.

    Interpolation: AnimatedInterpolation #

    exported to use the Interpolation type in flow

    See also AnimatedInterpolation.

    class AnimatedValue #

    Standard value for driving animations. One Animated.Value can drive -multiple properties in a synchronized fashion, but can only be driven by one -mechanism at a time. Using a new mechanism (e.g. starting a new animation, -or calling setValue) will stop any previous ones.

    Methods #

    constructor(value) #

    setValue(value) #

    Directly set the value. This will stop any animations running on the value -and update all the bound properties.

    setOffset(offset) #

    Sets an offset that is applied on top of whatever value is set, whether via -setValue, an animation, or Animated.event. Useful for compensating -things like the start of a pan gesture.

    flattenOffset() #

    Merges the offset value into the base value and resets the offset to zero. -The final output of the value is unchanged.

    extractOffset() #

    Sets the offset value to the base value, and resets the base value to zero. -The final output of the value is unchanged.

    addListener(callback) #

    Adds an asynchronous listener to the value so you can observe updates from -animations. This is useful because there is no way to -synchronously read the value because it might be driven natively.

    removeListener(id) #

    removeAllListeners() #

    stopAnimation(callback?) #

    Stops any running animation or tracking. callback is invoked with the -final value after stopping the animation, which is useful for updating -state to match the animation position with layout.

    resetAnimation(callback?) #

    Stops any animation and resets the value to its original

    interpolate(config) #

    Interpolates the value before updating the property, e.g. mapping 0-1 to -0-10.

    animate(animation, callback) #

    Typically only used internally, but could be used by a custom Animation -class.

    stopTracking() #

    Typically only used internally.

    track(tracking) #

    Typically only used internally.

    class AnimatedValueXY #

    2D Value for driving 2D animations, such as pan gestures. Almost identical -API to normal Animated.Value, but multiplexed. Contains two regular -Animated.Values under the hood.

    Example #

    class DraggableView extends React.Component { - constructor(props) { - super(props); - this.state = { - pan: new Animated.ValueXY(), // inits to zero - }; - this.state.panResponder = PanResponder.create({ - onStartShouldSetPanResponder: () => true, - onPanResponderMove: Animated.event([null, { - dx: this.state.pan.x, // x,y are Animated.Value - dy: this.state.pan.y, - }]), - onPanResponderRelease: () => { - Animated.spring( - this.state.pan, // Auto-multiplexed - {toValue: {x: 0, y: 0}} // Back to zero - ).start(); - }, - }); - } - render() { - return ( - <Animated.View - {...this.state.panResponder.panHandlers} - style={this.state.pan.getLayout()}> - {this.props.children} - </Animated.View> - ); - } - }

    Methods #

    constructor(valueIn?) #

    setValue(value) #

    setOffset(offset) #

    flattenOffset() #

    extractOffset() #

    resetAnimation(callback?) #

    stopAnimation(callback?) #

    addListener(callback) #

    removeListener(id) #

    removeAllListeners() #

    getLayout() #

    Converts {x, y} into {left, top} for use in style, e.g.

    style={this.state.anim.getLayout()}

    getTranslateTransform() #

    Converts {x, y} into a useable translation transform, e.g.

    style={{ - transform: this.state.anim.getTranslateTransform() - }}

    class AnimatedInterpolation #

    Methods #

    constructor(parent, config) #

    interpolate(config) #

    Improve this page by sending a pull request!

    \ No newline at end of file diff --git a/docs/animations.html b/docs/animations.html index a0f412dba61..8b820eb9246 100644 --- a/docs/animations.html +++ b/docs/animations.html @@ -1,4 +1,4 @@ -Animations

    Animations #

    Animations are very important to create a great user experience. +Animations - React Native

    Animations #

    Animations are very important to create a great user experience. Stationary objects must overcome inertia as they start moving. Objects in motion have momentum and rarely come to a stop immediately. Animations allow you to convey physically believable motion in your interface.

    React Native provides two complementary animation systems: @@ -192,7 +192,16 @@ You can also take a look at the Additional examples #

    The RNTester app has various examples of Animated in use:

    LayoutAnimation API #

    LayoutAnimation allows you to globally configure create and update +This means it does not work with PanResponder but does work with things like ScrollView#onScroll.

    Bear in mind #

    While using transform styles such as rotateY, rotateX, and others ensure the transform style perspective is in place. +At this time some animations may not render on Android without it. Example below.

    <Animated.View + style={{ + transform: [ + { scale: this.state.scale }, + { rotateY: this.state.rotateY }, + { perspective: 1000 } // without this line this Animation will not render on Android while working fine on iOS + ] + }} +/>

    Additional examples #

    The RNTester app has various examples of Animated in use:

    LayoutAnimation API #

    LayoutAnimation allows you to globally configure create and update animations that will be used for all views in the next render/layout cycle. This is useful for doing flexbox layout updates without bothering to measure or calculate specific properties in order to animate them directly, and is @@ -301,6 +310,6 @@ frame rate by using the In-App Developer Menu "FPS Monitor" tool.

    < apiKey: '2c98749b4a1e588efec53b2acec13025', indexName: 'react-native-versions', inputSelector: '#algolia-doc-search', - algoliaOptions: { facetFilters: [ "tags:0.48" ], hitsPerPage: 5 } + algoliaOptions: { facetFilters: [ "tags:0.49" ], hitsPerPage: 5 } }); \ No newline at end of file diff --git a/docs/app-extensions.html b/docs/app-extensions.html index 29c45bb6e0f..4b4096dcf4f 100644 --- a/docs/app-extensions.html +++ b/docs/app-extensions.html @@ -1,4 +1,4 @@ -App Extensions

    App Extensions #

    App extensions let you provide custom functionality and content outside of your main app. There are different types of app extensions on iOS, and they are all covered in the App Extension Programming Guide. In this guide, we'll briefly cover how you may take advantage of app extensions on iOS.

    Memory use in extensions #

    As these extensions are loaded outside of the regular app sandbox, it's highly likely that several of these app extensions will be loaded simultaneously. As you might expect, these extensions have small memory usage limits. Keep these in mind when developing your app extensions. It's always highly recommended to test your application on an actual device, and more so when developing app extensions: too frequently, developers find that their extension works just fine in the iOS Simulator, only to get user reports that their extension is not loading on actual devices.

    We highly recommend that you watch Conrad Kramer's talk on Memory Use in Extensions to learn more about this topic.

    Today widget #

    The memory limit of a Today widget is 16 MB. As it happens, Today widget implementations using React Native may work unreliably because the memory usage tends to be too high. You can tell if your Today widget is exceeding the memory limit if it yields the message 'Unable to Load':

    Always make sure to test your app extensions in a real device, but be aware that this may not be sufficient, especially when dealing with Today widgets. Debug-configured builds are more likely to exceed the memory limits, while release-configured builds don't fail right away. We highly recommend that you use Xcode's Instruments to analyze your real world memory usage, as it's very likely that your release-configured build is very close to the 16 MB limit. In situations like these, it is easy to go over the 16 MB limit by performing common operations, such as fetching data from an API.

    To experiment with the limits of React Native Today widget implementations, try extending the example project in react-native-today-widget.

    Other app extensions #

    Other types of app extensions have greater memory limits than the Today widget. For instance, Custom Keyboard extensions are limited to 48 MB, and Share extensions are limited to 120 MB. Implementing such app extensions with React Native is more viable. One proof of concept example is react-native-ios-share-extension.

    Improve this page by sending a pull request!

    App Extensions #

    App extensions let you provide custom functionality and content outside of your main app. There are different types of app extensions on iOS, and they are all covered in the App Extension Programming Guide. In this guide, we'll briefly cover how you may take advantage of app extensions on iOS.

    Memory use in extensions #

    As these extensions are loaded outside of the regular app sandbox, it's highly likely that several of these app extensions will be loaded simultaneously. As you might expect, these extensions have small memory usage limits. Keep these in mind when developing your app extensions. It's always highly recommended to test your application on an actual device, and more so when developing app extensions: too frequently, developers find that their extension works just fine in the iOS Simulator, only to get user reports that their extension is not loading on actual devices.

    We highly recommend that you watch Conrad Kramer's talk on Memory Use in Extensions to learn more about this topic.

    Today widget #

    The memory limit of a Today widget is 16 MB. As it happens, Today widget implementations using React Native may work unreliably because the memory usage tends to be too high. You can tell if your Today widget is exceeding the memory limit if it yields the message 'Unable to Load':

    Always make sure to test your app extensions in a real device, but be aware that this may not be sufficient, especially when dealing with Today widgets. Debug-configured builds are more likely to exceed the memory limits, while release-configured builds don't fail right away. We highly recommend that you use Xcode's Instruments to analyze your real world memory usage, as it's very likely that your release-configured build is very close to the 16 MB limit. In situations like these, it is easy to go over the 16 MB limit by performing common operations, such as fetching data from an API.

    To experiment with the limits of React Native Today widget implementations, try extending the example project in react-native-today-widget.

    Other app extensions #

    Other types of app extensions have greater memory limits than the Today widget. For instance, Custom Keyboard extensions are limited to 48 MB, and Share extensions are limited to 120 MB. Implementing such app extensions with React Native is more viable. One proof of concept example is react-native-ios-share-extension.

    Improve this page by sending a pull request!

    \ No newline at end of file diff --git a/docs/appregistry.html b/docs/appregistry.html index a419e18cdb5..69d02355d3b 100644 --- a/docs/appregistry.html +++ b/docs/appregistry.html @@ -1,4 +1,4 @@ -AppRegistry

    AppRegistry #