Skip to content

Instantly share code, notes, and snippets.

@tobob
Created December 18, 2019 10:58
Show Gist options
  • Save tobob/8ed221c2f501074b581c217b5128165d to your computer and use it in GitHub Desktop.
Save tobob/8ed221c2f501074b581c217b5128165d to your computer and use it in GitHub Desktop.
import React, {useContext} from 'react';
import {View, Text, TouchableOpacity, StyleSheet} from 'react-native';
import {ToastContext} from './ToastContext';
const HomeScreen = () => {
const {show} = useContext(ToastContext);
return (
<View style={styles.container}>
<TouchableOpacity onPress={() => show({message: 'Ama simple Toast!'})}>
<Text>Show Toast</Text>
</TouchableOpacity>
</View>
);
};
export default HomeScreen;
const styles = StyleSheet.create({
container: {flex: 1, alignItems: 'center', justifyContent: 'center'},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment