native-base#Toast JavaScript Examples

The following examples show how to use native-base#Toast. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From aws-appsync-refarch-offline with MIT No Attribution 5 votes vote down vote up
Settings = (props) => {
    
    async function createProducts() {
        try {
            await loadProducts();
            Toast.show({
                text: 'Products loaded, pull to refresh',
                buttonText: "Ok",
                duration: 3000
            });
            props.navigation.navigate('Checkout');
        } catch(error) {
            Toast.show({
                text: error,
                buttonText: "Ok",
                duration: 3000
            });   
        }
    }

    async function clearDataStore() {
        await DataStore.clear();
        Toast.show({
            text: 'Storage cleared, pull to refresh',
            buttonText: "Ok",
            duration: 3000
        });
        props.navigation.navigate('Checkout');
    }

    return (
        <Container>
            <Content>
                <Button block info style={styles.settingsBtn} onPress={createProducts}>
                    <Text>Create dummy products</Text>
                </Button>
                <Button block info style={styles.settingsBtn} onPress={clearDataStore}>
                    <Text>Clear local storage</Text>
                </Button>
            </Content>
        </Container>
    );
}
Example #2
Source File: helperFunctions.js    From WhatsApp-Clone with MIT License 5 votes vote down vote up
showToast = ({text, type}) => {
  Toast.show({
    text: text,
    buttonText: 'Done',
    type: type,
  });
}