forked from cerc-io/laconic-wallet
Set coin type by default after selecting network (#90)
This commit is contained in:
parent
da4bed9c4b
commit
0707cd6fa4
@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { ScrollView } from 'react-native';
|
||||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { TextInput, Button, HelperText } from 'react-native-paper';
|
||||
@ -28,6 +28,7 @@ const AddNetwork = () => {
|
||||
control,
|
||||
formState: { errors, isValid },
|
||||
handleSubmit,
|
||||
setValue,
|
||||
} = useForm<NetworksDataState>({
|
||||
mode: 'onChange',
|
||||
});
|
||||
@ -107,6 +108,10 @@ const AddNetwork = () => {
|
||||
[navigation, namespace, setNetworksData],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setValue('coinType', namespace === EIP155 ? '60' : '118');
|
||||
}, [setValue, namespace]);
|
||||
|
||||
return (
|
||||
// TODO: get form data from json file
|
||||
<ScrollView contentContainerStyle={styles.signPage}>
|
||||
@ -180,6 +185,7 @@ const AddNetwork = () => {
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<SelectNetworkType updateNetworkType={updateNetworkType} />
|
||||
<Controller
|
||||
control={control}
|
||||
name="coinType"
|
||||
@ -191,13 +197,12 @@ const AddNetwork = () => {
|
||||
value={value}
|
||||
label="Coin Type"
|
||||
onBlur={onBlur}
|
||||
onChangeText={value => onChange(value)}
|
||||
onChangeText={onChange}
|
||||
/>
|
||||
<HelperText type="error">{errors.coinType?.message}</HelperText>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
<SelectNetworkType updateNetworkType={updateNetworkType} />
|
||||
{namespace === EIP155 ? (
|
||||
<Controller
|
||||
control={control}
|
||||
|
Loading…
Reference in New Issue
Block a user