Skip to content

Use Toast React Hooks #82

Description

@AgustinNG

The toast will not work with the new version of React Native, who is working with Hooks, the ref of the toast does not you can add the useRef.

Activity

  1. danstepanov commented on Aug 24, 2019

    @danstepanov
    import React, { useRef } from 'react';
    import { Button, View } from 'react-native';
    import Toast from 'react-native-easy-toast';
    
    const App = () => {
      const toastRef = useRef();
    
      return (
        <View style={styles.container}>
          <Button title="Show Toast" onPress={() => toastRef.current.show('hello world!')} />
          <Toast ref={toastRef} />
        </View>
      );
    };
    
    export default App;
    
  2. alikrodrigues commented on Nov 7, 2019

    @alikrodrigues

    @danstepanov thanks, i'ts work for me.

  3. malvinder commented on Mar 30, 2020

    @malvinder

    Works for me as well.
    Thank you @danstepanov

  4. yazmnh87 commented on Aug 18, 2020

    @yazmnh87

    So if I import "DURATION" like import Toast, {DURATION} from 'react-native-easy-toast'; ref.current is undefined.

    if I import Toast like import Toast from 'react-native-easy-toast'; the ref is defined, but then how do I access {DURATION}?

  5. huy-lv commented on Dec 12, 2020

    @huy-lv

    Please add this to readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions