title: TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
body: <p>Trying to loop through my array and I am facing the below error:
  TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))</p>
  
  <p>I am highlighting my Search value using the below getHighlightedText function. My code:</p>
  
  <pre><code>getHighlightedText = text =&gt; {
      const {value} = this.props;
  
      if (value == "" || value == null || value == 0) {
          return &lt;Text&gt; {text} &lt;/Text&gt;
      } else {
          const words = value.split(/\s+/g).filter(word =&gt; word.length);
          const pattern = words.join('|');
          const re = new RegExp(pattern, 'gi')
          const children = [];
          let before, highlighted, match, pos = 0;
  
          const matches = text.match(re);
          for (match of matches) { // guess this the error location
              match = re.exec(text)
              if (pos &lt; match.index) {
                  before = text.substring(pos, match.index);
                  if (before.length) {
                      children.push(before)
                  }
              }
              highlighted = &lt;Text style={{backgroundColor: 'coral'}}&gt;{match[0]} &lt;/Text&gt;
              children.push(highlighted);
              pos = match.index + match[0].length;
          }
          if (pos &lt; text.length) {
              const last = text.substring(pos);
              children.push(last);
          }
          return &lt;Text&gt;{children} &lt;/Text&gt;
      }
  }
  </code></pre>
  
  <p>How can I resolve this issue?? Any ideasss????</p>