react-native-styled-toast icon indicating copy to clipboard operation
react-native-styled-toast copied to clipboard

Support for TypeScript

Open andrefangeloni opened this issue 2 years ago • 2 comments

Hi there, I'm already installed this lib on my project with TS and I'm facing this error below:

Type '{ children: Element[]; position: "BOTTOM"; }' is not assignable to type 'IntrinsicAttributes & Omit<ToastContextType, "toast">'. Property 'children' does not exist on type 'IntrinsicAttributes & Omit<ToastContextType, "toast">'.

Follow my code:

import React from 'react';
import { Provider } from 'react-redux';
import { StatusBar } from 'react-native';
import { ToastProvider } from 'react-native-styled-toast';

import { Routes } from './routes/routes';

import store from './redux';

const App = () => (
  <Provider store={store}>
    <ToastProvider position="BOTTOM">
      <StatusBar backgroundColor="#000" />
      <Routes />
    </ToastProvider>
  </Provider>
);

export default App;

Thanks

andrefangeloni avatar Jul 04 '22 23:07 andrefangeloni

I solved this problem like this

const App = () => (
  const providerProps= {store}
  <Provider {...providerProps}>
    <ToastProvider position="BOTTOM">
      <StatusBar backgroundColor="#000" />
      <Routes />
    </ToastProvider>
  </Provider>
);

mbukeRepo avatar Aug 18 '22 08:08 mbukeRepo

same here

w1ll-dev avatar Aug 26 '22 13:08 w1ll-dev

@mbukeRepo The problem is on ToastProvider don't expect to receive children by props. It seems no one is maintaining the lib =/

andrefangeloni avatar Aug 26 '22 21:08 andrefangeloni