reactnative-visual
  • @dormakaba/digital-reactnative-visual
  • Getting started
  • Changelog
  • Components
    • Avatar
    • Button
    • Card
    • Checkbox / Radio
    • Icons
    • IconButton
    • Image Cropper
    • Page, Row, Col
    • List, ListItem
    • Modal
    • Notification
    • QR Code Reader
    • Select
    • Snack
    • Swipeable
    • Textfield
    • Typography: H1, P, Label, Hint, Text
  • Page Templates
    • Animated Login View
    • Login Area View
    • Animated Panel List
    • Animated Avatar View
  • Misc
    • Colors
    • VisualProvider
  • Show Cases
    • exivo
Powered by GitBook
On this page
  • Preview
  • Code sample
  • Hints
  1. Page Templates

Animated Login View

The Animated Login View provides a unique visual appearance for the Login, Register pages.

PreviousTypography: H1, P, Label, Hint, TextNextLogin Area View

Last updated 6 years ago

Preview

The Animated Login View provides a unique visual appearance for the Login, Register pages. On successful login there will be shown an animation opening the background for the content (in most cases some sort of dashboard view).

Code sample

import React from 'react';
import { View, Image } from 'react-native';


import { AnimatedLogin, Textfield, Button } from '@dormakaba/digital-reactnative-visual';';

class Login extends React.Component {
  render() {
    const onAnimationDone = () => {
      // navigate to dashbord view
    }

    const onPress = () => {
      this.loginView.animate();
    }

    return (
      <AnimatedLogin
        ref={(ref) => this.loginView = ref}
        onAnimationDone={onAnimationDone}
        logo={<Image source={require('../../assets/img/appicon.png')} style={{ width: 76, height: 76 }} />}
        footer={(
          <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
            <Text>APP Version: 1.0.0</Text>
            <Text>API Version: 1.2.1</Text>
          </View>
        )}
      >
        <Textfield label="Username" />
        <Textfield label="Password" />
        <View style={{ marginTop: 20, flexDirection: 'row', justifyContent: 'flex-end' }}>
          <Button onPress={onPress} primary>Login</Button>
        </View>
      </AnimatedLogin>
    );
  }
}

Hints

Trigger animation on state change (redux)

In case you're using redux you might trigger the success animation onComponentWillReceiveProps based on state change like:

  // isAuthenticated get passed in eg. via redux state
  componentWillReceiveProps({ isAuthenticated }) {
    const { navigation } = this.props;
    if (isAuthenticated) this.loginView && this.loginView.animate();
  }

Usage on pages without animations

For using just the background and look & feel without the need of playing the animation there is the

Animation playing on successful login, registration
LoginAreaView