Horizontal with items starting on the left
See original GitHub issueI have been going crazy trying to adjust the slider so that the items start on the left side of the container. No mater what I try the items start centred. Here is a screenshot:
Here are the styles:
import { Dimensions } from 'react-native';
const { width: viewportWidth, height: viewportHeight } = Dimensions.get('window');
function wp(percentage) {
const value = (percentage * viewportWidth) / 100;
return Math.round(value);
}
const slideHeight = viewportHeight * 0.4;
const slideWidth = wp(36);
const itemHorizontalMargin = wp(2);
export const sliderWidth = viewportWidth;
export const itemWidth = slideWidth + itemHorizontalMargin * 2;
export default {
container: {
flex: 3,
paddingLeft: 0,
paddingBottom: 20,
},
slide: {
flex: 1,
height: slideHeight,
width: itemWidth,
justifyContent: 'center',
paddingHorizontal: itemHorizontalMargin,
},
title: {
fontSize: 13,
marginBottom: 10,
marginLeft: 15,
},
slideText: {
color: 'white',
fontSize: 13,
alignSelf: 'center',
},
};
I have tried aligning the items with containerCustomStyle
and contentContainerCustomStyle
but also no luck there.
Would really appreciate any guidance on this.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Left align elements of horizontal list - html - Stack Overflow
However, I am having trouble trying to left align the list, so that the first element is flush left with left side of...
Read more >Aligning items in a flex container - CSS: Cascading Style Sheets
This means that the main axis runs along the row horizontally, ... The left and right item line up flush with the start...
Read more >Align items on the left - TeX - LaTeX Stack Exchange
1 Answer 1 ; \documentclass{article} \usepackage ; \documentclass{article} \usepackage ; \begin{itemize}[labelsep=*,leftmargin=1pc] \documentclass ...
Read more >Bootstrap Horizontal alignment - examples & tutorial
Bootstrap 5 horizontal alignment utilities position elements on the x-axis. ... it to the start or the end of the viewport (left alignment...
Read more >Horizontal Alignment in CSS – How to Align Elements in CSS
HTML and CSS are the first things we learn when we start Web ... We'll observe that the text gets horizontally aligned to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<Carousel activeSlideAlignment=‘start’ … />
Hi @stueynet,
I think you’ll be very pleased to know that the
flatlist
branch contains just what you need (check propactiveSlideAlignment
).Note that the updated example also features a left-aligned slider, as you can see below.