title: Pixel Color in React Native
body: <p>Let me preface this by saying I am completely new to JavaScript, React, React Native, etc...</p>
  
  <p>I am trying to use the React Native module [react-native-pixel-color][1] to get the color of a specified pixel but have been stuck trying to figure it out for some time now. The module states:
  <br><br>
  "promise getHex(path, options) <br>
  The promise resolves with a string containing the uri of the new file."
  <br><br>
  But I am unsure how to go about this? I call the function getPixelColor and pass it an image_uri but I keep getting the following error in the console:</p>
  
  <p>Error: "Cannot read property 'getHex' of undefined" in TypeError: Cannot read property 'getHex' of undefined &lt;&lt; at eval (module://react-native-pixel-color.js:3:1252) &lt;&lt; at new Promise () &lt;&lt; at Object.o [as getHex] (module://react-native-pixel-color.js:3:1197) ...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export default function App() {
    return (
      &lt;View&gt;
        &lt;TouchableOpacity
          onPress={() =&gt; getPixelColor('https://i.imgur.com/TkIrScD.png')}&gt;
          &lt;Text&gt;Pick a photo&lt;/Text&gt;
        &lt;/TouchableOpacity&gt;
      &lt;/View&gt;
    );
  }
  
  function getPixelColor(image_uri) {
    var x = 10;
    var y = 10;
  
    const getHex = new Promise((resolve, reject) =&gt; {
      console.log(x);
      console.log(y);
      console.log(image_uri);
      if (image_uri) {
        console.log('Resolved');
        resolve('Stuff worked!');
      } else {
        console.log('Rejected');
        reject(Error('It broke'));
      }
    });
  
    PixelColor.getHex(image_uri, { x, y })
  
      .then(color =&gt; {
        // #000000
        console.log(color);
      })
  
      .catch(err =&gt; {
        // Oops, something went wrong. Check that the filename is correct and
        // inspect err to get more details.
        console.log('Something Went Wrong');
        console.log(err);
      });
  }</code></pre>
  </div>
  </div>
  </p>