尝试使用可滚动导航创建垂直选项卡

时间:2019-05-13 20:49:54

标签: react-native tabs frontend vertical-scrolling

我正在尝试创建一种垂直选项卡,当按下某个路线图标时,它会以可滚动的动画导航到相关路线的底部或顶部,并且能够通过垂直滚动做到这一点< / p>

我已经尝试了多种方法,例如Satyia164 API https://reactnativeexample.com/an-extension-to-react-native-tab-view-which-provides-a-vertical-tab-bar/ 但是没有结果,我将显示带有以静态方式构造的各个组件的代码

SettingMenu:

import React from 'react';
import {AppRegistry, StyleSheet, View, Image, Text} from "react-native" ;
import {widthPercentageToDP as wp, heightPercentageToDP as hp} from 'react-native-responsive-screen'



export default class SettingMenu extends React.Component {
    render() {
        return(

        <View style={styles.container}>

        <Image  style={{ tintColor: "#9B9B9B", height: 50, width: 50,
        position: 'absolute', top: wp('47.5%'), left: wp('6.5%')}}

          source={require("../Icons/account.png")} 
       // To pay flatIcon
           />
<Text style={styles.text1}> Account </Text>


      <Image  style={{ tintColor: "#9B9B9B", height: 50, width: 50,
        position: 'absolute', top: wp('85%'), left: wp('6.5%')}}

          source={require("../Icons/padlock.png")} 
       // To pay flatIcon
           />

        <Text style={styles.text2}> Privacy </Text>


      <Image  style={{ tintColor: "#9B9B9B", height: 50, width: 50,
        position: 'absolute', top: wp('150%'), left: wp('6.5%')}}

          source={require("../Icons/logout.png")} 
       // To pay flatIcon
           />
           <Text style={styles.text3}> Logout </Text>


                 </View>
        ) 
    }
}


const styles= StyleSheet.create({
    container:{ 
         flex: 1,
        backgroundColor: '#000000',

        width: 100,
    },
    text1:{
 fontSize: 20,
               color: "#9B9B9B",
              top: wp('62%'),
               left: wp('2.5%')


    },
      text2:{
        fontSize: 20,
               color: "#9B9B9B",
              top: wp('94%'),
               left: wp('4%')


    },
    text3:{
        fontSize: 20,
               color: "#9B9B9B",
              top: wp('152%'),
               left: wp('3.5%')


    },




})

SettingScreen:

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import MenuButton from '../Menu/MenuButton'
import SettingMenu from './SettingMenu'

export default class SettingScreen extends React.Component{
    render(){
        return(
            <View style={styles.container}>
          <SettingMenu/>
          <View style={styles.Mstyle}>
            <MenuButton navigation= {this.props.navigation}/>
          </View>
            </View>
        )
    }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#262A2C',

        justifyContent: 'center',
    },
 Mstyle: {
      alignSelf:'center',
      position: 'absolute'
},
});

0 个答案:

没有答案