Skip to content

Commit

Permalink
fix hide
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Aug 31, 2023
1 parent e5069c7 commit f88162e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/Toast.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import React, {
Component,
} from 'react';
import {
View
} from 'react-native';
import RootSiblings from 'react-native-root-siblings';
import ToastContainer, {positions, durations} from './ToastContainer';


class Toast extends Component {
static displayName = 'Toast';
static propTypes = ToastContainer.propTypes;
static positions = positions;
static durations = durations;

static show = (message, options = {position: positions.BOTTOM, duration: durations.SHORT}) => {
return new RootSiblings(<ToastContainer
let instance = {destroy: () => {}};
const onHidden = ()=>{
options.onHidden && options.onHidden();
instance.destroy();
}
instance = new RootSiblings(<ToastContainer
{...options}
onHidden={onHidden}
visible={true}
>
{message}
</ToastContainer>);
return instance;
};

static hide = toast => {
Expand Down

0 comments on commit f88162e

Please sign in to comment.