-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NavigatorIOS component not visible when used within TabBarIOS #759
Comments
I think this may be an issue with your styles as I have been able to implement what you are trying. Try this out and see if it comes into view: var styles = StyleSheet.create({
// ...
view: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
}
// ...
}); |
Thanks for the suggestion, but it didn't have any effect. Maybe share a simplified version of your implementation? |
Got the same problem here with a simpler version maybe : 'use strict';
var React = require('react-native');
var {
AppRegistry,
TabBarIOS,
NavigatorIOS,
View,
Text,
} = React;
var myPage = React.createClass({
render: function () {
return (
<View>
<Text>Hello</Text>
<Text>World</Text>
</View>
)
}
})
var tabBar = React.createClass({
render: function() {
return (
<TabBarIOS>
<TabBarIOS.Item title="React Native" selected={true}>
<NavigatorIOS initialRoute={{ title: 'React Native', component: myPage }} />
</TabBarIOS.Item>
</TabBarIOS>
);
}
});
AppRegistry.registerComponent('tabBar', () => tabBar); Thanks |
The View that NavigatorIOS creates has no dimensions, toss a style that has {flex: 1} on it, and paddingTop: 64, flex: 1 on the myPage View and you'll be all set :)
|
@nickhudkins Good solution, thanks! I am facing this issue too. But the |
@nickhudkins Good catch. Thanks ! 'use strict';
var React = require('react-native');
var {
AppRegistry,
TabBarIOS,
NavigatorIOS,
View,
Text,
StyleSheet
} = React;
var myPage = React.createClass({
render: function () {
return (
<View style={styles.myPage}>
<Text>Hello</Text>
<Text>World</Text>
</View>
)
}
})
var tabBar = React.createClass({
render: function() {
return (
<TabBarIOS>
<TabBarIOS.Item title="React Native" selected={true}>
<NavigatorIOS style={styles.nav} initialRoute={{ title: 'React Native', component: myPage }} />
</TabBarIOS.Item>
</TabBarIOS>
);
}
});
var styles = StyleSheet.create({
nav: {
flex: 1
},
myPage: {
flex: 1,
backgroundColor: 'orange',
paddingTop: 64
}
});
AppRegistry.registerComponent('tabBar', () => tabBar); I think this is a little tricky anyway, and before closing this issue, maybe we can improve this ? This is problematic i think for new users, because, this is basically the first example of React Native code you will see on the http://facebook.github.io/react-native/ website :) ! thanks all |
This is clearly a documentation issue; #504 is also related to this. As of now, the Closing this. |
@hacksparrow Aside from the docs issue, @tjwudi has a good point about |
@elado, 64 may be a magic number in this case, but, the ability to place content under the header (since translucency is now a thing) is a feature and therefore the developer should be responsible for ensuring what content should display unobstructed by the header. It is a documented number, and not one that is worth querying for unless apple plans on releasing a new nav bar height sometime soon. (In my personal opinion). If this number COULD vary I would say let's do something different but I believe it can be treated effectively as a constant. That is, until apple releases iOS 12 and all of this goes out the window ;) |
64 is just a magic number. It'll probably cause problems in future cases. You could solve the issue by wrapping the View within ScrollView in the render function.
|
@nickhudkins Thanks for saving my time. |
The
NavigatorIOS
component is rendered but not visible when used withinTabBarIOS
. However, it is visible in the Chrome and Xcode debuggers.Rendered App
Chrome Debugger View
Xcode Captured View Hierarchy
App Code
The text was updated successfully, but these errors were encountered: