Commit 9665a612 by Giang Tran

setting screen

parent daf5a609
......@@ -296,7 +296,7 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
D10F3A5D59847BD5B121672E /* [CP] Embed Pods Frameworks */,
6CC873A1E6FA7C328D7B37A9 /* ShellScript */,
C942336BE13796643B04CCBB /* [CP] Copy Pods Resources */,
65CC03EF738E2B5FF58E56B9 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
......@@ -537,7 +537,7 @@
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Invest-InvestTests/Pods-Invest-InvestTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
};
6CC873A1E6FA7C328D7B37A9 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......@@ -662,7 +662,7 @@
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
};
D10F3A5D59847BD5B121672E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
......
......@@ -327,6 +327,8 @@ PODS:
- React-Core
- react-native-vnpay-merchant (1.0.0):
- React
- react-native-webview (11.2.5):
- React-Core
- React-RCTActionSheet (0.62.2):
- React-Core/RCTActionSheetHeaders (= 0.62.2)
- React-RCTAnimation (0.62.2):
......@@ -463,6 +465,7 @@ DEPENDENCIES:
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-vnpay-merchant (from `../node_modules/react-native-vnpay-merchant`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
......@@ -552,6 +555,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-safe-area-context"
react-native-vnpay-merchant:
:path: "../node_modules/react-native-vnpay-merchant"
react-native-webview:
:path: "../node_modules/react-native-webview"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
......@@ -637,6 +642,7 @@ SPEC CHECKSUMS:
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94
react-native-vnpay-merchant: c9f1ebb375802c7004045e3646240f043acaaf61
react-native-webview: e994346d13f4d8b240347bc5be043a860452e4b6
React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71
......
......@@ -37,7 +37,7 @@
"react-native-screens": "^2.17.1",
"react-native-tab-view": "^2.15.2",
"react-native-vector-icons": "^8.0.0",
"react-native-vnpay-merchant": "/Users/macbookpro/Documents/Company/ReactNative/Invest/node_modules/react-native-vnpay-merchant",
"react-native-webview": "^11.2.5",
"react-redux": "^7.2.2",
"redux": "^4.0.5",
"redux-saga": "^1.1.3",
......
......@@ -3,67 +3,10 @@ import {Alert, NativeEventEmitter} from 'react-native';
import DepositView from './DepositView';
import create_payment_link from '../../Payment/setup';
import VnpayMerchant, {VnpayMerchantModule} from 'react-native-vnpay-merchant';
const eventEmitter = new NativeEventEmitter(VnpayMerchantModule);
const Deposit = (props) => {
const {method} = props.route.params;
useEffect(() => {
// mở sdk
eventEmitter.addListener('PaymentBack', (e) => {
console.log('Sdk back!');
// Đã available trên cả ios, android
if (e) {
switch (e.resultCode) {
case 0:
console.log('Sdk closed');
break;
case -1:
console.log('Người dùng nhấn back từ sdk để quay lại');
break;
case 10: //ios
console.log(
'Người dùng nhấn chọn thanh toán qua app thanh toán (Mobile Banking, Ví...)',
);
break;
case 99:
console.log(
'Người dùng nhấn back từ trang thanh toán thành công khi thanh toán qua thẻ khi gọi đến http://sdk.merchantbackapp',
);
}
}
});
return () => {
// khi tắt sdk
eventEmitter.removeAllListeners('PaymentBack');
};
}, []);
const depositClick = (money, note) => {
if (money && note) {
if (method.agent == 'VNPAY') {
VnpayMerchant.show({
iconBackName: 'ic_back',
paymentUrl: create_payment_link(
method.return_url,
method.checkout_url,
money,
note,
),
scheme: 'sampleapp',
tmn_code: 'FAHASA03',
});
}
} else {
Alert('Bạn vui lòng điền đầy đủ thông tin!');
}
};
return <DepositView depositClick={depositClick} />;
return <DepositView urlCheckout={method.checkout_url} />;
};
export default Deposit;
......@@ -5,33 +5,13 @@ import TextField from '../../../components/Input/TextField';
import TextMulti from '../../../components/Input/TextMulti';
import Button from '../../../components/Button';
import {HEIGHTXD} from '../../../Config/Functions';
import {WebView} from 'react-native-webview';
const DepositView = (props) => {
const [money, setMoney] = useState(0);
const [note, setNote] = useState('');
return (
<View style={{flex: 1}}>
<HeaderBack title={'Nạp tiền'} />
<View style={{flex: 1, paddingHorizontal: 10, paddingTop: 10}}>
<TextField
value={money}
isNumber={true}
onChangeText={(val) => setMoney(val)}
title={'Số tiền'}
/>
<TextMulti
onChangeText={(val) => setNote(val)}
numberLines={3}
title={'Ghi chú'}
/>
</View>
<View style={styles.containerBtn}>
<Button
title={'Nạp tiền'}
onClick={() => props.depositClick(money, note)}
/>
</View>
<HeaderBack isWhite={true} title={'Nạp tiền'} />
<WebView source={{uri: props.urlCheckout}} />
</View>
);
};
......
import React, {useState} from 'react';
import {View, Text, Switch} from 'react-native';
import {View, Text, Switch, StyleSheet} from 'react-native';
import HeaderBack from '../../components/Header/HeaderBack';
import Block from '../../components/Block';
import {getFontXD} from '../../Config/Functions';
import PickerItem from '../../components/Picker/PickerItem';
const dataTest = [
{
value: '1',
name: 'Vietnamese',
},
{
value: '2',
name: 'English',
},
];
const SettingView = (props) => {
const [isEnabled, setIsEnabled] = useState(false);
const [isEnabled, setIsEnabled] = useState(true);
const toggleSwitch = () => setIsEnabled((previousState) => !previousState);
const [language, setLanguage] = useState(dataTest[2]);
return (
<View style={{flex: 1}}>
<HeaderBack title={'Cài đặt'} />
<View style={{flexDirection: 'row'}}></View>
<Switch
trackColor={{false: '#767577', true: '#1C6AF6'}}
// thumbColor={isEnabled ? '#f5dd4b' : '#f4f3f4'}
ios_backgroundColor="#767577"
onValueChange={toggleSwitch}
value={isEnabled}
/>
<View style={{flex: 1, padding: 10}}>
<View style={styles.row}>
<Text style={styles.txtTitle}>Ngôn ng</Text>
<PickerItem
width={200}
value={language}
data={dataTest}
onValueChange={(value, items) => {
setLanguage(items);
}}
/>
</View>
<View style={styles.row}>
<Text style={styles.txtTitle}>Bt thông báo</Text>
<Switch
trackColor={{false: '#767577', true: '#1C6AF6'}}
ios_backgroundColor="#767577"
onValueChange={toggleSwitch}
value={isEnabled}
/>
</View>
</View>
<Text>SettingView 1 screen</Text>
</View>
);
};
export default SettingView;
const styles = StyleSheet.create({
txtTitle: {
fontSize: getFontXD(46),
color: '#001C51',
},
row: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 20,
},
});
......@@ -2797,16 +2797,16 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
escape-string-regexp@2.0.0, escape-string-regexp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz"
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
escape-string-regexp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz"
integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==
escape-string-regexp@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz"
......@@ -3737,7 +3737,7 @@ internal-slot@^1.0.3:
has "^1.0.3"
side-channel "^1.0.4"
invariant@^2.2.4:
invariant@2.2.4, invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
......@@ -6152,6 +6152,14 @@ react-native-vector-icons@^8.0.0:
"react-native-vnpay-merchant@file:node_modules/react-native-vnpay-merchant":
version "1.0.0"
react-native-webview@^11.2.5:
version "11.2.5"
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.2.5.tgz#13885c0b7d03ca75850ea80e3f5ee072f055438c"
integrity sha512-j/nXFpTQffawojgecg/WeKgyCHTKwSRHSqH/HH20O99WbJz6FGSfuvlG95TO1hCuIqQh5ROtya9WOfXoJgavIA==
dependencies:
escape-string-regexp "2.0.0"
invariant "2.2.4"
react-native@0.62.2:
version "0.62.2"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.62.2.tgz"
......
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