React-native-admob: How to put center?

Created on 18 Sep 2018  路  3Comments  路  Source: sbugert/react-native-admob

I put code.

      <AdMobBanner
        adSize="fullBanner"
        adUnitID="ca-app-pub-00000/0000000"
      />

but, it is not center.

So, I wrote parent View tag.

      <View style={styles.banner}>
        <AdMobBanner
          adSize="fullBanner"
          adUnitID="ca-app-pub-00000/0000000"
        />
      </View>

and style sheet.

const styles = StyleSheet.create({
  banner: {
    justifyContent: 'center',
  }
});

never changed.
notcenter

Most helpful comment

I added style for parentview. It's working
style={{width:'100%', position:'absolute', justifyContent: "center", alignItems: "center"}}

All 3 comments

With me this problem also happens. Has anyone found a solution?

With me this problem also happens. Has anyone found a solution?

use alignItems too, try this styles:
banner: { justifyContent: "center", alignItems: "center" }

I added style for parentview. It's working
style={{width:'100%', position:'absolute', justifyContent: "center", alignItems: "center"}}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vu-dang picture vu-dang  路  5Comments

ozmaat picture ozmaat  路  3Comments

priya-vr picture priya-vr  路  3Comments

furkancelik picture furkancelik  路  5Comments

aligenc picture aligenc  路  3Comments