Skip to content

Commit a2a31fb

Browse files
authored
Update ToastAndroid with changes in Android 11 (facebook#4213)
1 parent 0baeeee commit a2a31fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/toastandroid.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ You can alternatively use `showWithGravity(message, duration, gravity)` to speci
1212

1313
The `showWithGravityAndOffset(message, duration, gravity, xOffset, yOffset)` method adds the ability to specify an offset with in pixels.
1414

15+
> Starting with Android 11 (API level 30), setting the gravity has no effect on text toasts. Read about the changes [here](https://developer.android.com/about/versions/11/behavior-changes-11#text-toast-api-changes).
16+
1517
```SnackPlayer name=Toast%20Android%20API%20Example&supportedPlatforms=android
1618
import React from 'react';
1719
import {StyleSheet, ToastAndroid, Button, StatusBar} from 'react-native';
@@ -86,6 +88,8 @@ static show(message: string, duration: number);
8688

8789
### `showWithGravity()`
8890

91+
This property will only work on Android API 29 and below. For similar functionality on higher Android APIs, consider using snackbar or notification.
92+
8993
```tsx
9094
static showWithGravity(message: string, duration: number, gravity: number);
9195
```
@@ -94,6 +98,8 @@ static showWithGravity(message: string, duration: number, gravity: number);
9498

9599
### `showWithGravityAndOffset()`
96100

101+
This property will only work on Android API 29 and below. For similar functionality on higher Android APIs, consider using snackbar or notification.
102+
97103
```tsx
98104
static showWithGravityAndOffset(
99105
message: string,

0 commit comments

Comments
 (0)