Home > Net >  react native : How to increase the font?
react native : How to increase the font?

Time:11-16

In my example I want to increase the font of the variables What is the way to increase the font of elem.Sampling_Method_Code in my case ?

var digumMethods = '';
    execDetailData.forEach((elem) => {
      digumMethods = digumMethods   '\n'   elem.Sampling_Method_Code   '\n'   elem.Parameters_String   '\n'  __________'   '\n';
    });

CodePudding user response:

This one can help

const bigTextElement = (text) => <Text style={{fontSize:20}}>{text}</Text>;

var digumMethods = '';
    execDetailData.forEach((elem) => {
      digumMethods = bigTextElement(digumMethods)   '\n'   elem.Sampling_Method_Code   '\n'   elem.Parameters_String   '\n'  __________'   '\n';
    });

CodePudding user response:

You can nest Text elements (sample).

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import Constants from 'expo-constants';

export default function App() {
  return (
    <View style={styles.container}>
      <Text style={styles.smallText}>
        Small text <Text style={styles.bigText}>Bigger text</Text> Small Text
      </Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
  smallText: {
    margin: 24,
    fontSize: 18,
    fontWeight: 'bold',
    textAlign: 'center',
    color: '#ff0000'
  },
  bigText: {
    margin: 24,
    fontSize: 38,
    fontWeight: 'bold',
    textAlign: 'center',
    color: '#000000'
  },
});
  • Related