Rendering error on `Tabs` when `initialPage` is not `0`
react-native, react and native-base version
React Native: 0.48.4.
React: 16.0.0-alpha.12.
Native Base: 2.3.3.
Steps to reproduce (code snippet or screenshot)
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {
Container,
Tabs,
Tab,
} from 'native-base';
export default class App extends React.Component {
render() {
return (
<Container>
<Tabs initialPage={1}>
<Tab heading="Tab 1">
<Text>1</Text>
</Tab>
<Tab heading="Tab 2">
<Text>2</Text>
</Tab>
<Tab heading="Tab 3">
<Text>3</Text>
</Tab>
</Tabs>
</Container>
);
}
};
Result:

However, when I add a padding to the parent (<Container style={{paddingHorizontal: 10}}>), it works fine:

Is the bug present in both ios and android or in any one of them?
Both.
I'm seeing the same thing with
"react-native": "^0.48.4",
"native-base": "^2.3.2",
"react": "^16.0.0",
Temporary workaround but it works (RN: 0.48): "expo": "^21.0.0", "moment": "^2.18.1", "native-base": "^2.3.2", "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz"
XXX = src/dist in node_modules/native-base/XXX/basic/tabs/index.js Replace:
if (this.scrollView && Platform.OS === "android") {
const x = this.props.initialPage * this.state.containerWidth;
this.scrollView.scrollTo({ x, animated: false });
}
with:
if (this.scrollView) {
const x = this.props.initialPage * this.state.containerWidth;
this.scrollView.scrollTo({ x, animated: false });
}
@ziudeso solution helps with selecting correct tab, but my problems is that the view is not drawn, and I have to touch and move the screen before data in Tab is visible (initial load only). Tabs are nested in a TabNavigator, and they are the second tab in TabNavigator
"@expo/samples": "^2.0.2",
"expo": "^22.0.0",
"moment": "^2.19.1",
"native-base": "^2.3.2",
"react": "16.0.0-beta.5",
"react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz",
"react-navigation": "^1.0.0-beta.15",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
lazy: true on the TabNavigator is a temporary fix to this issue
Is the bug present in both ios and android or in any one of them? Only IOS
#1010
i have issue related to Tabs. Can u help me??
@vijaya06 What is it
@vijaya06 Check for Tabs issues, if you could get any help from it Else go ahead and raise issue
This issue is not fixed in native-base version 2.3.10.
Same here for [email protected] and [email protected]