Currency is the base of every country and based on its global price country growth is decided using currency. Every big country has its own currency format like United states of America has Dollar($), India has Rupees ₹, European countries has Euro(€), Japan has Japanese Yen and United Kingdom has Pound sterling(£). So in this tutorial we would going to Add Show Dollar Rupees Euro Pound Currency Symbols and Japanese Yen in iOS Android react native applications using HTML Uni codes.
Contents in this project Add Show Dollar Rupees Euro Pound Currency Symbols in iOS Android React Native App:
Note: We are using the HTML Uni Codes in this tutorial and can add any symbols according to your country, Simply goto Google and search for your country currency Uni Code.
1. Import StyleSheet, Platform, View and Text component in your project.
1
2
3
|
import React, { Component } from ‘react’;
import { StyleSheet, Platform, View, Text } from ‘react-native’;
|
2. Create a Root View in render’s return block and inside it we would make 5 Text components and each of them includes a Unique Unicode of a currency.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
return (
<View style={styles.MainContainer}>
<Text style={styles.text}> Doller = {‘u0024’} </Text>
<Text style={styles.text}> Rupees = {‘u20B9’} </Text>
<Text style={styles.text}> Euro = {‘u20AC’} </Text>
<Text style={styles.text}> Japanese yen = {‘u00A5’} </Text>
<Text style={styles.text}> Pound sterling = {‘u00A3’} </Text>
</View>
);
}
|
3. Create Style.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
const styles = StyleSheet.create({
MainContainer :{
flex:1,
paddingTop: (Platform.OS) === ‘ios’ ? 20 : 0,
alignItems: ‘center’,
justifyContent: ‘center’,
},
text:{
color: ‘#000’,
fontSize: 22
}
});
|
4. Complete source code for App.js File :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import React, { Component } from ‘react’;
import { StyleSheet, Platform, View, Text } from ‘react-native’;
export default class App extends Component{
render() {
return (
<View style={styles.MainContainer}>
<Text style={styles.text}> Doller = {‘u0024’} </Text>
<Text style={styles.text}> Rupees = {‘u20B9’} </Text>
<Text style={styles.text}> Euro = {‘u20AC’} </Text>
<Text style={styles.text}> Japanese yen = {‘u00A5’} </Text>
<Text style={styles.text}> Pound sterling = {‘u00A3’} </Text>
</View>
);
}
}
const styles = StyleSheet.create({
MainContainer :{
flex:1,
paddingTop: (Platform.OS) === ‘ios’ ? 20 : 0,
alignItems: ‘center’,
justifyContent: ‘center’,
},
text:{
color: ‘#000’,
fontSize: 22
}
});
|
Screenshots in Android device:
Screenshot in iOS device: