Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,24 @@ export default function App() {
### How to mock the library for testing with [jest](https://jestjs.io)?

```js
jest.mock('react-native-toast-message', () => ({
show: jest.fn(),
hide: jest.fn()
}));
jest.mock('react-native-toast-message', () => {
const RealComponent = jest.requireActual('react-native-toast-message');
const ReactInternal = require('react');
class Toast extends ReactInternal.Component {
static show = jest.fn();
static hide = jest.fn();

render() {
return ReactInternal.createElement(
'Toast',
this.props,
this.props.children,
);
}
}
Toast.propTypes = RealComponent.propTypes;
return Toast;
});
```

### How to show the Toast inside a Modal?
Expand Down