zyslife / react-native-head-tab-view

Add collapsible headers to your tab-view components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

每个tab标签页的页面内容不可以是导入的组件吗

AnbolKing opened this issue · comments

官方案例中TabView1, TabView2, TabView3这三个都是函数而且在同一个文件中,如果是使用导入的组件就无效,即使组件利用使用的是ScrollView

<View style={styles.container}>
             <ScrollTabView headerHeight={headerHeight} renderScrollHeader={_renderScrollHeader}>
                 <HandAccount tabLabel="hand" />
                 <Like tabLabel="like" />
             </ScrollTabView>
         </View>

import HandAccount from './components/handaccount';
import Like from './components/like';

import React from 'react';
import { ScrollView, View, Text } from 'react-native';

const HandAccount = (props) => {
const data = new Array(2).fill({});
return (

{data.map((o, i) => (
<View style={{ marginVertical: 2, padding: 10, borderWidth: 1 }}>
{'tab3 => ' + i}

))}

);
}

export default HandAccount;

@AnbolKing 我看到HandAccount没有使用ScrollView。 另外,如果能提供直接运行的demo更好

@AnbolKing 问题解决了吗?我准备关掉这个了。