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.

What component to use as root of child component?

See original GitHub issue

native-base v2.1.5

In RN components or loops, all content must be wrapped in a single component. If it’s not the top-level component then previous to Native Base we’d use a <View> tag.

E.g. this is ok:

render() {
  <View>
    <Text />
    <Text />
  </View>
}

But this breaks:

render() {
  <Text />
  <Text />
}

With what do we replace <View> in this case? Container gives strange behavior (I believe it should only be at the top level of the screen) and Content is supposed to be only one per screen. Is continuing to use <View> as the top level of child components the recommended method?

Couldn’t find anything about this in the docs.

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shivrajkumarcommented, Jul 11, 2017

@lukecwilliams Container component of NativeBase is actually View component of RN and ScrollView is the replacing component of Content. For any screen the ideal code structure with NativeBase is something like this http://docs.nativebase.io/Components.html#anatomy-headref Use Content inside Container, if you have a scrollable View else you can just use Container. Hope that makes sense. Le us know if you face any issue

0reactions
SupriyaKalghatgicommented, Nov 20, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Programming CM - Root and child components - IBM
A root component is the first or only level of an l item type. An item type consists of both system- and user-defined...
Read more >
How to inject a component into root component from a child ...
But i want to inject ToastrNotification to the root element from MyComponent using a code like below: const showNotification = () => { ......
Read more >
Vue.js Components — Parent, Child and Root - Medium
In this article, we'll look at how to access various parts of a parent, child, or root component. Also, we look at dependency...
Read more >
An Introduction to Child-Root Data Passing in React.js
In this guide, you will explore this use case in React.js. ... It's the same when passing data from a parent to child...
Read more >
Components Basics - Vue.js
To use a child component, we need to import it in the parent component. Assuming we placed our counter component inside a file...
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