Comments (15)
We haven't done work on laying out the nav bar contents on Android. So we don't intend for it to look broken, but also haven't worked on making it look good either.
from ex-navigator.
Any idea on the timeline for this or a workaround?
Could renderTitle() be used to fix this in the interim?
from ex-navigator.
As a rough estimate, I imagine we will look into this by the end of December.
from ex-navigator.
I tried quickly playing with the renderTitle
method. It seems like the layout issue is higher up in the component stack.
from ex-navigator.
Hi @ide , any progress on this? Could you point me to the right file to look at this and hopefully provide a PR ?
@masom , @qbig any luck with this?
from ex-navigator.
Here's our workaround that's worked reasonably well:
<ExNavigator
renderNavigationBar={props =>
<Navigator.NavigationBar
{...props}
navigationStyles={Navigator.NavigationBar.StylesIOS}
/>
}
/>
from ex-navigator.
@ide thank you so much for the fast response! Works for me :) @aksonov do you need a PR? I just added
navigationStyles={Navigator.NavigationBar.StylesIOS}
to your ExNavigator
component in ExRouter.js
from ex-navigator.
Is the goal of ex-navigator to make navigation look the same for all platforms?
In our app we are aiming for the "default" android material style, in which case the current code (without the "navigationStyles" code above) is correct. Just tweak renderLeftButton in the Router to render the android back button instead of the iOS back button & text.
from ex-navigator.
@samuelkraft that looks great, could you please share the change you made to renderLeftButton
?
from ex-navigator.
+1
from ex-navigator.
Edit: renderBackButton has been added as a prop to <ExNavigator>
in 0.3.6 - use that instead of renderLeftButton
For the default back button download it here: https://design.google.com/icons/#ic_arrow_back
Then in your router do something like this:
renderLeftButton(navigator) {
if (Platform.OS === 'android') {
return (
<TouchableOpacity
touchRetentionOffset={ExNavigator.Styles.barButtonTouchRetentionOffset}
onPress={() => navigator.pop()}
style={[ExNavigator.Styles.barLeftButton, styles.backButtonAndroid]}>
<Image source={require('./images/backAndroid.png')} />
</TouchableOpacity>
);
}
}
and style the button:
backButtonAndroid: {
paddingLeft: 16,
paddingVertical: 15
},
from ex-navigator.
Thanks @samuelkraft ! @ide what's the Android roadmap like for this? Is the goal to have a conventional Material style for the Android Navigator?
from ex-navigator.
Although everybody know this issue, I'm explaining for newcomers;
Probably as you know, Actually there is no a problem. Because, according to Android navigation design , there is a back button on the top-left corner and the current page title next to the it. And top-right area has been left for other tools like buttons or another title.
https://www.google.com/design/spec/patterns/navigation.html#navigation-usage
Unlike, iOS has a back button and previous screen title on the top-left of the screen. Title is in the middle.
Because of these reasons, I think the approach of @samuelkraft is true.
However, a cross-platform solution would be great.
Actually @ide has succeeded that the auto navigation bar style according to the OS.
If the above differences can handle in the same way, the problem can be eliminated.
For instance;
If the OS is an Android, shown the backAndroid.png and current screen title. Not shown the barLeftButtonText
. The existing code is appropriate to iOS anyway.
from ex-navigator.
@delta1, I tried adding as you said but it didn't work for me. I am using 0.27.
<ExNavigator
initialRoute={YourRouter.getHomeRoute()}
style={{ flex: 1 }}
sceneStyle={{ paddingTop: 64 }}
navigationStyles={Navigator.NavigationBar.StylesIOS}
/>
Am I missing something here?
from ex-navigator.
sorry @sudharsan1988 this was back in 0.16/17 days so I have no idea what's changed. gl hf
from ex-navigator.
Related Issues (20)
- import type * as ExRoute from './ExRoute'; HOT 3
- onWillFocus called for previous route and pushed route
- cannot navigate using navigator.push HOT 1
- renderScene doesn't render the component with latest properties passed to the router
- Are there any plans to wrap Navigator Experimental? HOT 1
- proxy `replacePreviousAndPop` method HOT 2
- problems with UIManager.measure() HOT 4
- Element type is invalid: expected a string HOT 2
- How to make title center in android? HOT 4
- Dude's where's the ex-navigation mentioned at ReactEurope? HOT 5
- Can we use ex-navigator to create slide menu ? HOT 2
- when react-native >=0.27, The code 'import ExNavigator from '@exponent/react-native-navigator' ' is wrong HOT 2
- When hiding the back button on Android, the title is placed odd. HOT 1
- Override Back Button Route HOT 1
- How do I get when the user presses 'back'?
- Two export default lines in ExRouteRenderer.js HOT 1
- Only one default export allowed per module. HOT 1
- getNavigatorByUID() -> "Navigator does not exist" HOT 1
- Hook up navigation bar methods to the scene state and props HOT 2
- onDidFocus inside route component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ex-navigator.