<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sarvar</title>
    <description>The latest articles on DEV Community by Sarvar (@sirojov).</description>
    <link>https://dev.to/sirojov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1155239%2Fba942f48-e491-46d2-ba58-7bb1491e4db1.jpg</url>
      <title>DEV Community: Sarvar</title>
      <link>https://dev.to/sirojov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sirojov"/>
    <language>en</language>
    <item>
      <title>How to resolve the error "Unable to validate properties of null value"?</title>
      <dc:creator>Sarvar</dc:creator>
      <pubDate>Sat, 09 Sep 2023 05:29:17 +0000</pubDate>
      <link>https://dev.to/sirojov/how-to-resolve-the-error-unable-to-validate-properties-of-null-value-2i1k</link>
      <guid>https://dev.to/sirojov/how-to-resolve-the-error-unable-to-validate-properties-of-null-value-2i1k</guid>
      <description>&lt;p&gt;I want to implement user authentication via phone number using Firebase.&lt;/p&gt;

&lt;p&gt;The FirebasePhoneAuth component represents a form with an input field for the phone number and a "Send Verification Code" button. When the "Send Verification Code" button is pressed, the sendVerificationCode function is called, which sends a request to the Firebase server to send an SMS with the confirmation code to the entered phone number. After a successful request, the result will be the creation of a confirmationResult object, which stores information about the phone number and the confirmation code.&lt;/p&gt;

&lt;p&gt;Question: When pressing the "SEND CODE" button, an error alert "cannot read property verify of undefined" occurs. How can I solve this problem?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WN-xZ7TM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95hnqb1nerb3p8800aj6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WN-xZ7TM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95hnqb1nerb3p8800aj6.jpg" alt="Image description" width="640" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;`import React, { useState } from "react";&lt;br&gt;
import { Alert, Button, StyleSheet, TextInput, View } from "react-native";&lt;br&gt;
import { initializeApp } from "firebase/app";&lt;br&gt;
import AsyncStorage from "@react-native-async-storage/async-storage";&lt;br&gt;
import { initializeAuth, getReactNativePersistence,signInWithPhoneNumber,getAuth} from 'firebase/auth';&lt;br&gt;
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';&lt;/p&gt;

&lt;p&gt;const firebaseConfig = {&lt;br&gt;
  apiKey: "AIzaSyD5Qg_t9KR4TmLr2p14E2aODO9UV5RehUE",&lt;br&gt;
  authDomain: "sharq-9ec25.firebaseapp.com",&lt;br&gt;
  databaseURL: "&lt;a href="https://sharq-9ec25-default-rtdb.firebaseio.com"&gt;https://sharq-9ec25-default-rtdb.firebaseio.com&lt;/a&gt;",&lt;br&gt;
  projectId: "sharq-9ec25",&lt;br&gt;
  storageBucket: "sharq-9ec25.appspot.com",&lt;br&gt;
  messagingSenderId: "613514564466",&lt;br&gt;
  appId: "1:613514564466:web:c76f60d1a5d151689e83eb",&lt;br&gt;
  measurementId: "G-BGWW40HYBJ"&lt;br&gt;
};&lt;br&gt;
// initialize Firebase App&lt;br&gt;
const app = initializeApp(firebaseConfig);&lt;br&gt;
// initialize Firebase Auth for that app immediately&lt;br&gt;
const auth = initializeAuth(app, {&lt;br&gt;
  persistence: getReactNativePersistence(ReactNativeAsyncStorage)&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;const FirebasePhoneAuth = () =&amp;gt; {&lt;br&gt;
  const [phoneNumber, setPhoneNumber] = useState(""); //  для номера телефона&lt;br&gt;
  const [verificationCode, setVerificationCode] = useState(""); //  для кода подтверждения&lt;br&gt;
  const [confirmationResult, setConfirmationResult] = useState(null); //  для результатов&lt;/p&gt;

&lt;p&gt;const sendVerificationCode = async () =&amp;gt; {&lt;br&gt;
  try {&lt;br&gt;
    const confirmation = await signInWithPhoneNumber(auth, phoneNumber);&lt;br&gt;
    setConfirmationResult(confirmation);&lt;br&gt;
  } catch (err) {&lt;br&gt;
    Alert.alert("Error", err.message);&lt;br&gt;
  }&lt;br&gt;&lt;br&gt;
};&lt;br&gt;
  const confirmVerificationCode = async () =&amp;gt; {&lt;br&gt;
    try {&lt;br&gt;
      if (confirmationResult) {&lt;br&gt;
        await confirmationResult.confirm(verificationCode);&lt;br&gt;
        Alert.alert("Успех", "Номер телефона успешно подтвержден");&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Сохранение номера телефона в AsyncStorage
await AsyncStorage.setItem("phoneNumber", phoneNumber);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;} else {&lt;br&gt;
    Alert.alert("Ошибка", "Не удалось подтвердить номер телефона");&lt;br&gt;
  }&lt;br&gt;
  } catch (error) {&lt;br&gt;
      Alert.alert("Ошибка", error.message);&lt;br&gt;
    }&lt;br&gt;
  };&lt;/p&gt;

&lt;p&gt;return (&lt;br&gt;
    &lt;br&gt;
      
        style={styles.input}&lt;br&gt;
        placeholder="Введите номер телефона"&lt;br&gt;
        onChangeText={(value) =&amp;gt; setPhoneNumber(value)}&lt;br&gt;
      /&amp;gt;&lt;br&gt;
      &lt;/p&gt;

&lt;p&gt;{confirmationResult &amp;amp;&amp;amp; (&lt;br&gt;
    &amp;lt;&amp;gt;&lt;br&gt;
      
        style={styles.input}&lt;br&gt;
        placeholder="Введите код подтверждения"&lt;br&gt;
        onChangeText={(value) =&amp;gt; setVerificationCode(value)}&lt;br&gt;
      /&amp;gt;&lt;br&gt;
      &lt;br&gt;
    &amp;lt;/&amp;gt;&lt;br&gt;
  )}&lt;br&gt;
&lt;br&gt;
);&lt;br&gt;
};&lt;/p&gt;

&lt;p&gt;const styles = StyleSheet.create({&lt;br&gt;
  container: {&lt;br&gt;
    flex: 1,&lt;br&gt;
    justifyContent: "center",&lt;br&gt;
    alignItems: "center",&lt;br&gt;
  },&lt;br&gt;
  input: {&lt;br&gt;
    width: "80%",&lt;br&gt;
    height: 40,&lt;br&gt;
    borderWidth: 1,&lt;br&gt;
    marginBottom: 20,&lt;br&gt;
    paddingHorizontal: 10,&lt;br&gt;
  },&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;export default FirebasePhoneAuth;`&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>firebase</category>
      <category>reactnative</category>
      <category>react</category>
    </item>
  </channel>
</rss>
