Skip to content

Commit

Permalink
Republish 0.60 (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
charpeni authored Sep 2, 2019
1 parent 7fe538d commit da99368
Show file tree
Hide file tree
Showing 56 changed files with 2,946 additions and 569 deletions.
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.60/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ original_id: accessibility

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](https://code.facebook.com/posts/435862739941212/making-react-native-apps-accessible/) about React Native accessibility to be useful.
In addition to this documentation, you might find [this blog post](https://engineering.fb.com/ios/making-react-native-apps-accessible/) about React Native accessibility to be useful.

## Making Apps Accessible

Expand Down
6 changes: 3 additions & 3 deletions website/versioned_docs/version-0.60/activityindicator.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ Whether the indicator should hide when not animating (true by default).

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

| Type | Required |
| ------------------------------- | -------- |
| enum('small', 'large'), ,number | No |
| Type | Required |
| ------------------------------ | -------- |
| enum('small', 'large'), number | No |
198 changes: 198 additions & 0 deletions website/versioned_docs/version-0.60/alertios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
---
id: version-0.60-alertios
title: AlertIOS
original_id: alertios
---

> **Deprecated.** `AlertIOS` has been moved to [`Alert`](alert.md)
`AlertIOS` provides functionality to create an iOS alert dialog with a message or create a prompt for user input.

Creating an iOS alert:

```jsx
AlertIOS.alert('Sync Complete', 'All your data are belong to us.');
```

Creating an iOS prompt:

```jsx
AlertIOS.prompt('Enter a value', null, (text) =>
console.log('You entered ' + text),
);
```

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

### Methods

- [`alert`](alertios.md#alert)
- [`prompt`](alertios.md#prompt)

### Type Definitions

- [`AlertType`](alertios.md#alerttype)
- [`AlertButtonStyle`](alertios.md#alertbuttonstyle)
- [`ButtonsArray`](alertios.md#buttonsarray)

---

# Reference

## Methods

### `alert()`

```jsx
static alert(title: string, [message]: string, [callbackOrButtons]: ?(() => void), ButtonsArray, [type]: AlertType): [object Object]
```

Create and display a popup alert.

**Parameters:**

| Name | Type | Required | Description |
| ----------------- | ------------------------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| title | string | Yes | The dialog's title. Passing null or '' will hide the title. |
| message | string | No | An optional message that appears below the dialog's title. |
| callbackOrButtons | ?(() => void),[ButtonsArray](alertios.md#buttonsarray) | No | 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 a `text` key, as well as optional `onPress` and `style` keys. `style` should be one of 'default', 'cancel' or 'destructive'. |
| type | [AlertType](alertios.md#alerttype) | No | Deprecated, do not use. |

Example with custom buttons:

```jsx
AlertIOS.alert(
'Update available',
'Keep your app up to date to enjoy the latest features',
[
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'Install',
onPress: () => console.log('Install Pressed'),
},
],
);
```

---

### `prompt()`

```jsx
static prompt(title: string, [message]: string, [callbackOrButtons]: ?((text: string) => void), ButtonsArray, [type]: AlertType, [defaultValue]: string, [keyboardType]: string): [object Object]
```

Create and display a prompt to enter some text.

**Parameters:**

| Name | Type | Required | Description |
| ----------------- | ------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| title | string | Yes | The dialog's title. |
| message | string | No | An optional message that appears above the text input. |
| callbackOrButtons | ?((text: string) => void),[ButtonsArray](alertios.md#buttonsarray) | No | This optional argument should be either a single-argument function or an array of buttons. If passed a function, it will be called with the prompt's value when the user taps 'OK'. If passed an array of button configurations, each button should include a `text` key, as well as optional `onPress` and `style` keys (see example). `style` should be one of 'default', 'cancel' or 'destructive'. |
| type | [AlertType](alertios.md#alerttype) | No | This configures the text input. One of 'plain-text', 'secure-text' or 'login-password'. |
| defaultValue | string | No | The default text in text input. |
| keyboardType | string | No | The keyboard type of first text field(if exists). One of 'default', 'email-address', 'numeric', 'phone-pad', 'ascii-capable', 'numbers-and-punctuation', 'url', 'number-pad', 'name-phone-pad', 'decimal-pad', 'twitter' or 'web-search'. |

Example with custom buttons:

```jsx
AlertIOS.prompt(
'Enter password',
'Enter your password to claim your $1.5B in lottery winnings',
[
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'OK',
onPress: (password) => console.log('OK Pressed, password: ' + password),
},
],
'secure-text',
);
```

,

Example with the default button and a custom callback:

```jsx
AlertIOS.prompt(
'Update username',
null,
(text) => console.log('Your username is ' + text),
null,
'default',
);
```

## Type Definitions

### AlertType

An Alert button type

| Type |
| ------ |
| \$Enum |

**Constants:**

| Value | Description |
| -------------- | ---------------------------- |
| default | Default alert with no inputs |
| plain-text | Plain text input alert |
| secure-text | Secure text input alert |
| login-password | Login and password alert |

---

### AlertButtonStyle

An Alert button style

| Type |
| ------ |
| \$Enum |

**Constants:**

| Value | Description |
| ----------- | ------------------------ |
| default | Default button style |
| cancel | Cancel button style |
| destructive | Destructive button style |

---

### ButtonsArray

Array or buttons

| Type |
| ----- |
| Array |

**Properties:**

| Name | Type | Description |
| --------- | ------------------------------------------------ | ------------------------------------- |
| [text] | string | Button label |
| [onPress] | function | Callback function when button pressed |
| [style] | [AlertButtonStyle](alertios.md#alertbuttonstyle) | Button style |

**Constants:**

| Value | Description |
| ------- | ------------------------------------- |
| text | Button label |
| onPress | Callback function when button pressed |
| style | Button style |
66 changes: 29 additions & 37 deletions website/versioned_docs/version-0.60/animations.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,43 @@ The [`Animated`](animated.md) API is designed to make it very easy to concisely
For example, a container view that fades in when it is mounted may look like this:

```SnackPlayer
import React from 'react';
import React, { useState, useEffect } from 'react';
import { Animated, Text, View } from 'react-native';
class FadeInView extends React.Component {
state = {
fadeAnim: new Animated.Value(0), // Initial value for opacity: 0
}
const FadeInView = (props) => {
const [fadeAdmin] = useState(new Animated.Value(0)) // Initial value for opacity: 0
componentDidMount() {
Animated.timing( // Animate over time
this.state.fadeAnim, // The animated value to drive
React.useEffect(() => {
Animated.timing(
fadeAdmin,
{
toValue: 1, // Animate to opacity: 1 (opaque)
duration: 10000, // Make it take a while
toValue: 1,
duration: 10000,
}
).start(); // Starts the animation
}
render() {
let { fadeAnim } = this.state;
return (
<Animated.View // Special animatable View
style={{
...this.props.style,
opacity: fadeAnim, // Bind opacity to animated value
}}
>
{this.props.children}
</Animated.View>
);
}
).start();
}, [])
return (
<Animated.View // Special animatable View
style={{
...props.style,
opacity: fadeAdnim, // Bind opacity to animated value
}}
>
{props.children}
</Animated.View>
);
}
// You can then use your `FadeInView` in place of a `View` in your components:
export default class App extends React.Component {
render() {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<FadeInView style={{width: 250, height: 50, backgroundColor: 'powderblue'}}>
<Text style={{fontSize: 28, textAlign: 'center', margin: 10}}>Fading in</Text>
</FadeInView>
</View>
)
}
export default () => {
return (
<View style={{flex: 1, alignItems: 'center', justifyContent: 'center'}}>
<FadeInView style={{width: 250, height: 50, backgroundColor: 'powderblue'}}>
<Text style={{fontSize: 28, textAlign: 'center', margin: 10}}>Fading in</Text>
</FadeInView>
</View>
)
}
```

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.60/backhandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tvOS: Detect presses of the menu button on the TV remote. (Still to be implement

iOS: Not applicable.

The event subscriptions are called in reverse order (i.e. last registered subscription first), and if one subscription returns true then subscriptions registered earlier will not be called.
The event subscriptions are called in reverse order (i.e. last registered subscription first), and if one subscription returns true then subscriptions registered earlier will not be called. Beware: If your app shows an opened `Modal`, BackHandler will not publish any events ([see `Modal` docs](https://facebook.github.io/react-native/docs/modal#onrequestclose)).

Example:

Expand Down
10 changes: 5 additions & 5 deletions website/versioned_docs/version-0.60/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import { Button } from 'react-native';
- [`color`](button.md#color)
- [`disabled`](button.md#disabled)
- [`hasTVPreferredFocus`](button.md#hastvpreferredfocus)
- [`nextFocusDown`](view.md#nextfocusdown)
- [`nextFocusForward`](view.md#nextfocusForward)
- [`nextFocusLeft`](view.md#nextfocusleft)
- [`nextFocusRight`](view.md#nextfocusright)
- [`nextFocusUp`](view.md#nextfocusleft)
- [`nextFocusDown`](button.md#nextfocusdown)
- [`nextFocusForward`](button.md#nextfocusForward)
- [`nextFocusLeft`](button.md#nextfocusleft)
- [`nextFocusRight`](button.md#nextfocusright)
- [`nextFocusUp`](button.md#nextfocusleft)
- [`onPress`](button.md#onpress)
- [`testID`](button.md#testid)
- [`title`](button.md#title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class MainActivity extends ReactActivity {
import React from 'react';
import {View, Image} from 'react-native';

class ImageBrowserApp extends React.Component {
export default class ImageBrowserApp extends React.Component {
renderImage(imgURI) {
return <Image source={{uri: imgURI}} />;
}
Expand Down
Loading

0 comments on commit da99368

Please sign in to comment.