1.6.3 • Published 4 years ago

vkui-no-internet-modals v1.6.3

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Характеристики

  • Поддерживаются все темы VKUI
  • Автоматическое закрытие модального режима, когда пользователь онлайн
  • Проверьте подключение, когда пользователь пытается закрыть модальный

Install

npm install vkui-no-connection-modal

Example

import NoConnectionModal from 'vkui-no-connection-modal';
import useConnection from 'vkui-no-connection-modal/lib/useConnection';

const YourView = () => {
    const [modal, setModal] = useState(null);
    const isOnline = useConnection();

    useEffect(() => {
		if (!isOnline) return setModal(
			<NoConnectionModal 
				onClose={() => setModal(null)}
			/>
		);

		return setModal(null);
	}, [isOnline]);

    return (
        <View activePanel="modals" modal={modal}>
            <Panel id="modals">
                <Group>
                    Your view
                </Group>
            </Panel>
        </View>
    );
};

Параметры

Вы можете передать параметры для компонента:

NameTypeDescriptionDefault
titlestringModal title'No internet'
captionstringModal description'Checking the network cables, modem and router.'
actionTextstringButton text'Try again'
onClosefunctionClose modal functionRequired

демонстрация

Start storybook

  1. Fork the Project
  2. Создайте свой ветвь (git checkout -b feature/featureName)
  3. Зафиксируйте свои изменения (git commit -m 'Add some featureName')
  4. Нажмите на ветку (git push origin feature/featureName)
  5. Откройте запрос на извлечение