0

I'm including a button inside my native base form, but it is not align in center.

<Form>
   ...

   <Item inlineLabel>
      <View style={styles.alignCenter}>
         <Button primary style={styles.btnUpd}><Text> Update </Text></Button>
      </View>
   </Item>
</Form>

My styles:

const styles = StyleSheet.create({
  alignCenter: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center'
  },
  btnUpd: {
    height: 35,
    marginTop: 4,
    marginBottom: 4,
  }
});

I thought I just had to use justifyContent and alignItems center to centralize an object. What am I missing?

Thanks

1 Answer 1

1

Use <Body> tag to set it to center of your screen and for left and right side of screen you could use <Left> and <Right> like this :

<View>
   <Body>
      <Button>
         <Text> Update </Text>
      </Button>
   </Body>
</View>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.