Browse Source

scrollable tab view for clase

David 9 years atrás
parent
commit
15c0d08006
1 changed files with 8 additions and 13 deletions
  1. 8 13
      src/scenes/Clase.js

+ 8 - 13
src/scenes/Clase.js

@@ -16,7 +16,6 @@ class Clase extends Component {
 	}
 
   renderView() {
-    const { titulo, profesor, texto, comentarios, respuestas } = this.props.clase;
     if ( this.state.page === 'Teoria' )
       return <Teoria titulo={titulo} profesor={profesor} texto={texto} style={{flex:1}} />;
 
@@ -31,19 +30,15 @@ class Clase extends Component {
 	if (this.props.loading)
 		return <Spinner size="large" />;
 
+    var ScrollableTabView = require('react-native-scrollable-tab-view');
+    const { titulo, profesor, texto, comentarios, respuestas } = this.props.clase;
+
     return (
-      <View style={styles.container, {flex:1}}>
-        <Tabs selected={this.state.page} style={{backgroundColor:'white'}}
-          selectedStyle={{fontWeight:"700"}}
-          onSelect={ el => {
-            this.setState({ page: el.props.name })
-          } }>
-          <Text name="Teoria">Teoria</Text>
-          <Text name="Videos">Videos</Text>
-          <Text name="Comentarios">Comentarios</Text>
-        </Tabs>
-        {this.renderView()}
-      </View>
+      <ScrollableTabView style={styles.container, {flex:1}}>
+		 <Teoria titulo={titulo} profesor={profesor} texto={texto} style={{flex:1}} tabLabel="Teoria" />
+		 <View tabLabel="Videos" />
+		 <Comentarios style={{flex:1}} comentarios={comentarios} respuestas={respuestas} tabLabel="Comentarios" />
+      </ScrollableTabView>
     );
   }
 };