Warning: Failed prop type: The prop initialLayout.height is marked as required in TabView, but its value is undefined. in TabView (at Dashboard.js:23)
Warning: Failed prop type: The prop layout.height is marked as required in TabBar, but its value is undefined. in TabBar (at TabView.js:59) in TabView (at Dashboard.js:23)
Warning: Failed prop type: The prop layout.height is marked as required in PagerAndroid, but its value is undefined. in PagerAndroid (at TabView.js:60) in TabView (at Dashboard.js:23)
No warnings
import React, { Component } from "react";
import { View, StyleSheet, Dimensions } from "react-native";
import { TabView, TabBar, SceneMap } from "react-native-tab-view";
const FirstRoute = () => (
<View style={[styles.scene, { backgroundColor: "#ff4081" }]} />
);
const SecondRoute = () => (
<View style={[styles.scene, { backgroundColor: "#673ab7" }]} />
);
export default class DashBoard extends Component {
state = {
index: 0,
routes: [
{ key: "first", title: "PR脫XIMOS 7 DIAS" },
{ key: "second", title: "TODOS REGISTROS" }
]
};
render() {
return (
<TabView
navigationState={this.state}
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute
})}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get("window").width }}
/>
);
}
}
const styles = StyleSheet.create({
scene: {
flex: 1
}
});
I've just copy the exemple from Readme.md
React Native Environment Info:
System:
OS: Linux 4.19 Manjaro Linux undefined
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Memory: 217.85 MB / 7.58 GB
Shell: 4.4.23 - /bin/bash
Binaries:
Node: 11.6.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/bin/yarn
npm: 6.5.0-next.0 - /usr/local/bin/npm
SDKs:
Android SDK:
API Levels: 23, 26, 27
Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.57.8 => 0.57.8
react-native-tab-view: "1.3.1",
Just modify initialLayout line to look like this:
initialLayout={{ width: Dimensions.get('window').width,height: Dimensions.get('window').height}}/>
It worked for me.
This should be fixed in the readme quickstart guide
Most helpful comment
Just modify initialLayout line to look like this:
initialLayout={{ width: Dimensions.get('window').width,height: Dimensions.get('window').height}}/>It worked for me.