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

[Android] textAlignVertical doesn't work on nested text #18790

Closed
3 tasks done
megantracy93 opened this issue Apr 10, 2018 · 10 comments
Closed
3 tasks done

[Android] textAlignVertical doesn't work on nested text #18790

megantracy93 opened this issue Apr 10, 2018 · 10 comments
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@megantracy93
Copy link

textAlignVertical works fine when set on the top-most Text component. However, if you have any nested texts (a common use case), you can not override the alignVertical in the child Text component.

Environment

OS: macOS Sierra 10.12.6
Node: 9.3.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 2.3.3

Packages: (wanted => installed)
react: 16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.55.0 => 0.55.0

Steps to Reproduce

  1. Use this expo app OR create a nested Text component with the same height as its parent & give it a textAlignVertical

Expected Behavior

The child Text's textAlignVertical should be honored.

Actual Behavior

The child Text's textAlignVertical is NOT honored. See screenshots below for two different cases:

textAlignVertical on parent Text textAlignVertical on child Text
screen shot 2018-04-10 at 12 45 05 pm screen shot 2018-04-10 at 12 44 47 pm
@react-native-bot react-native-bot added the Platform: Android Android applications. label Apr 10, 2018
@stale
Copy link

stale bot commented Jul 9, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 9, 2018
@n-kumari
Copy link

This issue still exists in React Native 0.55.2

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 19, 2018
@soyanakagawa
Copy link
Contributor

soyanakagawa commented Aug 5, 2018

Version 0.56.0

Parent Component have high priority than Nested Text.
So Child component's Text style props is ignored.

I think it should reverse. Child component should have more high priority than parent.

@hoda-oz
Copy link

hoda-oz commented Aug 5, 2018

@megantracy93
Even if Text components are nested in other Text components,
they are merged into a single TextView of Android
So you cannot manipulate text position in nested Text components.

In this case, you can manipulate vertical position by lineHeight property.

@stale
Copy link

stale bot commented Nov 3, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 3, 2018
@burkeshartsis
Copy link

Still a meaningful issue. Please fix 😘

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 3, 2018
@megantracy93
Copy link
Author

@hoda-oz lineHeight is not the correct property for my use case as I have a multi-line string that should be center-aligned. Using lineHeight on a multi-line string results in each line having that height, rather than the combination of all the lines.

@thekevinbrown
Copy link

A coping strategy for anyone that finds this is wrapping the <Text> with another <View>, e.g.

<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
    <Text>Whatever here</Text>
</View>

In this case even multiline text is correctly centred in the view. It'd certainly be easier if textAlignVertical worked, but this might help you in the meantime.

@stale
Copy link

stale bot commented Oct 30, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 30, 2019
@stale
Copy link

stale bot commented Nov 6, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 6, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

8 participants