我无法解决这个问题,并浏览了以下文档 https://www.npmjs.com/package/react-native-tab-view
我也没有遇到任何关于这个问题的文件。我使用了上面链接中提到的相同示例代码。
import * as React from 'react';
import { View, StyleSheet, Dimensions } from 'react-native';
import { TabView, SceneMap } from 'react-native-tab-view';
const FirstRoute = () => (
<View style={[styles.scene, { backgroundColor: '#ff4081' }]} />
);
const SecondRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} />
);
const initialLayout = { width: Dimensions.get('window').width };
export default function TabViewExample() {
const [index, setIndex] = React.useState(0);
const [routes] = React.useState([
{ key: 'first', title: 'First' },
{ key: 'second', title: 'Second' },
]);
const renderScene = SceneMap({
first: FirstRoute,
second: SecondRoute,
});
return (
<TabView
navigationState={{ index, routes }}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={initialLayout}
/>
);
}
const styles = StyleSheet.create({
scene: {
flex: 1,
},
});
我该如何解决这个问题?
npm version is 6.14.4
React-native version is 0.62.2
react-native-tab-view: "^2.15.0"
react-native-gesture-handler: "^1.6.1"
react-native-reanimated: "^1.10.1"
@react-native-community/masked-view: "^0.1.10"