Commit 90712a05 by Giang Tran

Merge branch 'splash' into 08_April

parents 057c8d4e b20a248d
import React from 'react';
import React, {useEffect, useRef, useState} from 'react';
import {Animated, Dimensions, StyleSheet, Text, View} from 'react-native';
import BootSplash from 'react-native-bootsplash';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import rootReducer from './src/Reducers/index';
......@@ -7,16 +8,58 @@ import RootView from './src/RootView';
import createSagaMiddleware from 'redux-saga';
import rootSaga from './src/Saga/rootSaga';
let bootSplashLogo = require('./src/assets/images/iconSplash.png');
let fakeApiCallWithoutBadNetwork = (ms) =>
new Promise((resolve) => setTimeout(resolve, ms));
const sagaMiddleware = createSagaMiddleware();
let store = createStore(rootReducer, applyMiddleware(sagaMiddleware));
sagaMiddleware.run(rootSaga);
const App = () => {
let App = () => {
let init = async () => {
await fakeApiCallWithoutBadNetwork(1000);
await BootSplash.hide();
};
useEffect(() => {
init();
}, []);
return (
<Provider store={store}>
<RootView />
</Provider>
<View style={styles.container}>
<Provider store={store}>
<RootView />
</Provider>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
text: {
fontSize: 24,
fontWeight: '700',
margin: 20,
lineHeight: 30,
color: '#333',
textAlign: 'center',
},
bootsplash: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#1C6AF6',
},
logo: {
width: 250,
height: 80,
resizeMode: 'contain',
},
});
export default App;
......@@ -193,9 +193,10 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
implementation project(':react-native-bootsplash')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
......
......@@ -20,13 +20,21 @@
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTop"
android:exported="true"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.zoontek.rnbootsplash.RNBootSplashActivity"
android:theme="@style/BootTheme"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
......
package com.invest;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.zoontek.rnbootsplash.RNBootSplash;
public class MainActivity extends ReactActivity {
......@@ -12,4 +15,10 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "Invest";
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RNBootSplash.init(R.drawable.bootsplash, MainActivity.this); // <- display the generated bootsplash.xml drawable over our MainActivity
}
}
......@@ -14,6 +14,9 @@ import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.facebook.react.ReactApplication; //<- Dòng này
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;//<- Dòng này
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;//<- Dòng này
import com.zoontek.rnbootsplash.RNBootSplashPackage;
public class MainApplication extends Application implements ReactApplication {
......@@ -30,6 +33,9 @@ public class MainApplication extends Application implements ReactApplication {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new RNFirebaseMessagingPackage());//<- Dòng này
packages.add(new RNFirebaseNotificationsPackage());//<- Dòng này
// packages.add(new RNBootSplashPackage());
return packages;
}
......@@ -49,6 +55,7 @@ public class MainApplication extends Application implements ReactApplication {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
// RNBootSplash.init(R.drawable.bootsplash, MainActivity.this);
}
/**
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@color/bootsplash_background" />
<item>
<bitmap android:src="@mipmap/bootsplash_logo" android:gravity="center" />
</item>
</layer-list>
<resources>
<color name="bootsplash_background">#1C6AF6</color>
</resources>
......@@ -5,5 +5,8 @@
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
<style name="BootTheme" parent="AppTheme">
<!-- set the generated bootsplash.xml drawable as activity background -->
<item name="android:background">@drawable/bootsplash</item>
</style>
</resources>
rootProject.name = 'Invest'
include ':react-native-bootsplash'
project(':react-native-bootsplash').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bootsplash/android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android')
include ':react-native-vector-icons'
include ':react-native-bootsplash'
project(':react-native-bootsplash').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bootsplash/android')
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
......
......@@ -19,6 +19,13 @@
2DCD954D1E0B4F2C00145EB5 /* InvestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* InvestTests.m */; };
2FCC6749524E697FC9323F22 /* libPods-Invest-InvestTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABCEBFE5646F1EF68E7C87AB /* libPods-Invest-InvestTests.a */; };
48E6A9A75AE9C55476F21D2D /* libPods-Invest-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4ECD31835B4784D2DC719E76 /* libPods-Invest-tvOSTests.a */; };
<<<<<<< HEAD
=======
52B7A0A425F722CF00CEDA09 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52B7A0A325F722CF00CEDA09 /* GoogleService-Info.plist */; };
52B7A0A525F722CF00CEDA09 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52B7A0A325F722CF00CEDA09 /* GoogleService-Info.plist */; };
52FB2B09262400D400DD7983 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52FB2B08262400D400DD7983 /* BootSplash.storyboard */; };
52FB2B0A262400D400DD7983 /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 52FB2B08262400D400DD7983 /* BootSplash.storyboard */; };
>>>>>>> splash
BEE4F63E354049C2D225330D /* libPods-Invest.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F96EA7789D1E36A43479651 /* libPods-Invest.a */; };
C58809ADB943708AF0E7E27E /* libPods-Invest-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FC653233E0AC368FCB03B57C /* libPods-Invest-tvOS.a */; };
/* End PBXBuildFile section */
......@@ -59,6 +66,7 @@
2D02E4901E0B4A5D006451C7 /* Invest-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Invest-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
4ECD31835B4784D2DC719E76 /* libPods-Invest-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Invest-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
52E1A15225F1255E00EA970D /* Invest.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Invest.entitlements; path = Invest/Invest.entitlements; sourceTree = "<group>"; };
52FB2B08262400D400DD7983 /* BootSplash.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = BootSplash.storyboard; path = Invest/BootSplash.storyboard; sourceTree = "<group>"; };
5F96EA7789D1E36A43479651 /* libPods-Invest.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Invest.a"; sourceTree = BUILT_PRODUCTS_DIR; };
72B39130AB01DE9359CED049 /* Pods-Invest-InvestTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Invest-InvestTests.release.xcconfig"; path = "Target Support Files/Pods-Invest-InvestTests/Pods-Invest-InvestTests.release.xcconfig"; sourceTree = "<group>"; };
7A8D76C2B302272AF1BB9AE1 /* Pods-Invest-InvestTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Invest-InvestTests.debug.xcconfig"; path = "Target Support Files/Pods-Invest-InvestTests/Pods-Invest-InvestTests.debug.xcconfig"; sourceTree = "<group>"; };
......@@ -144,6 +152,7 @@
13B07FAE1A68108700A75B9A /* Invest */ = {
isa = PBXGroup;
children = (
52FB2B08262400D400DD7983 /* BootSplash.storyboard */,
9345F6C125FF213F006B5233 /* Fonts */,
52E1A15225F1255E00EA970D /* Invest.entitlements */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
......@@ -400,7 +409,12 @@
files = (
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
<<<<<<< HEAD
13869AC326244FB000412A7A /* GoogleService-Info.plist in Resources */,
=======
52B7A0A425F722CF00CEDA09 /* GoogleService-Info.plist in Resources */,
52FB2B09262400D400DD7983 /* BootSplash.storyboard in Resources */,
>>>>>>> splash
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -408,6 +422,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
52FB2B0A262400D400DD7983 /* BootSplash.storyboard in Resources */,
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -895,7 +910,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = MXZ24GRH48;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
......@@ -928,7 +943,7 @@
CODE_SIGN_ENTITLEMENTS = Invest/Invest.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 17;
DEVELOPMENT_TEAM = MXZ24GRH48;
INFOPLIST_FILE = Invest/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
......
......@@ -7,7 +7,7 @@
@import Firebase;
#import <AVFoundation/AVFoundation.h>
#import "RNBootSplash.h"
#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
......@@ -50,7 +50,7 @@ static void InitializeFlipper(UIApplication *application) {
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[RNBootSplash initWithStoryboard:@"BootSplash" rootView:rootView];
// [CallAppInterface setHomeViewController:rootViewController];
return YES;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17147" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17120"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" autoresizesSubviews="NO" userInteractionEnabled="NO" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="BootSplashLogo" translatesAutoresizingMaskIntoConstraints="NO" id="3lX-Ut-9ad">
<rect key="frame" x="77.5" y="296.5" width="220" height="74"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" image="YES" notEnabled="YES"/>
</accessibility>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="0.109803921568627" green="0.415686274509804" blue="0.964705882352941" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" notEnabled="YES"/>
</accessibility>
<constraints>
<constraint firstItem="3lX-Ut-9ad" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="Fh9-Fy-1nT"/>
<constraint firstItem="3lX-Ut-9ad" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="nvB-Ic-PnI"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
<resources>
<image name="BootSplashLogo" width="220" height="74"/>
</resources>
</document>
{
"images": [
{
"idiom": "universal",
"filename": "bootsplash_logo.png",
"scale": "1x"
},
{
"idiom": "universal",
"filename": "bootsplash_logo@2x.png",
"scale": "2x"
},
{
"idiom": "universal",
"filename": "bootsplash_logo@3x.png",
"scale": "3x"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
......@@ -66,7 +66,7 @@
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<string>BootSplash</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
......
......@@ -80,6 +80,7 @@ target 'Invest' do
pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
pod 'RNBootSplash', :path => '../node_modules/react-native-bootsplash'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
......
......@@ -361,6 +361,8 @@ PODS:
- React-cxxreact (= 0.62.2)
- React-jsi (= 0.62.2)
- ReactCommon/callinvoker (= 0.62.2)
- RNBootSplash (3.2.0):
- React-Core
- RNCAsyncStorage (1.12.1):
- React-Core
- RNCCheckbox (0.5.7):
......@@ -450,6 +452,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- ReactCommon/callinvoker (from `../node_modules/react-native/ReactCommon`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNBootSplash (from `../node_modules/react-native-bootsplash`)
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
- "RNCCheckbox (from `../node_modules/@react-native-community/checkbox`)"
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
......@@ -550,6 +553,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Vibration"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNBootSplash:
:path: "../node_modules/react-native-bootsplash"
RNCAsyncStorage:
:path: "../node_modules/@react-native-community/async-storage"
RNCCheckbox:
......@@ -628,6 +633,7 @@ SPEC CHECKSUMS:
React-RCTText: fae545b10cfdb3d247c36c56f61a94cfd6dba41d
React-RCTVibration: 4356114dbcba4ce66991096e51a66e61eda51256
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
RNBootSplash: 24175aa28fe203b10c48dc34e78d946fd33c77af
RNCAsyncStorage: b03032fdbdb725bea0bd9e5ec5a7272865ae7398
RNCCheckbox: d1749e6a92178ce5dbc31e63becd1f34f0c76bbd
RNCClipboard: 245417a78ab585e0d4d83926c28907e7b2bc24bd
......@@ -644,6 +650,10 @@ SPEC CHECKSUMS:
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
YoutubePlayer-in-WKWebView: cfbf46da51d7370662a695a8f351e5fa1d3e1008
<<<<<<< HEAD
PODFILE CHECKSUM: 0aed8e9b9bcc932aca0489409733bbdf33d0b8bc
=======
PODFILE CHECKSUM: a0276896cf4bf6dbd0e780acaa769b26a97ccce1
>>>>>>> splash
COCOAPODS: 1.10.1
......@@ -25,6 +25,7 @@
"react": "16.11.0",
"react-hook-form": "^6.15.4",
"react-native": "0.62.2",
"react-native-bootsplash": "^3.2.0",
"react-native-confirmation-code-field": "^6.5.1",
"react-native-datepicker": "^1.7.2",
"@react-native-firebase/app": "^7.1.0",
......
......@@ -98,7 +98,20 @@ export const Gender = {
male: 0,
female: 1,
};
export const converType = (type) => {
if (type == 'DEPOSIT') return 'Nạp tiền';
return 'Rút tiền';
};
export const converStatus = (status) => {
switch (status) {
case 0:
return 'Chờ xử lý';
case 1:
return 'Thành công';
case 2:
return 'Huỷ';
}
};
export const toPriceVnd = (str) => {
if (str) {
let stringPrice = str.toString().split('.');
......
......@@ -10,47 +10,47 @@ import R from './assets/R';
import FirebaseNotification from './helper/FirebaseNotification';
import messaging from '@react-native-firebase/messaging';
import {enableScreens} from 'react-native-screens';
import AsyncStorage from "@react-native-community/async-storage";
import KEY from "./assets/AsynStorage";
import firebase from "@react-native-firebase/app";
import AsyncStorage from '@react-native-community/async-storage';
import KEY from './assets/AsynStorage';
import firebase from '@react-native-firebase/app';
enableScreens();
const RootView = (props) => {
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('Message handled in the background!', remoteMessage);
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
console.log('Message handled in the background!', remoteMessage);
});
useEffect(() => {
requestUserPermission();
const unsubscribe = messaging().onMessage(async (remoteMessage) => {
console.log('A new FCM message arrived!', remoteMessage);
});
useEffect(() => {
requestUserPermission();
const unsubscribe = messaging().onMessage(async remoteMessage => {
console.log('A new FCM message arrived!', remoteMessage);
});
return unsubscribe;
}, []);
return unsubscribe;
}, []);
const requestUserPermission = async () => {
const authStatus = await messaging().requestPermission();
const enabled =
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
const requestUserPermission = async () => {
const authStatus = await messaging().requestPermission();
const enabled =
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
if (enabled) {
getFcmToken()
console.log('Authorization status:', authStatus);
}
if (enabled) {
getFcmToken();
console.log('Authorization status:', authStatus);
}
const getFcmToken = async () => {
let fcmToken = await AsyncStorage.getItem(KEY.FIREBASE);
console.log('Dat tao', fcmToken);
if (!fcmToken) {
fcmToken = await messaging().getToken();
console.log('Vua tao', fcmToken);
if (fcmToken) {
AsyncStorage.setItem(KEY.FIREBASE, fcmToken);
}
}
};
const getFcmToken = async () => {
let fcmToken = await AsyncStorage.getItem(KEY.FIREBASE);
console.log('Dat tao', fcmToken);
if (!fcmToken) {
fcmToken = await messaging().getToken();
console.log('Vua tao', fcmToken);
if (fcmToken) {
AsyncStorage.setItem(KEY.FIREBASE, fcmToken);
}
}
};
onReceived = (notification) => {};
onReceived = (notification) => {};
onOpened = (notification) => {
console.log(('notification', notification));
};
......
import React from 'react';
import {View, Text} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
import {connect} from 'react-redux';
import {WebView} from 'react-native-webview';
const Contract = (props) => {
console.log(props.user);
return (
<View style={{flex: 1}}>
<HeaderBack title={'Hợp đồng'} />
<View
style={{
flex: 1,
paddingHorizontal: 20,
justifyContent: 'center',
alignItems: 'center',
}}>
<Text
style={{
fontSize: 18,
fontWeight: 'bold',
textAlign: 'center',
}}>
Tính năng đang được phát trin, vui lòng quay li sau!
</Text>
</View>
<HeaderBack isWhite={true} title={'Hợp đồng'} />
<WebView
androidHardwareAccelerationDisabled={true}
source={{
uri:
'http://api.dcvinvest.com/webview/contracts/show/' + props.user.uid,
}}
/>
</View>
);
};
export default Contract;
const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {})(Contract);
......@@ -4,38 +4,39 @@ import HistoryView from './HistoryView';
import {getListTransaction} from '../../../apis/Functions/Widthdraw';
const History = (props) => {
const [selected, setSelected] = useState('');
const [selected, setSelected] = useState('ALL');
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
const [fillters, setFillters] = useState([]);
useEffect(() => {
getData();
}, []);
// useEffect(() => {
// getData();
// }, [selected]);
useEffect(() => {
getData();
}, [selected]);
const getData = async () => {
setisRefresh(true);
setPage(1);
const res = await getListTransaction({
keyword: '',
type: 'ALL',
type: selected,
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: 1,
start_date: '',
end_date: '',
});
console.log(res);
setisRefresh(false);
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
console.log(res.data.data);
} else {
Alert.alert('Thông báo!', res.data.message);
}
......@@ -46,18 +47,20 @@ const History = (props) => {
};
const onLoadMore = () => {
console.log(tottalPage);
// if (page < tottalPage) getDataLoadMore();
if (page < tottalPage) getDataLoadMore();
};
const getDataLoadMore = async () => {
setisRefresh(true);
const res = await getListNew({
const res = await getListTransaction({
keyword: '',
category_id: selected,
type: 'ALL',
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: page + 1,
start_date: '',
end_date: '',
});
setPage(page + 1);
......@@ -73,6 +76,8 @@ const History = (props) => {
isRefresh={isRefresh}
onRefresh={onRefresh}
data={data}
selected={selected}
setSelected={setSelected}
/>
);
};
......
import React, {useState} from 'react';
import {View, Text, FlatList, TouchableOpacity, StyleSheet} from 'react-native';
import {
View,
Text,
FlatList,
TouchableOpacity,
StyleSheet,
ScrollView,
} from 'react-native';
import HeaderBack from '../../../components/Header/HeaderBack';
import Item from './Item';
import {getFontXD} from '../../../Config/Functions';
const Fillters = [
{
id: '1',
name: 'Tất cả',
value: 'all',
value: 'ALL',
},
{
id: '4',
name: 'Rút tiền',
value: 'withdraw',
id: '2',
name: 'Nạp tiền',
value: 'DEPOSIT',
},
{
id: '5',
name: 'Nạp tiền',
value: 'deposit',
id: '3',
name: 'Rút tiền',
value: 'WITHDRAW',
},
{
id: '6',
id: '4',
name: 'Chuyển khoản',
value: 'exchange',
value: 'TRANSFER',
},
];
// const data = [
// {
// id: '1',
// money: 10000000,
// content: 'Hoạt động: Nạp tiền',
// status: 1,
// date: '20/02/2021',
// },
// {
// id: '2',
// money: 2000000,
// content: 'Hoạt động: Nạp tiền',
// status: 1,
// date: '20/02/2021',
// },
// {
// id: '3',
// day: '20',
// money: 3000000,
// content: 'Hoạt động: Nạp tiền',
// status: 1,
// date: '20/02/2021',
// },
// {
// id: '4',
// money: 4000000,
// content: 'Hoạt động: Rút tiền',
// status: 2,
// date: '20/02/2021',
// },
// {
// id: '5',
// money: 9000000,
// content: 'Hoạt động: Nạp tiền',
// status: 1,
// date: '20/02/2021',
// },
// {
// id: '6',
// money: 4000000,
// content: 'Hoạt động: Rút tiền',
// status: 2,
// date: '20/02/2021',
// },
// {
// id: '7',
// money: 9000000,
// content: 'Hoạt động: Nạp tiền',
// status: 1,
// date: '20/02/2021',
// },
// ];
const HistoryView = (props) => {
const {isRefresh, onRefresh, onLoadMore, data} = props;
const [selected, setSelected] = useState('1');
const {isRefresh, onRefresh, onLoadMore, data, selected, setSelected} = props;
return (
<View style={{flex: 1}}>
<HeaderBack isWhite={true} title={'LỊCH SỬ'} />
<View style={{flex: 1}}>
<View style={styles.headerContainer}>
<FlatList
showsHorizontalScrollIndicator={false}
horizontal
data={Fillters}
keyExtractor={(item) => item.id}
renderItem={({item}) => (
<TouchableOpacity
onPress={() => setSelected(item.id)}
{Fillters.map((e) => (
<TouchableOpacity
key={e.value}
onPress={() => setSelected(e.value)}
style={[
styles.itemFillter,
selected == e.value ? {borderColor: '#1473E6'} : null,
]}>
<Text
style={[
styles.itemFillter,
selected == item.id ? {borderColor: '#1473E6'} : null,
styles.txtFillter,
selected == e.value ? {color: '#1473E6'} : {},
]}>
<Text
style={[
styles.txtFillter,
selected == item.id ? {color: '#1473E6'} : {},
]}>
{item.name}
</Text>
</TouchableOpacity>
)}
/>
{e.name}
</Text>
</TouchableOpacity>
))}
</View>
<FlatList
style={{flex: 1}}
refreshing={isRefresh}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
keyExtractor={(item) => item.id}
data={data}
renderItem={({item}) => <Item item={item} />}
/>
{data.length == 0 ? (
<View
style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<Text
style={{
fontSize: getFontXD(46),
fontWeight: 'bold',
}}>
Không có giao dch nào!
</Text>
</View>
) : (
<FlatList
style={{flex: 1}}
refreshing={isRefresh}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
keyExtractor={(item) => item.id}
data={data}
renderItem={({item}) => <Item item={item} />}
/>
)}
</View>
</View>
);
......@@ -132,6 +94,10 @@ const styles = StyleSheet.create({
headerContainer: {
paddingVertical: 10,
backgroundColor: 'white',
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
paddingHorizontal: 10,
},
itemFillter: {
borderRadius: 10,
......@@ -139,7 +105,6 @@ const styles = StyleSheet.create({
paddingHorizontal: 10,
borderWidth: 1,
borderColor: '#929292',
marginLeft: 15,
minWidth: 70,
},
txtFillter: {
......
......@@ -5,6 +5,8 @@ import {
HEIGHTXD,
WIDTHXD,
toPriceVnd,
converType,
converStatus,
} from '../../../Config/Functions';
import R from '../../../assets/R';
import Block from '../../../components/Block';
......@@ -16,62 +18,46 @@ const Item = (props) => {
// console.log('item---', item.status);
const navigate = useNavigation();
return (
<TouchableOpacity onPress={() => console.log('HEllo')}>
<View style={styles.container}>
<Block flex={1} row>
<View style={styles.wrapLeft} />
<View style={styles.wrapDate}>
{item.status == 1 ? (
<Image source={R.images.iconRecharge} style={styles.imgIcon} />
) : (
<Image source={R.images.iconWithdrawal} style={styles.imgIcon} />
)}
</View>
<Block
style={{justifyContent: 'center'}}
padding={[5, 10]}
space={'between'}
flex={1}>
<View style={styles.container}>
<Block flex={1} row>
<View style={styles.wrapLeft} />
<View style={styles.wrapDate}>
<Image source={{uri: item.icon}} style={styles.imgIcon} />
</View>
<Block
style={{justifyContent: 'center'}}
padding={[5, 10]}
space={'between'}
flex={1}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
}}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-start',
}}>
<View
style={{
alignItems: 'flex-start',
}}>
<Text style={styles.txtBlack}>{item.content}</Text>
<Text style={styles.txt}>{item.date}</Text>
</View>
<Text style={styles.txtBlack}>
{converType(item.transection_category)}
</Text>
<Text style={styles.txt}>{item.transection_date_timestamp}</Text>
</View>
<View style={{alignItems: 'flex-end'}}>
{item.status == 1 ? (
<Text
style={{
fontSize: getFontXD(42),
fontWeight: 'bold',
color: '#F99D1D',
}}>
{toPriceVnd(item.money)} Đ
</Text>
) : (
<Text
style={{
fontSize: getFontXD(42),
fontWeight: 'bold',
color: '#1473E6',
}}>
{toPriceVnd(item.money)} Đ
</Text>
)}
<Text style={styles.txt}>Hoàn tt</Text>
</View>
<View style={{alignItems: 'flex-end'}}>
<Text
style={[
styles.txtMoney,
item.status == 1 ? {color: '#1473E6'} : null,
]}>
{toPriceVnd(item.amount)} Đ
</Text>
<Text style={styles.txt}>{converStatus(item.status)}</Text>
</View>
</Block>
</View>
</Block>
</View>
</TouchableOpacity>
</Block>
</View>
);
};
......@@ -109,10 +95,20 @@ const styles = StyleSheet.create({
txt: {
fontSize: getFontXD(36),
color: '#C4C4C4',
marginTop: 10,
fontStyle: 'italic',
},
imgIcon: {
width: WIDTHXD(178),
height: HEIGHTXD(178),
resizeMode: 'contain',
},
txtMoney: {
fontSize: getFontXD(42),
fontWeight: 'bold',
color: '#F99D1D',
},
txtBlack: {
fontSize: getFontXD(42),
},
});
......@@ -5,6 +5,7 @@ import {
HEIGHTXD,
WIDTHXD,
toPriceVnd,
converType,
} from '../../../../Config/Functions';
import R from '../../../../assets/R';
import Block from '../../../../components/Block';
......@@ -18,31 +19,35 @@ const Item = (props) => {
<TouchableOpacity onPress={() => console.log('hello')}>
<View style={styles.container}>
<Block flex={1} row>
<View style={[styles.wrapLeft, {backgroundColor: item.color}]} />
{/* <View style={[styles.wrapLeft, {backgroundColor: item.color}]} />
<View style={styles.wrapDate}>
<Text style={styles.txt}>T{item.month}</Text>
<Text style={styles.txtTitle}>{item.day}</Text>
</View>
</View> */}
<Block
style={styles.wrapRight}
padding={[5, 10]}
padding={[10, 10]}
space={'between'}
flex={1}>
<View style={styles.rowBet}>
<Text style={styles.txtTitle}>{item.name}</Text>
<Text style={styles.txtTitle}>
{converType(item.transection_category)}
</Text>
<Text
style={{
fontSize: getFontXD(42),
fontWeight: 'bold',
color: '#FFB721',
}}>
{toPriceVnd(item.money)}
{toPriceVnd(item.amount)}
</Text>
</View>
<Text numberOfLines={2} style={styles.txt}>
{item.note}
{item.comments}
</Text>
<Text style={styles.txtDate}>
{item.transection_date_timestamp}
</Text>
<Text style={styles.txtDate}>Ngày {item.date}</Text>
</Block>
</Block>
</View>
......
import React from 'react';
import React, {useState, useEffect} from 'react';
import {View, Text, FlatList} from 'react-native';
import HeaderBack from '../../../../components/Header/HeaderBack';
import Item from './Item';
const data = [
{
id: '1',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 10000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '2',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 2000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '3',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 3000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '4',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 4000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '5',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 9000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
];
import {getListTransaction} from '../../../../apis/Functions/Widthdraw';
const Success = (props) => {
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
useEffect(() => {
getData();
}, []);
const getData = async () => {
setisRefresh(true);
setPage(1);
const res = await getListTransaction({
keyword: '',
type: 'ALL',
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: 1,
start_date: '',
end_date: '',
});
console.log(res.data);
setisRefresh(false);
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
} else {
Alert.alert('Thông báo!', res.data.message);
}
};
const onRefresh = () => {
getData();
};
const onLoadMore = () => {
console.log(tottalPage);
if (page < tottalPage) getDataLoadMore();
};
const getDataLoadMore = async () => {
setisRefresh(true);
const res = await getListTransaction({
keyword: '',
type: 'ALL',
platform: Platform.OS,
page_size: 10,
status: 1,
page_index: page + 1,
start_date: '',
end_date: '',
});
setPage(page + 1);
if (res.data.code == 200) {
setData(data.concat(res.data.data));
}
setisRefresh(false);
};
return (
<View style={{flex: 1}}>
<FlatList
keyExtractor={(item) => item.id}
keyExtractor={(item) => item.transection_id}
refreshing={isRefresh}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
data={data}
renderItem={({item}) => <Item item={item} />}
/>
......
import React from 'react';
import React, {useState, useEffect} from 'react';
import {View, Text, FlatList} from 'react-native';
import HeaderBack from '../../../../components/Header/HeaderBack';
import Item from './Item';
const data = [
{
id: '1',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 10000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '2',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 2000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '3',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 3000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '4',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 4000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
{
id: '5',
month: 2,
day: '20',
name: 'Nạp tiền',
money: 9000000,
note: 'Ghi chú nap tiền để đầu tư',
status: 1,
date: '20/02/2021',
},
];
import {getListTransaction} from '../../../../apis/Functions/Widthdraw';
const Watting = (props) => {
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
useEffect(() => {
getData();
}, []);
const getData = async () => {
setisRefresh(true);
setPage(1);
const res = await getListTransaction({
keyword: '',
type: 'ALL',
platform: Platform.OS,
page_size: 10,
status: 0,
page_index: 1,
start_date: '',
end_date: '',
});
console.log(res.data);
setisRefresh(false);
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
} else {
Alert.alert('Thông báo!', res.data.message);
}
};
const onRefresh = () => {
getData();
};
const onLoadMore = () => {
console.log(tottalPage);
if (page < tottalPage) getDataLoadMore();
};
const getDataLoadMore = async () => {
setisRefresh(true);
const res = await getListTransaction({
keyword: '',
type: 'ALL',
platform: Platform.OS,
page_size: 10,
status: -1,
page_index: page + 1,
start_date: '',
end_date: '',
});
setPage(page + 1);
if (res.data.code == 200) {
setData(data.concat(res.data.data));
}
setisRefresh(false);
};
return (
<View style={{flex: 1}}>
<FlatList
keyExtractor={(item) => item.id}
keyExtractor={(item) => item.transection_id}
refreshing={isRefresh}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
data={data}
renderItem={({item}) => <Item item={item} />}
/>
......
......@@ -6,6 +6,7 @@ import TextField from '../../../components/Input/TextField';
import TextMulti from '../../../components/Input/TextMulti';
import TextDisable from '../../../components/Input/TextDisable';
import {getFontXD, toPriceVnd} from '../../../Config/Functions';
import {connect} from 'react-redux';
const {width} = Dimensions.get('window');
const WalletDeposit = (props) => {
......@@ -16,13 +17,23 @@ const WalletDeposit = (props) => {
<View style={styles.wrapTop}>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>Ví</Text>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_money != 0
? toPriceVnd(props.user.current_money)
: 0}{' '}
</Text>
</View>
<View style={{width: 1, backgroundColor: '#DBDBDB'}} />
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_cqg_money != 0
? toPriceVnd(props.user.current_cqg_money)
: 0}{' '}
đ
</Text>
</View>
</View>
<View style={styles.wrapBody}>
......@@ -95,4 +106,9 @@ const styles = StyleSheet.create({
},
});
export default WalletDeposit;
const mapStateToProps = (state) => {
return {
user: state.userReducer,
};
};
export default connect(mapStateToProps, {})(WalletDeposit);
......@@ -117,18 +117,29 @@ const WalletWithdraw = (props) => {
<View style={{flex: 1}}>
<HeaderBack title={'Rút tiền'} />
<View style={styles.container}>
{/* <View style={styles.wrapTop}>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>Ví</Text>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text>
</View>
<View style={{width: 1, backgroundColor: '#DBDBDB'}} />
<View style={styles.wrapTop}>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>Ví</Text>
<Text style={styles.txtMoney}>
{' '}
{props.user.current_money != 0
? toPriceVnd(props.user.current_money)
: 0}{' '}
</Text>
</View>
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>{toPriceVnd(1000000)}</Text>
</View>
</View> */}
<View style={{width: 1, backgroundColor: '#DBDBDB'}} />
<View style={styles.itemTop}>
<Text style={styles.txtTitle}>CQG</Text>
<Text style={styles.txtMoney}>
{props.user.current_cqg_money != 0
? toPriceVnd(props.user.current_cqg_money)
: 0}{' '}
đ
</Text>
</View>
</View>
<View style={styles.wrapBody}>
<Text
style={{
......
import React from 'react';
import {View, Text} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
const LegalDocument = (props) => {
return (
<View style={{flex: 1}}>
<HeaderBack title={'Giấy tờ pháp lý'} />
</View>
);
};
export default LegalDocument;
......@@ -58,7 +58,7 @@ const NewFeed = (props) => {
const getItemLayout = (data, index) => ({
length: 100,
offset: 80 * index,
offset: 60 * index,
index,
});
......
......@@ -27,11 +27,6 @@ const NewFeed = (props) => {
style: {backgroundColor: 'white'},
}}>
<Tab.Screen
name="CALENDAR"
component={Calendar}
options={{tabBarLabel: 'Lịch thị trường'}}
/>
<Tab.Screen
name="Tab1"
component={Tab1}
options={{tabBarLabel: 'Tin tức'}}
......@@ -51,6 +46,11 @@ const NewFeed = (props) => {
component={Trading}
options={{tabBarLabel: 'Biểu đồ'}}
/>
<Tab.Screen
name="CALENDAR"
component={Calendar}
options={{tabBarLabel: 'Lịch thị trường'}}
/>
</Tab.Navigator>
</View>
</View>
......
......@@ -24,10 +24,11 @@ const Item = (props) => {
</View>
<Block padding={[5, 10]} space={'between'} flex={1}>
<View style={{justifyContent: 'center', flex: 1}}>
<Text style={styles.txtBlack}>{item.content}</Text>
<Text numberOfLines={2} style={styles.txtBlack}>
Np tin thành công vi s lượng: 750.000
</Text>
</View>
<Text style={styles.txt}>Ngày {item.time}</Text>
<Text style={styles.txt}>10:52 09/04/2021</Text>
</Block>
</Block>
</View>
......
......@@ -9,93 +9,73 @@ const Fillters = [
{
id: '1',
name: 'Tất cả',
value: 'all',
value: 'ALL',
},
{
id: '2',
name: 'Chưa đọc',
value: 'disable',
},
{
id: '3',
name: 'Đã đọc',
value: 'enable',
},
{
id: '4',
name: 'Rút tiền',
value: 'withdraw',
},
{
id: '5',
name: 'Nạp tiền',
value: 'deposit',
},
{
id: '6',
name: 'Chuyển khoản',
value: 'exchange',
},
];
const data = [
{
id: '1',
time: '20/02/2021',
content: 'Yêu cầu nạp tiền của bạn đã đươc xác nhận',
},
{
id: '2',
time: '20/02/2021',
content: 'Yêu cầu nạp tiền của bạn đã đươc xác nhận',
value: 'DEPOSIT',
},
{
id: '3',
time: '20/02/2021',
content: 'Yêu cầu nạp tiền của bạn đã đươc xác nhận',
name: 'Rút tiền',
value: 'WITHDRAW',
},
{
id: '4',
time: '20/02/2021',
content: 'Yêu cầu nạp tiền của bạn đã đươc xác nhận',
name: 'Chuyển khoản',
value: 'TRANSFER',
},
];
const NotificaitonView = (props) => {
const [selected, setSelected] = useState('1');
const {onRefresh, isRefresh, onLoadMore, setFillters, fillter, data} = props;
return (
<View style={{flex: 1}}>
<HeaderDrawer isWhite={true} title={'Thông báo'} />
<View style={styles.headerContainer}>
<FlatList
showsHorizontalScrollIndicator={false}
horizontal
data={Fillters}
keyExtractor={(item) => item.id}
renderItem={({item}) => (
<TouchableOpacity
onPress={() => setSelected(item.id)}
{Fillters.map((e) => (
<TouchableOpacity
key={e.value}
onPress={() => setFillters(e.value)}
style={[
styles.itemFillter,
fillter == e.value ? {borderColor: '#1473E6'} : null,
]}>
<Text
style={[
styles.itemFillter,
selected == item.id ? {borderColor: '#1473E6'} : null,
styles.txtFillter,
fillter == e.value ? {color: '#1473E6'} : {},
]}>
<Text
style={[
styles.txtFillter,
selected == item.id ? {color: '#1473E6'} : {},
]}>
{item.name}
</Text>
</TouchableOpacity>
)}
/>
{e.name}
</Text>
</TouchableOpacity>
))}
</View>
<FlatList
keyExtractor={(item) => item.id}
data={data}
renderItem={({item}) => <Item item={item} />}
/>
{data.length == 0 ? (
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}>
<Text
style={{
fontSize: getFontXD(46),
fontWeight: 'bold',
}}>
Không có thông báo nào!
</Text>
</View>
) : (
<FlatList
keyExtractor={(item) => item.id}
data={data}
refreshing={isRefresh}
onRefresh={onRefresh}
onEndReachedThreshold={0.01}
onEndReached={(info) => {
onLoadMore();
}}
renderItem={({item}) => <Item item={item} />}
/>
)}
</View>
);
};
......@@ -104,6 +84,10 @@ const styles = StyleSheet.create({
headerContainer: {
paddingVertical: 10,
backgroundColor: 'white',
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
paddingHorizontal: 10,
},
itemFillter: {
borderRadius: 10,
......@@ -111,12 +95,18 @@ const styles = StyleSheet.create({
paddingHorizontal: 10,
borderWidth: 1,
borderColor: '#929292',
marginLeft: 15,
minWidth: 70,
minWidth: 80,
justifyContent: 'center',
alignItems: 'center',
},
txtFillter: {
fontSize: getFontXD(36),
color: '#929292',
fontWeight: 'bold',
},
txtTitle: {
fontSize: getFontXD(46),
fontWeight: 'bold',
},
});
......
import React from 'react';
import React, {useState, useEffect} from 'react';
import {getListNotification} from '../../apis/Functions/users';
import NotificationView from './NotificaitonView';
const Notifcation = (props) => {
return <NotificationView />;
const [selected, setSelected] = useState('');
const [page, setPage] = useState(1);
const [data, setData] = useState([]);
const [tottalPage, setTotalPage] = useState(1);
const [isRefresh, setisRefresh] = useState(false);
const [fillter, setFillters] = useState('ALL');
useEffect(() => {
getData();
}, [fillter]);
const getData = async () => {
setisRefresh(true);
setPage(1);
const res = await getListNotification({
keyword: '',
platform: Platform.OS,
page_size: 10,
page_index: 1,
type: fillter,
});
setisRefresh(false);
if ((res.data.code = 200 && res.data.data)) {
setData(res.data.data);
setTotalPage(res.data.meta.pages);
} else {
Alert.alert('Thông báo!', res.data.message);
}
};
const onRefresh = () => {
getData();
};
const onLoadMore = () => {
console.log(tottalPage);
if (page < tottalPage) getDataLoadMore();
};
const getDataLoadMore = async () => {
setisRefresh(true);
const res = await getListNotification({
keyword: '',
platform: Platform.OS,
page_size: 10,
page_index: 1,
type: fillter,
});
setPage(page + 1);
if (res.data.code == 200) {
setData(data.concat(res.data.data));
}
setisRefresh(false);
};
return (
<NotificationView
onRefresh={onRefresh}
isRefresh={isRefresh}
onLoadMore={onLoadMore}
setFillters={setFillters}
fillter={fillter}
data={data}
/>
);
};
export default Notifcation;
......@@ -41,3 +41,8 @@ export const getTransaction = async (body) =>
GetData(url.urlGetTransaction, body)
.then((res) => res)
.catch((err) => err);
export const getListNotification = async (body) =>
GetData(url.urlGetListNotification, body)
.then((res) => res)
.catch((err) => err);
......@@ -27,4 +27,6 @@ export default {
//History
urlGetListHistory: root + 'api/v1/customers/get-list-transaction-history',
urlGetListNotification: root + 'api/v1/customers/get-list-notification',
};
......@@ -30,8 +30,8 @@ const images = {
iconMethodPay: require('./images/iconMethodPay1.png'),
iconDepositNoti: require('./images/iconDeposit.png'),
iconRecharge: require('./images/iconRecharge.png'),
iconWithdrawal: require('./images/iconWithdrawal.png'),
iconRecharge: require('./images/iconRecharge1.png'),
iconWithdrawal: require('./images/iconWithdrawal2.png'),
iconClose: require('./images/CloseIcon.png'),
iconBack: require('./images/iconBack.png'),
bgBtn: require('./images/bgBtn.png'),
......@@ -63,6 +63,7 @@ const images = {
iconCheck: require('./images/iconCheck.png'),
bgmedia: require('./images/bgmedia.jpeg'),
bgLogin: require('./images/bgLogin.png'),
iconPaper: require('./images/iconPaper.png'),
};
export default images;
......@@ -14,6 +14,7 @@ import {
AUTHEN,
PROFILE,
CONTRACT,
LEGALDOCUMENT,
} from '../../routers/ScreenNames';
import {useNavigation} from '@react-navigation/native';
import {connect} from 'react-redux';
......@@ -51,6 +52,12 @@ const menus = [
screen: FEEDBACK,
},
{
id: '7',
title: 'Giấy tờ pháp lý',
icon: R.images.iconPaper,
screen: LEGALDOCUMENT,
},
{
id: '5',
title: 'Cài đặt',
icon: R.images.iconSetting,
......
......@@ -58,3 +58,5 @@ export const WALLETWITHDRAW = 'WALLETWITHDRAW';
export const PACKETCQG = 'PACKETCQG';
export const MEDIADETAIL = 'MEDIADETAIL';
export const METHODPAYDETAIL = 'METHODPAYDETAIL';
export const LEGALDOCUMENT = 'LEGALDOCUMENT';
......@@ -39,6 +39,7 @@ import WalletWithdraw from '../Screens/Action/Wallet/WalletWithdraw';
import PacketCQG from '../Screens/Account/PacrtCQG/PacketCQG';
import MediaDetail from '../Screens/NewFeed/Media/MediaDetail';
import MethodPayDetail from '../Screens/MethodPay/MethodPayDetail';
import LegaDocument from '../Screens/LegalDocument/LegalDocument';
import * as ScreenName from './ScreenNames';
......@@ -57,6 +58,7 @@ function MyStack(props) {
headerMode={'none'}
initialRouteName={ScreenName.AUTHEN}>
<Stack.Screen name={ScreenName.LOGINSCREEN} component={Login} />
<Stack.Screen name={ScreenName.LEGALDOCUMENT} component={LegaDocument} />
<Stack.Screen name={ScreenName.NOTIFICATION} component={Notification} />
<Stack.Screen name={ScreenName.MEDIADETAIL} component={MediaDetail} />
<Stack.Screen name={ScreenName.TABNAVIGATOR} component={TabNavigator} />
......
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