Home > Back-end >  Not able to see text in IOS and Android. (React Native)
Not able to see text in IOS and Android. (React Native)

Time:02-21

Not able to see text in IOS and Android. (React Native)

Hi

I was making an app and added text on HomeScreen. I am getting the text in Web but am not able to get it in Android and IOS. This is the Code:

render(){
let pulse = <Image source={require('../pulse.png')} style={styles.pulse} />
    
      return (
        <SafeAreaView style={styles.container}>
        <View>
          <StatusBar barStyle="dark-content" />

          <View style={{ flex: 0.4, resizeMode: 'contain' }}>
            <Text style={styles.appName}>L{pulse}blood</Text>
          </View>

        </View>
        </SafeAreaView>
}

These are the styles

  container: {
    flex: 1,
    backgroundColor: 'white',
  },
  appName: {
    alignSelf: 'center',
    fontFamily: 'oswald',
    fontSize: 50,
    color: 'black',
    height: '100%'
  }

CodePudding user response:

You need to remove the flex prop of the child view. Change

<View style={{ flex: 0.4, resizeMode: 'contain' }}>
   <Text style={styles.appName}>L{pulse}blood</Text>
</View>

to

<View style={{ resizeMode: 'contain' }}>
   <Text style={styles.appName}>L{pulse}blood</Text>
</View>
  • Related