question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.0.0-beta] Button icons do not work: Objects are not valid as a React child (found: object with keys {name, type})

See original GitHub issue

Hello, I am having a problem with button icons, more specifically: I have added a button, and later on tried adding an icon to the button as described in the docs

        <Button 
        text={'Messenger'}
        icon={{name: 'fa-commenting-o', type: 'font-awesome' }}
        onPress={() => navigate('Messneger')} />
        <Button text='YouTube  📺' onPress={() => navigate('YouTube')} />

Unfortunately. the icon doesn’t appear and instead I am getting this red screen: img_1691

I am using: CRNA with “react-native-elements”: “^1.0.0-beta”, and, “@expo/vector-icons”: “^6.2.2”,

Here’s a reproduction of the problem https://snack.expo.io/H1DKeg6BG

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
xavier-villelegiercommented, Jan 29, 2018

Hey @hilalh, the Button documentation is not updated yet, but will be soon.

You must pass a component to the icon props. You can use the Icon component from RNE for example, by doing this:

<Button 
  text={'Messenger'}
  icon={ <Icon name="fa-commenting-o" type="font-awesome" /> }
  onPress={() => navigate('Messneger')}
/>
0reactions
iRoachiecommented, Apr 3, 2018

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the "Objects are not valid as a react child" Error ...
The "Objects are not valid as a React child" error happens when trying to render a collection of data by mistakenly returning the...
Read more >
Invariant Violation: Objects are not valid as a React child
This error usually happens because a function involved in dispatching an event has been given an unexpected object type (i.e passing an object...
Read more >
Objects are not valid as a React child React error | bobbyhadz
The React.js error "Objects are not valid as a React child" occurs when we try to directly render an object or an array...
Read more >
Resolving Error: "Objects are not valid as a React child"
As the error message states, React cannot render objects as children directly. If you are seeing this error, there is a good chance...
Read more >
Design Patterns with React Easy State | by Bertalan Miklos
React Easy State is a transparent reactive state management library with two functions and two accompanying rules. Always wrap your components with view()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found