Skip to content
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

Long title text overflow everywhere #124

Open
tomsdev opened this issue Dec 21, 2015 · 16 comments
Open

Long title text overflow everywhere #124

tomsdev opened this issue Dec 21, 2015 · 16 comments

Comments

@tomsdev
Copy link

tomsdev commented Dec 21, 2015

If you use a long title it doesn't truncate and instead overflow (because in your component style you use absolute positioning and doesn't set 'numberOfLines' on the Text component).
See:
screen shot 2015-12-21 at 5 09 28 pm

@grabbou
Copy link
Collaborator

grabbou commented Dec 23, 2015

Well, what's your expected behaviour? I would say that should be truncated on your side with e.g. title.substring(0,10) etc. if you are not sure about the length.

On the other hand - we could just set it up properly so there's native ... added at the end and no multiline text is rendered.

@Kureev
Copy link
Owner

Kureev commented Dec 23, 2015

@grabbou I'll add numberOfLines to the <Text /> element

@tomsdev
Copy link
Author

tomsdev commented Dec 23, 2015

Sorry I didn't set expectations, I think normally you want to have the text truncated with '...' At the end. It's not possible to use substring because you don't know the width available and the character size. I suggested to use numberOfLines and remove the absolute positioning.

@Kureev
Copy link
Owner

Kureev commented Feb 5, 2016

Sorry for the very late response, but can you compose a PR?

@grabbou
Copy link
Collaborator

grabbou commented Feb 9, 2016

@ex/navigator truncates, so I think we could also

@breadadams
Copy link

Any news on this? Running into the same issue with long titles

@ngankt2
Copy link

ngankt2 commented Oct 14, 2016

You can set maxHeight in style for Text
exp: <Text style={{maxHeight:22}}>blbalbalba very long over here</Text>
Or: <Text numberOfLines={1}>blbalbalba long text<Text> => will show '...'

@breadadams
Copy link

Has there been an update for this @ngankt2? I'm sure I tried numberOfLines={1}, but the text still went behind back button.

@johncblandii
Copy link

Bump...

@chetstone
Copy link
Contributor

chetstone commented Dec 3, 2016

I'm trying to use adjustsFontSizeToFit (RN >= 0.33) with a custom title component. It kind of works but the title is very short. It seems the default styles of this component provide equal space for the title and left and right buttons. I'd like the title to use more space. How can I specify that?

screen shot 2016-12-02 at 17 08 56

@Kureev
Copy link
Owner

Kureev commented Dec 3, 2016

IIRC, we using absolute positioning for the title, so no boundaries for the text, unless you specify them by yourself

@chetstone
Copy link
Contributor

chetstone commented Dec 3, 2016 via email

@Kureev
Copy link
Owner

Kureev commented Dec 3, 2016

Yeah, it's a tricky one. I can refactor position: absolute to flexbox, but I'm not sure if it'll help anyhow. Wdyt?

@chetstone
Copy link
Contributor

@Kureev Thanks. I tried several changes but finally got it to work by adding width and height props to the <Text> component that has the adjustsFontSizeToFit prop. Without any changes to 'react-native-navbar`.

Thanks
chester

@ngankt2
Copy link

ngankt2 commented Dec 5, 2016

@breadadams
<Text style={{flex:1}} numberOfLines={1}>LONG TEXT....</Text>

@Kureev
Copy link
Owner

Kureev commented Dec 14, 2016

Thanks, @ngankt2.

Should we make it default for the title? Can somebody compose a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants