View React Component

View - is a separate visual part of app with its own settings, navigation and history. Each view also may have different navbar and toolbar layouts, different styles. So it is some kind of app in app. Such kind of functionality allows you easily manipulate each part of your app.

View React component represents Framework7’s View component.

View Components

There are following components included:

  • View / F7View - single View-router component
  • Views / F7Views - wrapper element for multiple views used as Tabs

View Properties

PropTypeDefaultDescription
<View> properties
initbooleantrueInitializes View automatically
tabbooleanUses View as Tab
tabActivebooleanDefines View-Tab as currently active Tab
View React component also accepts all View Parameters. All of them can be passed via separate props on <View> component
<Views> properties
tabsbooleanUses Views as Tabs wrapper container

View Events

Swipe-back related events are available only in iOS theme.

EventDescription
viewInitEvent will be triggered on View initialization
viewResizeEvent will be triggered on Master Detail resize (when masterDetailResizable enabled)
swipebackMoveEvent will be triggered during swipe back move
swipeBackBeforeChangeEvent will be triggered right before swipe back animation to previous page when you release it
swipeBackAfterChangeEvent will be triggered after swipe back animation to previous page when you release it
swipeBackBeforeResetEvent will be triggered right before swipe back animation to current page when you release it
swipeBackAfterResetEvent will be triggered after swipe back animation to current page when you release it
tabShowEvent will be triggered when View-Tab becomes visible/active
tabHideEvent will be triggered when View-Tab becomes invisible/inactive

Access To View Instance

If you use automatic initalization to init the View (with init={true} prop) and need to use View API (like router) you can access its initialized instance:

  • by accessing .f7View component’s property
  • if you have passed name property (e.g. “left”) you can access it like this.$f7.views.left
  • main view (with main={true} prop) is always accessible via this.$f7.views.main

Examples

Minimal layout

  1. <View main>
  2. ...
  3. </View>
  4. {/* Renders to: */}
  5. <div class="view view-main">
  6. ...
  7. </div>

Views As Tabs

  1. <App>
  2. ...
  3. <Views tabs>
  4. <View id="tab-1" main tab tabActive>...</View>
  5. <View id="tab-2" tab>...</View>
  6. </Views>
  7. ...
  8. </App>
  9. {/* Renders to: */}
  10. <div class="framework7-root">
  11. <div class="views tabs">
  12. <div class="view view-main tab tab-active" id="tab-1">...</div>
  13. <div class="view tab" id="tab-2">...</div>
  14. </div>
  15. </div>

With parameters

  1. <View
  2. url="/home/"
  3. animate={false}
  4. iosDynamicNavbar={false}
  5. pushState={true}
  6. >
  7. ...
  8. </View>

← Treeview

Virtual List →