Merge pull request #2266 from BlueWallet/Modal-on-multisig-seed-#2176-

FIX:  Modal on multisig seed #2176
This commit is contained in:
GLaDOS 2020-12-12 02:31:36 +00:00 committed by GitHub
commit caefb28476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,6 @@ const WalletsAddMultisigStep2 = () => {
const { m, n, format } = useRoute().params;
const [cosigners, setCosigners] = useState([]); // array of cosigners user provided. if format [cosigner, fp, path]
const [isOnCreateButtonEnabled, setIsOnCreateButtonEnabled] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const [isMnemonicsModalVisible, setIsMnemonicsModalVisible] = useState(false);
const [isProvideMnemonicsModalVisible, setIsProvideMnemonicsModalVisible] = useState(false);
@ -186,12 +185,12 @@ const WalletsAddMultisigStep2 = () => {
w.generate().then(() => {
const cosignersCopy = [...cosigners];
cosignersCopy.push([w.getSecret(), false, false]);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
if (Platform.OS !== 'android') LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setCosigners(cosignersCopy);
setVaultKeyData({ keyIndex: cosignersCopy.length, seed: w.getSecret(), xpub: w.getXpub(), isLoading: false });
setIsLoading(true);
setIsMnemonicsModalVisible(true);
if (cosignersCopy.length === n) setIsOnCreateButtonEnabled(true);
// filling cache
setTimeout(() => {
// filling cache
@ -281,9 +280,8 @@ const WalletsAddMultisigStep2 = () => {
const cosignersCopy = [...cosigners];
cosignersCopy.push([xpub, fp, path]);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
if (Platform.OS !== 'android') LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setCosigners(cosignersCopy);
if (cosignersCopy.length === n) setIsOnCreateButtonEnabled(true);
};
const useMnemonicPhrase = () => {
@ -301,9 +299,9 @@ const WalletsAddMultisigStep2 = () => {
const cosignersCopy = [...cosigners];
cosignersCopy.push([hd.getSecret(), false, false]);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
if (Platform.OS !== 'android') LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setCosigners(cosignersCopy);
if (cosignersCopy.length === n) setIsOnCreateButtonEnabled(true);
setIsProvideMnemonicsModalVisible(false);
setIsLoading(false);
setImportText('');
@ -388,9 +386,8 @@ const WalletsAddMultisigStep2 = () => {
const cosignersCopy = [...cosigners];
cosignersCopy.push([cosigner.getXpub(), cosigner.getFp(), cosigner.getPath()]);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
if (Platform.OS !== 'android') LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setCosigners(cosignersCopy);
if (cosignersCopy.length === n) setIsOnCreateButtonEnabled(true);
}
};
@ -665,7 +662,7 @@ const WalletsAddMultisigStep2 = () => {
<BlueLoading />
) : (
<View style={styles.buttonBottom}>
<BlueButton title={loc.multisig.create} onPress={onCreate} disabled={!isOnCreateButtonEnabled} />
<BlueButton title={loc.multisig.create} onPress={onCreate} disabled={cosigners.length !== n} />
</View>
);