0

I have a horizontal scrolling ListView of which I'd like to size the items based on the screens width.

I believe I need to use;

const { width } = useWindowDimensions();

but I'm unsure of how to use this inside my StyleSheet

width console logs as correct value.

I was expecting something like;

const styles = StyleSheet.create({
  item: {
    display: "flex",
    flexDirection: "column",
    justifyContent: "flex-end",
    marginHorizontal: 4,
    backgroundColor: "black",
    borderRadius: 3,
    height: { width / 3 },
    width: { width / 3 },
  },
});
TylerH
  • 20,799
  • 66
  • 75
  • 101
David Henry
  • 1,972
  • 20
  • 43

0 Answers0