Saad Maqbool
Saad Maqbool

Reputation: 295

Styling not working in all text view in react native

Below is the code snippet of my screen, styling is working perfectly on 2 text views but not on the last one. Can anyone help me?

<View style={styles.userInfo}>
        <View style={styles.section}>
          <Text style={[header3,styles.space,baseColor]}>{this.state.data.postCount}</Text>
          <Text style={[secondary1, hintColor]}>Posts</Text>
        </View>
        <View style={styles.section}>
          <Text style={[header3,styles.space,baseColor]}>{formatNumber(this.state.data.followersCount)}</Text>
          <Text style={[secondary1, hintColor]}>Followers</Text>
        </View>
        <View style={styles.section}>
          <Text styles={[header3,styles.space,baseColor]}>{this.state.data.followingCount}</Text>
          <Text style={[secondary1, hintColor]}>Following</Text>
        </View>
      </View>
      <Gallery items={this.state.data.images} />
    </ScrollView>

Upvotes: 3

Views: 165

Answers (3)

ZubairHasan
ZubairHasan

Reputation: 175

You have mistakenly wrote styles instead of style i.e.:

<Text **styles**={[header3,styles.space,baseColor]}>{this.state.data.followingCount}</Text>
      <Text style={[secondary1, hintColor]}>Following</Text>
    </View>

Upvotes: 1

oma
oma

Reputation: 1894

Typo, styles, first Text

 <View style={styles.section}>
          <Text styles={[header3,styles.space,baseColor]}>{this.state.data.followingCount}</Text>
          <Text style={[secondary1, hintColor]}>Following</Text>
 </View>

Upvotes: 2

Ahsan Sohail
Ahsan Sohail

Reputation: 670

You have extra s in the last text style

try this

<View style={styles.userInfo}>
        <View style={styles.section}>
          <Text style={[header3,styles.space,baseColor]}>{this.state.data.postCount}</Text>
          <Text style={[secondary1, hintColor]}>Posts</Text>
        </View>
        <View style={styles.section}>
          <Text style={[header3,styles.space,baseColor]}>{formatNumber(this.state.data.followersCount)}</Text>
          <Text style={[secondary1, hintColor]}>Followers</Text>
        </View>
        <View style={styles.section}>
          <Text style={[header3,styles.space,baseColor]}>{this.state.data.followingCount}</Text>
          <Text style={[secondary1, hintColor]}>Following</Text>
        </View>
      </View>
      <Gallery items={this.state.data.images} />
    </ScrollView>

Upvotes: 2

Related Questions