title: React Native .then seems to be running out of order
body: <p>I currently have the following method in a react native class, however I think this would apply to JS in general but I might be wrong:</p>
  
  <pre><code>  dbGetTemplateOptions = () =&gt; {
      let dataArray = [];
      let subcategories = this.state.subcategories;
  
      subcategories.forEach(item =&gt; {
        let getSubValues = new Promise(function(resolve, reject) {
          resolve(item);
        })
        getSubValues.then((item) =&gt; this.dbGetValues(item.subCatId))
        getSubValues.then((value) =&gt; console.log(2))
      });
    }
  </code></pre>
  
  <p>According to my limited js knowledge of promises, in the above I'm resolving a promise and running getSubValues.then() which would mean that each of the .then methods run AFTER the method returns.</p>
  
  <p>In the above code I call the method <code>dbGetValues(item.subCatId)</code>
  Which is this:</p>
  
  <pre><code>  async dbGetValues(subCatId) {
      let subValues = [];
      let result = await db.transaction(tx =&gt; {
        tx.executeSql(
          'SELECT * FROM dr_template_relational '
          + ' INNER JOIN  dr_report_categorie_values on dr_report_categorie_values.id = dr_template_relational.value_id'
          + ' WHERE dr_template_relational.subcategory_id = ' + subCatId + ' AND dr_template_relational.template_id = ' + this.state.currentTemplateId,
          [],
        (trans, result) =&gt; {
          const sqLiteResults = result.rows._array;
  
          sqLiteResults.forEach(el =&gt; {
            subValues.push({ subCategoryId: subCatId, values: el.value_id, name: el.name, narrative: el.narrative });
          })
        });
      },
      (err) =&gt; console.error(err),
      () =&gt; {
        console.log(1);
        return subValues;
      }
    );
    return result;
    }
  </code></pre>
  
  <p>Notice my console.log(2) is after the then which is calling the method.
  Inside the method also notice I have console.log(1).  I would expect these to run in order since I'm waiting for it to finish before the next then runs.  I realize I'm incorrect because the console.log is actually.</p>
  
  <pre><code>2
  2
  1
  1
  </code></pre>