SIgn Up React Native Code


SIGN-UP PAGE IN REACT-NATIVE WITH CODE:-




index.js

import React, { Component } from "react";
import { ViewTextStyleSheetDimensionsTextInput } from "react-native";

import Svg, { ImageCircleClipPath } from "react-native-svg";
import Animated, { Easing } from "react-native-reanimated";
import "react-native-gesture-handler";
import { TapGestureHandlerState } from "react-native-gesture-handler";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";

const { widthheight } = Dimensions.get("window");
const {
  Value,
  event,
  block,
  cond,
  eq,
  set,
  Clock,
  startClock,
  stopClock,
  debug,
  timing,
  clockRunning,
  interpolate,
  Extrapolate,
  concat,
} = Animated;

function runTiming(clockvaluedest) {
  const state = {
    finished: new Value(0),
    position: new Value(0),
    time: new Value(0),
    frameTime: new Value(0),
  };

  const config = {
    duration: 1000,
    toValue: new Value(0),
    easing: Easing.inOut(Easing.ease),
  };

  return block([
    cond(clockRunning(clock), 0, [
      set(state.finished0),
      set(state.time0),
      set(state.positionvalue),
      set(state.frameTime0),
      set(config.toValuedest),
      startClock(clock),
    ]),
    timing(clockstateconfig),
    cond(state.finisheddebug("stop clock"stopClock(clock))),
    state.position,
  ]);
}

class BetulStore extends Component {
  constructor() {
    super();

    this.buttonOpacity = new Value(1);
    this.onStateChange = event([
      {
        nativeEvent: ({ state }) =>
          block([
            cond(
              eq(stateState.END),
              set(this.buttonOpacityrunTiming(new Clock(), 10))
            ),
          ]),
      },
    ]);

    this.onCloseState = event([
      {
        nativeEvent: ({ state }) =>
          block([
            cond(
              eq(stateState.END),
              set(this.buttonOpacityrunTiming(new Clock(), 01))
            ),
          ]),
      },
    ]);

    this.buttonY = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [1000],
      extrapolate: Extrapolate.CLAMP,
    });

    this.bagY = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [-height / 3 - 500],
      extrapolate: Extrapolate.CLAMP,
    });

    this.textInputY = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [01],
      extrapolate: Extrapolate.CLAMP,
    });

    this.textInputZindex = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [1, -1],
      extrapolate: Extrapolate.CLAMP,
    });

    this.textOpacity = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [10],
      extrapolate: Extrapolate.CLAMP,
    });
    this.rotateCross = interpolate(this.buttonOpacity, {
      inputRange: [01],
      outputRange: [180360],
      extrapolate: Extrapolate.CLAMP,
    });
  }
  render() {
    return (
      <View
        style={{
          flex: 1,
          backgroundColor: "white",
          justifyContent: "flex-end",
        }}
      >
        <Animated.View
          style={{
            ...StyleSheet.absoluteFill,
            transform: [{ translateY: this.bagY }],
          }}
        >
          <Svg height={height + 50} width={width}>
            <ClipPath id="clip">
              <Circle r={height + 50} cx={width / 2} />
            </ClipPath>
            <Image
              href={require("../assets/bg2.jpg")}
              height={height + 50}
              width={width}
              preserveAspectRatio="xMidYMId slice"
              clipPath="url(#clip)"
            />
          </Svg>
        </Animated.View>
        <View style={height: height / 3justifyContent: "center" }}>
          <TapGestureHandler onHandlerStateChange={this.onStateChange}>
            <Animated.View
              style={{
                ...styles.button,
                opacity: this.buttonOpacity,
                transform: [{ translateY: this.buttonY }],
              }}
            >
              <Text style={fontSize: 20fontWeight: "bold" }}>SIGN IN</Text>
            </Animated.View>
          </TapGestureHandler>
          <Animated.View
            style={{
              ...styles.button,
              backgroundColor: "#2E71DC",
              opacity: this.buttonOpacity,
              transform: [{ translateY: this.buttonY }],
            }}
          >
            <Text style={fontSize: 20fontWeight: "bold"color: "#fff" }}>
              Facebook
            </Text>
          </Animated.View>
          <Animated.View
            style={{
              zIndex: this.textInputZindex,
              opacity: this.textOpacity,
              transform: [{ translateY: this.textInputY }],
              height: height / 3,
              ...StyleSheet.absoluteFill,
              top: null,
              justifyContent: "center",
            }}
          >
            <TapGestureHandler onHandlerStateChange={this.onCloseState}>
              <Animated.View style={styles.closeButton}>
                <Animated.Text
                  style={{
                    fontSize: 15,
                    transform: [{ rotate: concat(this.rotateCross"deg") }],
                  }}
                >
                  X
                </Animated.Text>
              </Animated.View>
            </TapGestureHandler>
            <TextInput
              placeholder="PHONE NUMBER"
              style={styles.TextInput}
              placeholderTextColor="black"
            />
            <TextInput
              placeholder="ONE TIME PASSWORD"
              style={styles.TextInput}
              placeholderTextColor="black"
            />
            <Animated.View style={styles.button}>
              <Text style={fontSize: 20fontWeight: "bold" }}>SIGN IN</Text>
            </Animated.View>
          </Animated.View>
        </View>
      </View>
    );
  }
}

export default BetulStore;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
  button: {
    backgroundColor: "#fff",
    height: 70,
    marginHorizontal: 20,
    borderRadius: 35,
    alignItems: "center",
    justifyContent: "center",
    marginVertical: 5,
    shadowOffset: { width: 2height: 2 },
    shadowColor: "black",
    shadowOpacity: 0.2,
  },
  closeButton: {
    height: 40,
    width: 40,
    backgroundColor: "white",
    borderRadius: 20,
    alignItems: "center",
    justifyContent: "center",
    position: "absolute",
    top: -20,
    left: width / 2 - 20,
    shadowOffset: { width: 2height: 2 },
    shadowColor: "black",
    shadowOpacity: 0.2,
  },
  TextInput: {
    height: 50,
    borderRadius: 25,
    borderWidth: 0.5,
    marginHorizontal: 20,
    paddingLeft: 10,
    marginVertical: 5,
    borderColor: "rgba(0,0,0,0.2)",
  },
});

App.js


import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheetTextViewTypeScriptSafeAreaView } from "react-native";

import { Asset } from "expo-asset";
import { AppLoading } from "expo";
import BetulStore from "./App/index";

function cacheImages(images) {
  return images.map((image=> {
    if (typeof image === "string") {
      return Image.prefetch(image);
    } else {
      return Asset.fromModule(image).downloadAsync();
    }
  });
}

export default class App extends React.Component {
  constructor() {
    super();
    this.state = {
      isReady: false,
    };
  }

  async _loadAssetsAsync() {
    const imageAssets = cacheImages([require("./assets/bg.jpg")]);

    await Promise.all([...imageAssets]);
  }
  render() {
    if (!this.state.isReady) {
      return (
        <AppLoading
          startAsync={this._loadAssetsAsync}
          onFinish={() => this.setState({ isReady: true })}
          onError={console.warn}
        />
      );
    }
    return <BetulStore />;
  }

  styles = StyleSheet.create({
    container: {
      flex: 1,
      backgroundColor: "#fff",
      alignItems: "center",
      justifyContent: "center",
    },
  });
}




Comments

Popular Posts