sekizlipenguen / react-native-popup-confirm-toast

MIT License
89 stars 12 forks source link

undefined is not an object (evaluating 'this.popupInstance.start') #14

Closed KatuGT closed 1 year ago

KatuGT commented 1 year ago

Hello! I am having a problen, I can´t make it work This is my code

const handleDelete = (id) => {
    Popup.show({
      type: 'success',
      title: 'Dikkat!',
      textBody: 'Mutlak özgürlük, kendi başına hiçbir anlam ifade etmez. ',
      buttonText: 'Tamam',
      callback: () => Popup.hide()
    })
    const trabajosFiltrados = userInfo?.workExperience.filter((work) => {
      return work._id !== id;
    });

    // dispatch(
    //   editPersonalInfo(
    //     {
    //       workExperience: [...trabajosFiltrados],
    //     },
    //     userInfo?.token
    //   )
    // )
    //   .then(() => dispatch(Cambiador(!activador)))
    //   .catch((error) => console.log(error));
  };

I was just testing but I get this error ERROR TypeError: undefined is not an object (evaluating 'this.popupInstance.start')

KatuGT commented 1 year ago

I have the imports import { Root, Popup } from 'react-native-popup-confirm-toast'

sekizlipenguen commented 1 year ago

why did you turn it off?

Usage

Wrap your root component in Provider from react-native-popup-confirm-toast. If you have a vanilla React Native project, it's a good idea to add it in the component which is passed to AppRegistry.registerComponent. This will usually be in the index.js file. If you have an Expo project, you can do this inside the exported component in the App.js file.

Example Provider

import * as React from 'react';
import { AppRegistry } from 'react-native';
import {Root as PopupRootProvider} from 'react-native-popup-confirm-toast';
import { name as appName } from './app.json';
import App from './src/App';

export default function Main() {
  return (
    <PopupRootProvider>
      <App />
    </PopupRootProvider>
  );
}

AppRegistry.registerComponent(appName, () => Main);
KatuGT commented 1 year ago

Because stupid me didn´t use the component, that was the problem I should close the "close with comment" button to explain

sekizlipenguen commented 1 year ago

Because stupid me didn´t use the component, that was the problem I should close the "close with comment" button to explain

hey no problem! Don't forget to give a star if you like it :)