Skip to content

[Android] Style (fontWeight, fontStyle) inheritance on nested Text component breaks #33431

@parveen-bhatia

Description

@parveen-bhatia

Description

On nesting Text component styles like fontWeight and fontStyle are not getting inherited from parent Text component.

Example:1
With below snippet only bold is getting applied

      <View>
        <Text style={{ fontStyle: 'italic' }}>
          <Text style={{ fontWeight: 'bold' }}>I am italic and bold</Text>
        </Text>
      </View>

Example:2
With below snippet only italic is getting applied

      <View>
        <Text style={{ fontWeight: 'bold' }}>
          <Text style={{ fontStyle: 'italic' }}>I am bold and italic</Text>
        </Text>
      </View>

This bug is Android only, it works fine on iOS.

Version

0.67.3

Output of npx react-native info

System:
OS: macOS 11.6.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 2.90 GB / 32.00 GB
Shell: 5.1.8 - /usr/local/bin/bash
Binaries:
Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
Watchman: 2021.11.01.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Users/parveen.bhatia/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 21, 28, 29, 30, 31
Build Tools: 29.0.2, 30.0.1, 30.0.2
System Images: android-23 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Arctic Fox 2020.3.1 Patch 2 Arctic Fox 2020.3.1 Patch 2
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.3 => 0.67.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  • Create nested text component
  • Apply fontWeight to parent text component
  • Apply fontStyle to child text component
  • fontWeight style is not getting applied to child text component

Snack, code example, screenshot, or link to a repository

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions