Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu refactoring using popup #227

Merged
merged 7 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ios/NativeSigner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
Expand Down
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react-native-camera": "^1.9.0",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react-native-markdown-renderer": "^3.2.8",
"react-native-popup-menu": "^0.15.0",
"react-native-qrcode": "^0.2.7",
"react-native-secure-storage": "https://github.com/debris/react-native-secure-storage",
"react-native-simple-picker": "^2.1.0",
Expand Down
17 changes: 7 additions & 10 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ import {
withNavigation
} from 'react-navigation';
import { Provider as UnstatedProvider } from 'unstated';
import { MenuProvider } from 'react-native-popup-menu';

import '../ReactotronConfig';
import colors from './colors';
import Background from './components/Background';
import HeaderLeftHome from './components/HeaderLeftHome';
import SecurityHeader from './components/SecurityHeader';
import About from './screens/About';
import AccountAdd from './screens/AccountAdd';
import AccountBackup from './screens/AccountBackup';
import AccountDetails from './screens/AccountDetails';
import AccountEdit from './screens/AccountEdit';
Expand All @@ -55,9 +56,11 @@ export default class App extends Component {
render() {
return (
<UnstatedProvider>
<StatusBar barStyle="light-content" />
<Background />
<Screens />
<MenuProvider backHandler={true}>
<StatusBar barStyle="light-content" />
<Background />
<Screens />
</MenuProvider>
</UnstatedProvider>
);
}
Expand Down Expand Up @@ -156,12 +159,6 @@ const Screens = createStackNavigator(
headerLeft: <HeaderLeftHome />
}
},
AccountAdd: {
screen: AccountAdd,
navigationOptions: {
headerLeft: <HeaderLeftHome />
}
},
AccountNetworkChooser: {
screen: AccountNetworkChooser
},
Expand Down
Binary file added src/assets/img/onboardingArrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/components/AccountSeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ export default class AccountSeed extends Component {
}

renderSuggestions() {
const { value, valid } = this.props;

const invalidStyles = !valid ? styles.invalidInput : {};
const { value } = this.props;
const words = value.length ? value.split(' ') : [];
const wordPosition = this.getWordPosition();
let searchInput = this.getSearchInput();
Expand All @@ -163,6 +161,7 @@ export default class AccountSeed extends Component {
: {};
return (
<TouchableItem
key={i}
onPress={e => {
words[wordPosition] = suggestion;
this.props.onChangeText(words.join(' '));
Expand Down
59 changes: 59 additions & 0 deletions src/components/PopupMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

'use strict';

import React from 'react';
import { Text } from 'react-native';
import {
Menu,
MenuOptions,
MenuOption,
MenuTrigger,
} from 'react-native-popup-menu';
import Icon from 'react-native-vector-icons/MaterialIcons';
import colors from '../colors';

export default class PopupMenu extends React.PureComponent {
render() {
const { onSelect, menuTriggerIconName, menuItems } = this.props
const menuTriggerIcon = <Icon name={menuTriggerIconName} size={35} color={colors.bg_text_sec} />
return (
<Menu onSelect={onSelect}>
<MenuTrigger children={menuTriggerIcon} />
<MenuOptions customStyles={menuOptionsStyles}>
{
menuItems.map((menuItem, index) => (
<MenuOption key={index} value={menuItem.value} >
<Text style={(menuItem.textStyle) ? menuItem.textStyle : null} >{menuItem.text}</Text>
</MenuOption>
))
}
</MenuOptions>
</Menu>
);
}
}

const menuOptionsStyles = {
optionWrapper: {
padding: 15,
},
optionText: {
fontFamily: 'Roboto',
fontSize: 16
},
};
2 changes: 0 additions & 2 deletions src/screens/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export default class About extends React.PureComponent {
};

render() {
const { navigation } = this.props;
const isWelcome = navigation.getParam('isWelcome');
return (
<ScrollView style={styles.body} contentContainerStyle={{ padding: 20 }}>
<Text style={styles.title}>PARITY SIGNER (v2.0-beta)</Text>
Expand Down
133 changes: 0 additions & 133 deletions src/screens/AccountAdd.js

This file was deleted.

Loading