Skip to content

alignContent default value #2746

@rosko

Description

@rosko

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

In <View> component's alignContent style property, react-native-web uses the CSS default value of stretch instead of flex-start (according to Yoga layout engine that RN uses)

Expected behavior

I guess it should be either fixed or at least documented.

Steps to reproduce

import { Text, SafeAreaView, StyleSheet, View } from 'react-native';

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.view}>
        <Text style={styles.block}>Text 1</Text>
        <Text style={styles.block}>Text 2</Text>
      </View>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
  view: {
    flexWrap: 'wrap',
    // alignContent: 'flex-start',
    width: '100%',
    height: 100,
    gap: 20,
    backgroundColor: 'lightcyan',
  },
  block: {
    width: 100,
    height: 100,
    backgroundColor: 'darkseagreen',
  },
});

Test case

https://snack.expo.dev/@rosko/view-aligncontent-default-value

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions