title: React native useContext returns undefined
body: <p>I can't access the data passed by createContext using useContext hook in the functional component in react native :
  context.js is as</p>
  <pre><code>import React , {createContext,useState}  from 'react';
   export const Style1 = React.createContext();
  export  default StyleContextProvider = (props) =&gt; {
  const [myValue,setValue] = useState([{one: 1},{two : 2}]);
  console.log(&quot;value from context : &quot; + myValue);
      return ( 
          &lt;Style1.Provider value={[myValue,setValue]}&gt;
            {props.children}
          &lt;/Style1.Provider&gt;
       );
  }
  </code></pre>
  <p>and App.js is as</p>
  <pre><code>import React from 'react';
  import Sidebar from './routes/sidebar';
  import StyleContextProvider from './routes/context';
  export default function App(props) {
    return (
          &lt;StyleContextProvider&gt;
            &lt;Sidebar &gt;&lt;/Sidebar&gt;
          &lt;/StyleContextProvider&gt;
    );
  }
  </code></pre>
  <p>Sidebar.js is as</p>
  <pre><code>import React ,{useContext } from 'react';
  import {  Text, View ,Button} from 'react-native';
  import Style1 from '../routes/context';
  const Sidebar = () =&gt;{
   const value =  useContext(Style1);
   console.log(&quot;value from sidebar : &quot; + value);  // value from sidebar : undefined
  
  return (
      &lt;View&gt;
        &lt;Practice&gt;&lt;/Practice&gt;
      &lt;/View&gt;
  )
  }
  </code></pre>
  <p>Practice.js</p>
  <pre><code>import  React  ,{useContext }from 'react';
  import { Button } from 'react-native-elements';
  import {View, StyleSheet,Text} from 'react-native';
  import Style1 from '../routes/context';
  const Practice = (props) =&gt; {
    const  Value =  useContext(Style1);
    console.log(&quot;value from practice : &quot; + Value); // value from practice : undefined 
      return ( 
        &lt;View &gt;
          &lt;Text&gt;Value : {Value}&lt;/Text&gt;
        &lt;/View&gt;
       );
  }
   export default Practice;
  </code></pre>
  <p>I'm getting undefined from the practice .js and sidebar.js , Any one with solution</p>