Skip to content

Inconsistency in the behavior of the Text component between native and web #2818

@exzos28

Description

@exzos28

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

Image Image
export default function App() {
  return (
    <View style={styles.container}>
      <Text>
        Change code in the editor and watch
      </Text>
      <Text>
        Change code in the editor and watch
      </Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
  },
});

Expected behavior

Text is rendered and compressed identically to native.

Steps to reproduce

https://snack.expo.dev/@exzos28/dda754

Test case

https://snack.expo.dev/@exzos28/dda754?platform=web

Additional comments

With flexDirection: ‘row’ in the parent component, child elements (text) behave differently.

It appears that flexShrink: 0, which is the default in React Native, is omitted for Text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions