小编Ani*_*sya的帖子

react-native-tab-view 不可见,未显示在屏幕上或无法工作

由于 flex: 1 样式,react-native-tab-view 不可见、未显示在屏幕上或无法工作,我们必须在父视图内提供 flex: 1 样式,否则它不会显示在屏幕上。

供参考: https: //github.com/satya164/react-native-tab-view/blob/main/example/src/CustomTabBarExample.tsx

解决方案 :-

第一次前。使用默认标签栏 -

import { StyleSheet, Text, View, useWindowDimensions } from 'react-native'
import React from 'react'

import { TabView, TabBar, SceneMap } from 'react-native-tab-view';

const BookingScreen = () => {

const layout = useWindowDimensions();

const FirstRoute = () => (
    <View style={{ flex: 1, backgroundColor: '#ff4081' }} /> // here also writing flex: 1 is mandatory
);

const SecondRoute = () => (
    <View style={{ flex: 1, backgroundColor: …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-tab-view

7
推荐指数
2
解决办法
5054
查看次数