Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ToastAndroid with changes in Android 11 #4213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/toastandroid.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ You can alternatively use `showWithGravity(message, duration, gravity)` to speci

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

> 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).

```SnackPlayer name=Toast%20Android%20API%20Example&supportedPlatforms=android
import React from 'react';
import {View, StyleSheet, ToastAndroid, Button, StatusBar} from 'react-native';
Expand Down Expand Up @@ -83,6 +85,8 @@ static show(message: string, duration: number);

### `showWithGravity()`

This property will only work on Android API 29 and below. For similar functionality on higher Android APIs, consider using snackbar of notification.

```tsx
static showWithGravity(message: string, duration: number, gravity: number);
```
Expand All @@ -91,6 +95,8 @@ static showWithGravity(message: string, duration: number, gravity: number);

### `showWithGravityAndOffset()`

This property will only work on Android API 29 and below. For similar functionality on higher Android APIs, consider using snackbar or notification.

```tsx
static showWithGravityAndOffset(
message: string,
Expand Down