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.

<Item> rendering error with children in Native Base 2.8.1

See original GitHub issue

Hi NativeBase dev team,

Issue Description

Since I updated Native Base to version 2.8.1, I have encountered this error when using Native Base <Item error floatingLabel> with {children} inside:

TypeError: TypeError: TypeError: undefined is not an object (evaluating ‘this.props.children[i].props.name’)

2018-10-15_01h10_18

node, npm, react-native, react and native-base version, expo version if used

"dependencies": { "expo": "^30.0.1", "native-base": "^2.8.1", "react": "16.3.1", "redux-form": "^7.4.2", "react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz", }

Expected behaviour

2018-10-15_01h25_17

Actual behaviour

Error as I described above.

Steps to reproduce

Add an InputField: 2018-10-15_01h22_24

Then add a FieldWrapper: 2018-10-15_01h22_17

When touched = true and error = true, the error TypeError: TypeError: TypeError: undefined is not an object (evaluating 'this.props.children[i].props.name') appears.

Is the bug present in both iOS and Android or in any one of them?

I am testing on Android.

Any other additional info which would help us debug the issue quicker.

It works perfectly with the same code in 2.8.0 but it is not working in 2.8.1.

The error can be resolved if I remove either {children} or <Icon> in these lines: <Item error floatingLabel> {children} <Icon name='close-circle' /> </Item>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danghuyminhcommented, Dec 28, 2018

Your solution works well! Sorry for using another account at home. Even though in theory, I see no differences between mine and yours. In my case the code looks more complex but I managed to make it work according to your idea. Thank you!

Besides, the version 2.8.0 does not have this issue. So I guess you should check it one day.

1reaction
minhdang-idevcommented, Dec 27, 2018

Thank you very much! I will try your solution and let you know soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - NativeBase
Changelog | NativeBase | Universal Components for React and React Native ; Slide component render fixes. 2224c95 ; Select component key prop warning...
Read more >
Upgrade React Native, native-base, from version 2.13 to 3.01 ...
I am upgrading packages in a React Native application. All was working fine using the android emmulator till I updated native-base package ...
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 >
2.8.1 - native-base - npm
NativeBase is a sleek, ingenious and dynamic front-end framework created by passionate React Loving team at Geekyants.com to build cross ...
Read more >
Understanding the "Objects are not valid as a react child" Error ...
The problem starts when myVariable assumes an object. React has no way to tell what to render when provided with an object, thus...
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