From 38f373dcd29c2ca6fa386d4b5566e6d018c3e136 Mon Sep 17 00:00:00 2001 From: Pablo Espinosa Date: Sat, 8 Feb 2020 23:07:57 +0000 Subject: [PATCH 1/4] Ported the examples into Snack, using hooks in the advanced usage --- docs/toastandroid.md | 132 ++++++++++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 53 deletions(-) diff --git a/docs/toastandroid.md b/docs/toastandroid.md index 0db8e967855..8a93f7c0e67 100644 --- a/docs/toastandroid.md +++ b/docs/toastandroid.md @@ -14,37 +14,69 @@ The 'showWithGravityAndOffset' function adds on the ability to specify offset Th Basic usage: -```jsx -import {ToastAndroid} from 'react-native'; - -ToastAndroid.show('A pikachu appeared nearby !', ToastAndroid.SHORT); -ToastAndroid.showWithGravity( - 'All Your Base Are Belong To Us', - ToastAndroid.SHORT, - ToastAndroid.CENTER, -); -ToastAndroid.showWithGravityAndOffset( - 'A wild toast appeared!', - ToastAndroid.LONG, - ToastAndroid.BOTTOM, - 25, - 50, -); +```SnackPlayer name=basic-android-toast +import React from 'react'; +import { View, StyleSheet, ToastAndroid, Button } from 'react-native'; +import Constants from 'expo-constants'; +const App = () => { + + const showToast = () => { + ToastAndroid.show('A pikachu appeared nearby !', ToastAndroid.SHORT); + } + + const showToastWithGravity = () => { + ToastAndroid.showWithGravity( + 'All Your Base Are Belong To Us', + ToastAndroid.SHORT, + ToastAndroid.CENTER, + ); + } + + const showToastWithGravityAndOffset = () => { + ToastAndroid.showWithGravityAndOffset( + 'A wild toast appeared!', + ToastAndroid.LONG, + ToastAndroid.BOTTOM, + 25, + 50, + ); + } + + return ( + +