Skip to content

Instantly share code, notes, and snippets.

krissanawat101 krissnawat

Block or report user

Report or block krissnawat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View using bit package.js
import { createStackNavigator, createAppContainer } from "react-navigation";
import Login from "./src/components/Login";
import MainChat from "./src/components/MainChat";
import OTP from "@bit/krissnawat.my-react-native-collection.otp";
const AppNavigator = createStackNavigator(
{
Login: {
screen: Login
},
View update sendotp.js
sendOtp = phone_number => {
fetch(`https://api.ringcaptcha.com/${APP_KEY}/code/sms`, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: `phone=${phone_number}&api_key=${API_KEY}`
}).then(res => {
console.log(res);
View main App.js
import { createStackNavigator, createAppContainer } from "react-navigation";
import Login from "./src/components/Login";
import MainChat from "./src/components/MainChat";
import OTP from "./src/components/OTP";
const AppNavigator = createStackNavigator(
{
Login: {
screen: Login
},
MainChat: {
View index.js
import OTPChecking from "./OTPChecking";
import PhoneInput from "./PhoneInput";
import { createStackNavigator } from "react-navigation";
export default createStackNavigator(
{
PhoneInput: {
screen: PhoneInput
},
OTPChecking: {
screen: OTPChecking
View VerifyOTP.js
VerifyOTP = code => {
let phone_number = this.props.navigation.getParam("phone_number");
fetch("https://api.ringcaptcha.com/xxxxxxxxxx/verify", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: `code=${code}&phone=${phone_number}&api_key=xxxxxxxxxxx`
})
View VerifyOTP.js
VerifyOTP = code => {
let phone_number = this.props.navigation.getParam("phone_number");
fetch("https://api.ringcaptcha.com/1igu6onu8ite2aza8eda/verify", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: `code=${code}&phone=${phone_number}&api_key=d3fb699623fdde7ba6ee8d010893edfe02c01f3c`
})
View otpchecking-1.js
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>input OTP here</Text>
<TextInput
style={styles.input}
placeholder="_ _ _ _ _"
keyboardType={"numeric"}
onChangeText={phone_number =>
this.setState({ phone_number: phone_number })
View sendOtp.js
sendOtp = phone_number => {
fetch("https://api.ringcaptcha.com/1igu6oxxxxxx2aza8eda/code/sms", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: `phone=${phone_number}&api_key=d3fb6xxxxxd010893edfe02c01f3c`
}).then(res => {
alert("OTP will delivery soon checking in next screen");
View phoneinput-2.js
import React, { Component } from "react";
import {
View,
TouchableOpacity,
Text,
StyleSheet,
TextInput
} from "react-native";
class PhoneInput extends Component {
View phoneinput-1.js
import React, { Component } from "react";
import {
View,
TouchableOpacity,
Text,
StyleSheet,
TextInput
} from "react-native";
class PhoneInput extends Component {
You can’t perform that action at this time.