diff --git a/docs/button.md b/docs/button.md index cfed6819d28..9fc529fc863 100644 --- a/docs/button.md +++ b/docs/button.md @@ -18,13 +18,21 @@ If this button doesn't look right for your app, you can build your own button us ## Example -```SnackPlayer name=Button%20Example +```SnackPlayer name=Button%20Example&ext=js import React from 'react'; -import {StyleSheet, Button, View, Text, Alert} from 'react-native'; +import {StyleSheet, Button, View, Text, Alert, Platform} from 'react-native'; import {SafeAreaView, SafeAreaProvider} from 'react-native-safe-area-context'; const Separator = () => ; +function showAlert(message) { + if (Platform.OS === 'web') { + window.alert(message); + } else { + Alert.alert(message); + } +} + const App = () => ( @@ -35,7 +43,7 @@ const App = () => (