Commit da32c7b3 by Giang Tran

update code

parent 50e3b252
...@@ -14,6 +14,7 @@ import AppText from '../components/AppText'; ...@@ -14,6 +14,7 @@ import AppText from '../components/AppText';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import {DETAILNEW, TABNAVIGATOR, AUTHEN} from '../routers/ScreenNames'; import {DETAILNEW, TABNAVIGATOR, AUTHEN} from '../routers/ScreenNames';
import R from '../assets/R'; import R from '../assets/R';
import {isTablet} from 'react-native-device-info';
export const logout = (navigation) => { export const logout = (navigation) => {
AsyncStorage.clear(); AsyncStorage.clear();
...@@ -186,7 +187,11 @@ export const WIDTH = (w) => width * (w / 360); ...@@ -186,7 +187,11 @@ export const WIDTH = (w) => width * (w / 360);
export const HEIGHT = (h) => height * (h / 640); export const HEIGHT = (h) => height * (h / 640);
export const getLineHeight = (f) => f; export const getLineHeight = (f) => f;
export const getFont = (f) => f - 1; export const getFont = (f) => f - 1;
export const WIDTHXDICON = (w) => width * (w / 1125);
export const WIDTHXDICON = (w) =>
isTablet() ? (width * (w / 1125)) / 1.5 : width * (w / 1125);
export const HEIGHTXDICON = (h) =>
isTablet() ? (height * (h / 2436)) / 1.5 : height * (h / 2436);
export const validatePhone = (str) => { export const validatePhone = (str) => {
let re = /^[0-9+]{9,11}$/; let re = /^[0-9+]{9,11}$/;
......
...@@ -12,7 +12,7 @@ const styles = StyleSheet.create({ ...@@ -12,7 +12,7 @@ const styles = StyleSheet.create({
borderRadius: 5, borderRadius: 5,
height: HEIGHTXD(400), height: HEIGHTXD(400),
marginTop: 25, marginTop: HEIGHTXD(70),
borderBottomColor: R.colors.borderGray, borderBottomColor: R.colors.borderGray,
borderTopColor: R.colors.borderGray, borderTopColor: R.colors.borderGray,
shadowColor: '#000', shadowColor: '#000',
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
} from 'react-native'; } from 'react-native';
import R from '../../../assets/R'; import R from '../../../assets/R';
import LinearGradient from 'react-native-linear-gradient'; import LinearGradient from 'react-native-linear-gradient';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD, HEIGHTXD, WIDTHXD} from '../../../Config/Functions';
import Block from '../../../components/Block'; import Block from '../../../components/Block';
import Icon from 'react-native-vector-icons/AntDesign'; import Icon from 'react-native-vector-icons/AntDesign';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
...@@ -83,7 +83,7 @@ const MediaView = (props) => { ...@@ -83,7 +83,7 @@ const MediaView = (props) => {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
containerTop: { containerTop: {
height: 300, height: HEIGHTXD(850),
width: '100%', width: '100%',
}, },
contentTop: { contentTop: {
...@@ -97,10 +97,10 @@ const styles = StyleSheet.create({ ...@@ -97,10 +97,10 @@ const styles = StyleSheet.create({
textDecorationLine: 'underline', textDecorationLine: 'underline',
}, },
containerBtn: { containerBtn: {
paddingHorizontal: 15, width: WIDTHXD(380),
paddingVertical: 5,
backgroundColor: '#1C6AF6', backgroundColor: '#1C6AF6',
borderRadius: 5, height: HEIGHTXD(120),
borderRadius: HEIGHTXD(30),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
flexDirection: 'row', flexDirection: 'row',
......
...@@ -3,7 +3,7 @@ import React, {Component} from 'react'; ...@@ -3,7 +3,7 @@ import React, {Component} from 'react';
import {View, Text, StyleSheet, Image, TouchableOpacity} from 'react-native'; import {View, Text, StyleSheet, Image, TouchableOpacity} from 'react-native';
import Block from '../../../components/Block'; import Block from '../../../components/Block';
import Icon from 'react-native-vector-icons/AntDesign'; import Icon from 'react-native-vector-icons/AntDesign';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD, HEIGHTXD} from '../../../Config/Functions';
import R from '../../../assets/R'; import R from '../../../assets/R';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
import {DETAILNEW} from '../../../routers/ScreenNames'; import {DETAILNEW} from '../../../routers/ScreenNames';
...@@ -49,7 +49,7 @@ const styles = StyleSheet.create({ ...@@ -49,7 +49,7 @@ const styles = StyleSheet.create({
color: '#A2A2A2', color: '#A2A2A2',
}, },
img: { img: {
height: 180, height: HEIGHTXD(500),
borderRadius: 10, borderRadius: 10,
marginTop: 5, marginTop: 5,
}, },
......
...@@ -12,7 +12,7 @@ import { ...@@ -12,7 +12,7 @@ import {
Alert, Alert,
} from 'react-native'; } from 'react-native';
import R from '../../assets/R'; import R from '../../assets/R';
import {getFontXD, HEIGHT, WIDTHXD} from '../../Config/Functions'; import {getFontXD, getWidth, HEIGHT, WIDTHXD} from '../../Config/Functions';
import LinearGradient from 'react-native-linear-gradient'; import LinearGradient from 'react-native-linear-gradient';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {HEIGHTXD, toPriceVnd} from '../../Config/Functions'; import {HEIGHTXD, toPriceVnd} from '../../Config/Functions';
...@@ -281,7 +281,7 @@ const HeaderHome = (props) => { ...@@ -281,7 +281,7 @@ const HeaderHome = (props) => {
renderActions(onClickDetail) renderActions(onClickDetail)
) : ( ) : (
<View style={{justifyContent: 'center', alignItems: 'center'}}> <View style={{justifyContent: 'center', alignItems: 'center'}}>
<View style={{width: 30, height: 20}}> <View style={{width: HEIGHTXD(80), height: HEIGHTXD(60)}}>
<TouchableOpacity <TouchableOpacity
onPress={onClickDetail} onPress={onClickDetail}
style={styles.containerBtn}> style={styles.containerBtn}>
...@@ -318,13 +318,14 @@ const styles = StyleSheet.create({ ...@@ -318,13 +318,14 @@ const styles = StyleSheet.create({
}, },
containerBtn: { containerBtn: {
position: 'absolute', position: 'absolute',
width: 30, width: HEIGHTXD(80),
height: 30, height: HEIGHTXD(80),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: R.colors.white, backgroundColor: R.colors.white,
borderRadius: 20, borderRadius: HEIGHTXD(80),
top: 5, top: HEIGHTXD(20),
shadowColor: '#000', shadowColor: '#000',
shadowOffset: { shadowOffset: {
width: 0, width: 0,
...@@ -343,7 +344,7 @@ const styles = StyleSheet.create({ ...@@ -343,7 +344,7 @@ const styles = StyleSheet.create({
}, },
containerTop: { containerTop: {
backgroundColor: 'white', backgroundColor: 'white',
width: '90%', width: getWidth() - 40,
borderRadius: 10, borderRadius: 10,
shadowColor: '#000', shadowColor: '#000',
shadowOffset: { shadowOffset: {
......
...@@ -10,7 +10,7 @@ import { ...@@ -10,7 +10,7 @@ import {
} from 'react-native'; } from 'react-native';
import Icon from 'react-native-vector-icons/Entypo'; import Icon from 'react-native-vector-icons/Entypo';
import R from '../assets/R'; import R from '../assets/R';
import {HEIGHTXD, WIDTHXD, getFontXD} from '../Config/Functions'; import {HEIGHTXD, WIDTHXD, getFontXD, WIDTHXDICON} from '../Config/Functions';
import Modal from 'react-native-modal'; import Modal from 'react-native-modal';
import {useNavigation} from '@react-navigation/native'; import {useNavigation} from '@react-navigation/native';
...@@ -37,7 +37,7 @@ const PlussModal = (props) => { ...@@ -37,7 +37,7 @@ const PlussModal = (props) => {
<View style={styles.container}> <View style={styles.container}>
<View style={styles.wraper}> <View style={styles.wraper}>
<TouchableOpacity onPress={toggleModal} style={styles.btn}> <TouchableOpacity onPress={toggleModal} style={styles.btn}>
<Icon name={'plus'} size={27} color={R.colors.white} /> <Icon name={'plus'} size={HEIGHTXD(60)} color={R.colors.white} />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
...@@ -95,8 +95,8 @@ export default PlussModal; ...@@ -95,8 +95,8 @@ export default PlussModal;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
btn: { btn: {
backgroundColor: R.colors.main, backgroundColor: R.colors.main,
width: WIDTHXD(144), width: WIDTHXDICON(135),
height: WIDTHXD(144), height: WIDTHXDICON(135),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
shadowColor: '#000', shadowColor: '#000',
...@@ -107,21 +107,21 @@ const styles = StyleSheet.create({ ...@@ -107,21 +107,21 @@ const styles = StyleSheet.create({
shadowOpacity: 0.25, shadowOpacity: 0.25,
shadowRadius: 3.84, shadowRadius: 3.84,
elevation: 3, elevation: 3,
borderRadius: 30, borderRadius: WIDTHXDICON(144),
}, },
container: { container: {
flex: 1, flex: 1,
}, },
wraper: { wraper: {
backgroundColor: R.colors.white, backgroundColor: R.colors.white,
width: WIDTHXD(160), width: WIDTHXDICON(144),
height: WIDTHXD(160), height: WIDTHXDICON(144),
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
position: 'absolute', position: 'absolute',
top: -20, top: -HEIGHTXD(45),
left: 15, left: 15,
borderRadius: WIDTHXD(90), borderRadius: WIDTHXDICON(90),
}, },
footer: { footer: {
backgroundColor: 'white', backgroundColor: 'white',
......
...@@ -23,6 +23,7 @@ import {changeLanguage} from '../actions/language'; ...@@ -23,6 +23,7 @@ import {changeLanguage} from '../actions/language';
import KEY from '../assets/AsynStorage'; import KEY from '../assets/AsynStorage';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import {DETAILNEW} from '../routers/ScreenNames'; import {DETAILNEW} from '../routers/ScreenNames';
import {getHeight, getWidth} from '../Config/Functions';
const Tab = createBottomTabNavigator(); const Tab = createBottomTabNavigator();
...@@ -31,6 +32,7 @@ const PayScreenComponent = () => { ...@@ -31,6 +32,7 @@ const PayScreenComponent = () => {
}; };
const TabNavigator = (props) => { const TabNavigator = (props) => {
console.log(getHeight(), getWidth());
const navigate = useNavigation(); const navigate = useNavigation();
useEffect(() => { useEffect(() => {
setInitLanguage(); setInitLanguage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment