1.0.0 • Published 3 years ago

vkui-no-connection-modal v1.0.0

Weekly downloads
2
License
UNLICENSED
Repository
github
Last release
3 years ago

Features

  • Supported all VKUI themes
  • Auto close modal when user online
  • Check connect when user try close modal

Install

yarn add 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>
    );
};

Options

You can passed options for component:

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

Demo

Start storybook

yarn start

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/featureName)
  3. Commit your Changes (git commit -m 'Add some featureName')
  4. Push to the Branch (git push origin feature/featureName)
  5. Open a Pull Request

Credits

A big thanks to:

  • VKUI - Component based on VKUI