mirror of https://github.com/msgbyte/tailchat
feat(mobile): add cid in entry view
parent
3c121e42eb
commit
781d413527
@ -0,0 +1,28 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { Incubator, ToastPresets } from 'react-native-ui-lib';
|
||||
|
||||
const { Toast } = Incubator;
|
||||
|
||||
export function useToast() {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
|
||||
const showToast = useCallback((text: string) => {
|
||||
setVisible(true);
|
||||
setMessage(text);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
showToast,
|
||||
toastEl: (
|
||||
<Toast
|
||||
preset={ToastPresets.SUCCESS}
|
||||
visible={visible}
|
||||
message={message}
|
||||
onDismiss={() => setVisible(false)}
|
||||
autoDismiss={3500}
|
||||
swipeable={true}
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue