react-native-onboarding-swiper icon indicating copy to clipboard operation
react-native-onboarding-swiper copied to clipboard

Page flex properties

Open juiceo opened this issue 6 years ago • 5 comments

Currently the page children (image, title, subtitle) seem to be justified to center on the screen. Is there any way to align them to the top of the page?

juiceo avatar Aug 06 '18 12:08 juiceo

Same request. I have pages with different length subtitles and the icons and title don't align between pages/screens. This is visible when you swipe between them.

I assume passing an extra Page's style props would be enough to overwrite those

gianpaj avatar Sep 20 '18 08:09 gianpaj

+1

rsmelo92 avatar Sep 28 '18 04:09 rsmelo92

A workaround I tried gave each of the text components (Header, and Subtitle) pre-defined heights and the ImageContainer flex: 1. It keeps the text always in the same spot.

<Onboarding 
imageContainerStyles={{paddingBottom: 0, flex: 1, justifyContent: 'flex-end',}}
pages={[
  {
    backgroundColor: '#fff',
    image: <Image style={{your image styles}} source={require('./logo.png')} />,
    title: <Text style={{...your header text styles, minHeight: '10%'}}>Header</Text>,
    subtitle: <Text style={{...your caption text styles, height: '30%'}}>Caption caption caption</Text>
  }, ...
]}
/>

lowewenzel avatar Oct 20 '18 23:10 lowewenzel

The current implementation has a weak spot there. I hope the example of @lowewenzel with custom components helps.

I couldn't figure out a structure that would work in all circumstances. If somebody has better ideas, I am happy to accept PRs. 😎

jfilter avatar Oct 21 '18 17:10 jfilter

Hi there. I've just created PR that addresses this issue. It lets you do the following to give you more control over the positioning of the title/subtitle elements on the screen:

<Onboarding
  containerStyles={{
    justifyContent: "flex-start",
    alignItems: "flex-start"
  }}
/>

marcelkalveram avatar Oct 30 '18 22:10 marcelkalveram