Skip to content

Latest commit

 

History

History
executable file
·
296 lines (279 loc) · 8.95 KB

Anatomy.md

File metadata and controls

executable file
·
296 lines (279 loc) · 8.95 KB

anatomy-headref

Anatomy

Automatically animates view to its new position.
A common way to use NativeBase screen structure is to have all the components within <Container>

Preview ios anatomy-headref Preview android anatomy-headref

General Syntax {% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, Title, Content, Footer, FooterTab, Button, Left, Right, Body, Icon, Text } from 'native-base'; export default class AnatomyExample extends Component { render() { return (

<Title>Header</Title> This is Content Section Footer ); } } {%- language name="Vue Native", type="vue" -%} Header Content goes here Footer {%- endcodetabs %}

  • NativeBase provides its own frame component, named after <Container>.
  • All the components should be included within the Container.
  • Container takes mainly three components: <Header>, <Content> and <Footer>.
  • Container comes with its predefined stylesheet, with an added advantage of accepting user-defined styles.
  • Usage of Container's Header component is very similar to your HTML <head>. So is with Footer.
  • The Content component of Container is nothing but the body section of your screen.

Configuration

Property Default Option Description
Header - - Renders as Header (navbar) of your screen.
Input values: Button, Title (Text).
Content - - Represents the main content of your screen.
There can be only one <Content> component in a screen.
Footer - - Renders as Footer of your screen.
Input values: FooterTab

Header Anatomy

{% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, Title, Button, Left, Right, Body, Icon } from 'native-base'; export default class HeaderExample extends Component { render() { return (

<Title>Header</Title> ); } } {%- language name="Vue Native", type="vue" -%} Header {%- endcodetabs %}

Content Anatomy

  • This is a NativeBase component which renders as body element of your screen.
  • Each screen can have only one Content component and can be defined anywhere within the Container.
  • Content takes in the whole collection of React Native and NativeBase components.
  • Content provides you with stylesheet.
  • User can add custom styles while defining Content within their app.
  • Replacing Component: React Native Keyboard Aware Scroll View's KeyboardAwareScrollView

{% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, Content, Footer, Text } from 'native-base'; export default class ContentExample extends Component { render() { return (

This is Content Section ); } } {%- language name="Vue Native", type="vue" -%} Content goes here {%- endcodetabs %}

Property Default Option Description
padder true boolean Applies margin at all sides to Content section. Can be used with NativeBase View as well.
disableKBDismissScroll false boolean Disables automatic scroll on focus.
contentContainerStyle - style Lets the user style the Content component.
enableResetScrollToCoords true boolean Lets the user enable or disable automatic resetScrollToCoords.

Footer Anatomy

  • NativeBase component that renders as footer, include your favourite apps for your screen.
  • There can be only a single Footer component into your Container.
  • To have Footer for your screen, include Footer component within Container.
  • NativeBase gives you flexibility to define your Footer component anywhere in the bounds of Container.
  • Footer takes input as: FooterTab.
  • The components those are defined within Footer will be rendered in the same order that you define them.
  • Footer provides you with stylesheet.
  • User can add custom styles while defining Footer within their app.
  • Replacing Component: React Native View.

{% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, Content, Footer, FooterTab, Button, Text } from 'native-base'; export default class FooterExample extends Component { render() { return (

Footer ); } } {%- language name="Vue Native", type="vue" -%} Footer {%- endcodetabs %}