title: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got object
body: <p>**</p>
  <ul>
  <li><em>The error I am getting when the 'Snapshot Test' is executed for
  App.tsx:</em></li>
  </ul>
  <p>**</p>
  <p>'''</p>
  <pre><code>Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
  </code></pre>
  <p>'''</p>
  <p>I am facing the following issue for our react native project:</p>
  <p>'''</p>
  <pre><code>console.error
  Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
  
  Check the render method of `Icon`.
      at Icon (&lt;projectRoot&gt;\node_modules\@expo\vector-icons\build\vendor\react-native-vector-icons\lib\create-icon-set.js:70:36)        at Icon (D:\Projects\MEEL\app-native-consumer\node_modules\@expo\vector-icons\build\createIconSet.js:65:36)
      at Icon (&lt;projectRoot&gt;\node_modules\react-native-paper\lib\commonjs\components\Icon.js:117:21)
      at ThemedComponent (&lt;projectRoot&gt;\node_modules\@callstack\react-theme-provider\src\createWithTheme.js:21:31)
      at View
      at View (&lt;projectRoot&gt;\node_modules\react-native\jest\mockComponent.js:35:36)
      at Avatar.Icon (&lt;projectRoot&gt;\node_modules\react-native-paper\lib\commonjs\components\Avatar\AvatarIcon.js:103:19)
      at ThemedComponent (&lt;projectRoot&gt;\node_modules\@callstack\react-theme-provider\src\createWithTheme.js:21:31)
      at View
      at View (&lt;projectRoot&gt;\node_modules\react-native\jest\mockComponent.js:35:36)
      at Success (&lt;projectRoot&gt;\scenes\Success\index.tsx:207:25)
  
    at printWarning (node_modules/react/cjs/react.development.js:315:30)
    at error (node_modules/react/cjs/react.development.js:287:5)
    at Object.createElementWithValidation [as createElement] (node_modules/react/cjs/react.development.js:1788:7)
    at Icon.render (node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/lib/create-icon-set.js:120:31)
    at finishClassComponent (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8459:31)
    at updateClassComponent (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8409:24)
    at beginWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9990:16)
  
  console.error
  The above error occurred in the component:
  
      at Icon (&lt;projectRoot&gt;\node_modules\@expo\vector-icons\build\vendor\react-native-vector-icons\lib\create-icon-set.js:70:36)        at Icon (D:\Projects\MEEL\app-native-consumer\node_modules\@expo\vector-icons\build\createIconSet.js:65:36)
      at Icon (&lt;projectRoot&gt;\node_modules\react-native-paper\lib\commonjs\components\Icon.js:117:21)
      at ThemedComponent (&lt;projectRoot&gt;\node_modules\@callstack\react-theme-provider\src\createWithTheme.js:21:31)
      at View
      at View (&lt;projectRoot&gt;\node_modules\react-native\jest\mockComponent.js:35:36)
      at Avatar.Icon (&lt;projectRoot&gt;\node_modules\react-native-paper\lib\commonjs\components\Avatar\AvatarIcon.js:103:19)
      at ThemedComponent (&lt;projectRoot&gt;\node_modules\@callstack\react-theme-provider\src\createWithTheme.js:21:31)
      at View
      at View (&lt;projectRoot&gt;\node_modules\react-native\jest\mockComponent.js:35:36)
      at Success (&lt;projectRoot&gt;\scenes\Success\index.tsx:207:25)
  
  Consider adding an error boundary to your tree to customize error handling behavior.
  Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
  '''
  
  _**NOTE**_: I have replaced our project root details with '&lt;projectRoot&gt;'
  
  ***CURRENTLY*** - The mentioned error/warning popping always when the snapshot tests are executed where the snapshot tests pass but due to warnings, the pipeline fails and thus blocks the build.
  
  ***CODE BLOCK:***
  From file 1:
  
  '''
  &lt;Avatar.Icon style={{ backgroundColor: &quot;#00C33F&quot; }} color={&quot;#FFFFFF&quot;} icon=&quot;check&quot; /&gt;
  </code></pre>
  <p>'''</p>
  <pre><code>From file 2:
  '''
  &lt;TextInput
  mode={&quot;flat&quot;}
  style={styles.inputStyle}
  underlineColor={errors.email ? colors.underline : colors.accent}
  theme={{ fonts: { regular: fonts.medium }, colors: errors.email ? { placeholder: colors.textRed } : { text: colors.textBlack } }}
  label=&quot;E-mail&quot;
  left={&lt;TextInput.Icon name=&quot;email-outline&quot; color={colors.accent} /&gt;}
  onBlur={onBlur}
  value={value}
  onChangeText={text =&gt; onChange(text)}
  keyboardType={&quot;email-address&quot;}
  returnKeyType={&quot;done&quot;}
  blurOnSubmit={true}
  onSubmitEditing={handleSubmit(onSendCode)}
  /&gt;
  </code></pre>
  <p>'''</p>
  <p>When commented on the mentioned line/s or code above it stops throwing the mentioned error.</p>
  <p>Requests to suggest a fix.
  <strong>Versions for the packages used:</strong>
  &quot;react-native&quot;: &quot;https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz&quot;,
  &quot;react-native-paper&quot; - &quot;^4.8.1&quot;,
  &quot;react-native-vector-icons&quot; - &quot;^8.1.0&quot;
  &quot;npm&quot; - &quot;6.14.7&quot;</p>
  <p><strong>Please find the sample project/code at</strong> <a href="https://github.com/nitinthiteITWOX/VectorIconTest/tree/master" rel="nofollow noreferrer">https://github.com/nitinthiteITWOX/VectorIconTest/tree/master</a> for the error.</p>
  <p><strong>Steps to reproduce the error:</strong></p>
  <p>'''
  Clone the project on local
  execute 'npm install'
  execute 'npm test'
  '''</p>
  <p>Issue listed on react-native-paper forum - <a href="https://github.com/callstack/react-native-paper/issues/2695" rel="nofollow noreferrer">https://github.com/callstack/react-native-paper/issues/2695</a></p>
  <p><strong>Looking forward for help/suggestion/s</strong></p>