Unverified Commit 15de0fff authored by YJ's avatar YJ Committed by GitHub
Browse files

Merge pull request #246 from paritytech/yj-bump-reactnative

Bump React Native to 0.60.3 & bump react-navigation, keyboard, camera, native components.
parents eb55ff68 df80d466
Pipeline #43531 failed with stage
in 19 seconds
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
}
})
}
};
\ No newline at end of file
This diff is collapsed.
......@@ -10,46 +10,50 @@
"scripts": {
"build-rust-ios": "cd rust/signer && make ios",
"build-rust-android": "cd rust/signer && make android",
"ios": "npm run build-rust-ios && react-native run-ios",
"android": "npm run build-rust-android && react-native run-android",
"ios": "yarn run build-rust-ios && react-native run-ios",
"android": "yarn run build-rust-android && react-native run-android",
"start": "yarn run ios",
"postinstall": "jetify",
"test": "jest",
"lint": "",
"lint": "eslint",
"commit": "commit-wizard"
},
"dependencies": {
"@babel/runtime": "^7.3.1",
"@react-native-community/netinfo": "^4.1.1",
"bignumber.js": "^4.0.0",
"debounce": "^1.0.0",
"hoist-non-react-statics": "^2.5.0",
"prop-types": "^15.6.1",
"react": "^16.7.0",
"react-native": "0.56",
"react-native-camera": "^1.9.0",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react": "16.8.6",
"react-native": "0.60.3",
"react-native-camera": "^2.11.1",
"react-native-gesture-handler": "^1.3.0",
"react-native-markdown-renderer": "^3.2.8",
"react-native-popup-menu": "^0.15.0",
"react-native-secure-storage": "https://github.com/debris/react-native-secure-storage",
"react-native-popup-menu": "^0.15.6",
"react-native-secure-storage": "git+https://github.com/debris/react-native-secure-storage.git",
"react-native-simple-picker": "^2.1.0",
"react-native-tabs": "^1.0.9",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.0.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^3.11.1",
"unstated": "^2.1.1"
},
"devDependencies": {
"@babel/cli": "^7.0.0-beta.56",
"@babel/core": "^7.0.0-beta.56",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.0.0-beta.56",
"@babel/preset-react": "^7.0.0-beta.56",
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.4",
"@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/plugin-transform-runtime": "^7.5.0",
"@babel/runtime": "^7.5.4",
"@react-native-community/eslint-config": "^0.0.5",
"babel-eslint": "^10.0.1",
"babel-jest": "24.0.0",
"babel-preset-react-native": "5.0.2",
"jest": "24.8.0",
"babel-jest": "^24.8.0",
"eslint": "^6.0.1",
"jest": "^24.8.0",
"jest-react-native": "^18.0.0",
"jetifier": "^1.6.3",
"metro-react-native-babel-preset": "^0.55.0",
"pre-git": "^3.14.0",
"prettier": "1.12.1",
"react-test-renderer": "16.8.6",
"reactotron-react-native": "^2.1.5"
},
"rnpm": {
......
......@@ -20,6 +20,7 @@
import React, { Component } from 'react';
import { StatusBar } from 'react-native';
import {
createAppContainer,
createStackNavigator,
HeaderBackButton,
withNavigation
......@@ -59,7 +60,7 @@ export default class App extends Component {
<MenuProvider backHandler={true}>
<StatusBar barStyle="light-content" />
<Background />
<Screens />
<ScreensContainer />
</MenuProvider>
</UnstatedProvider>
);
......@@ -74,12 +75,11 @@ const globalStackNavigationOptions = {
height: 60,
paddingTop: 0,
paddingBottom: 0,
padding: 14,
borderBottomWidth: 0.5,
borderBottomColor: colors.bg_text_sec
},
headerTitleStyle: {
display: 'none'
display: 'none',
},
headerBackTitleStyle: {
fontSize: 20,
......@@ -117,17 +117,16 @@ const Screens = createStackNavigator(
Security: {
screen: Security,
navigationOptions: {
headerTintColor: colors.card_bg,
headerLeft: <SecurityHeaderBackButton />,
headerLeft: <SecurityHeaderBackButton/>,
headerRight: null
}
}
},
{
{
defaultNavigationOptions: globalStackNavigationOptions,
headerMode: 'screen',
navigationOptions: globalStackNavigationOptions
}
)
),
},
TocAndPrivacyPolicy: {
screen: createStackNavigator(
......@@ -143,7 +142,6 @@ const Screens = createStackNavigator(
}
},
{
navigationOptions: globalStackNavigationOptions,
initialRouteParams: {
isWelcome: true
}
......@@ -152,7 +150,7 @@ const Screens = createStackNavigator(
},
Welcome: {
screen: createStackNavigator(
{
{
AccountList: {
screen: AccountList,
navigationOptions: {
......@@ -205,8 +203,8 @@ const Screens = createStackNavigator(
screen: AccountEdit
}
},
{
navigationOptions: globalStackNavigationOptions,
{
defaultNavigationOptions: globalStackNavigationOptions,
initialRouteParams: {
isWelcome: true
}
......@@ -219,3 +217,5 @@ const Screens = createStackNavigator(
mode: 'card'
}
);
const ScreensContainer = createAppContainer(Screens);
......@@ -18,7 +18,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import { ListView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { FlatList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import colors from '../colors';
import { brainWalletAddress, words } from '../util/native';
import AccountIcon from './AccountIcon';
......@@ -34,65 +34,67 @@ export default class AccountIconChooser extends React.PureComponent<{
constructor(props) {
super(props);
this.icons = [];
const iconsDS = new ListView.DataSource({
rowHasChanged: (r1, r2) => true
});
this.state = { iconsDS };
this.state = { icons: [] };
}
componentDidMount() {
this.refreshIcons();
}
refreshIcons = async () => {
try {
this.icons = [
...this.icons,
...(await Promise.all(
Array(10)
.join(' ')
.split(' ')
.map(async () => {
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed);
const icons = await Promise.all(
Array(10)
.join(' ')
.split(' ')
.map(async () => {
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed);
return {
seed,
address,
};
})
);
return {
seed,
address,
};
})
))
];
this.setState({ iconsDS: this.state.iconsDS.cloneWithRows(this.icons) });
this.setState({
icons
});
} catch (e) {
console.error(e);
}
};
componentDidMount() {
this.refreshIcons();
}
render() {
const { value, onChange } = this.props;
const { icons } = this.state;
console.log(icons);
return (
<View style={styles.body}>
<ListView
<FlatList
style={styles.icons}
dataSource={this.state.iconsDS}
horizontal={true}
renderRow={(
{ address, seed },
sectionID: number,
rowID: number,
highlightRow
) => {
const selected = address.toLowerCase() === value.toLowerCase();
data={icons}
horizontal
renderItem={({ item, index, separators }) => {
const selected = item.address.toLowerCase() === value.toLowerCase();
const style = [styles.icon];
return (
<TouchableOpacity
key={index}
style={[styles.iconBorder, selected ? styles.selected : {}]}
onPress={() => this.props.onChange({ address, seed })}
onPress={() =>
this.props.onChange({
address: item.address,
seed: item.seed,
})
}
onShowUnderlay={separators.highlight}
onHideUnderlay={separators.unhighlight}
>
<AccountIcon style={style} seed={'0x' + address} />
<AccountIcon style={style} seed={'0x' + item.address} />
</TouchableOpacity>
);
}}
......
......@@ -6,7 +6,7 @@ export default class HeaderLeftHome extends React.PureComponent {
render() {
return (
<View
style={{ flexDirection: 'row', alignItems: 'center' }}
style={{ flexDirection: 'row', alignItems: 'center', paddingLeft: 14 }}
accessibilityComponentType="button"
accessibilityTraits="button"
testID="header-back"
......@@ -26,7 +26,6 @@ const styles = StyleSheet.create({
height: 60,
flexDirection: 'row',
alignItems: 'center',
padding: 14,
borderBottomWidth: 0.5,
borderBottomColor: colors.bg_text_sec
},
......@@ -39,7 +38,6 @@ const styles = StyleSheet.create({
paddingLeft: 10,
fontSize: 25,
fontFamily: 'Manifold CF',
fontWeight: 'bold',
color: colors.bg_text
}
});
......@@ -27,7 +27,7 @@ export default class SecurityHeader extends React.Component {
render() {
return (
<Subscribe to={[SecurityStore]}>
{securityStore => (
{securityStore => (
<SecurityHeaderView level={securityStore.getLevel()} />
)}
</Subscribe>
......@@ -72,7 +72,8 @@ const styles = StyleSheet.create({
fontSize: 17,
fontFamily: 'Roboto',
fontWeight: 'bold',
color: colors.bg_text_positive
color: colors.bg_text_positive,
paddingRight: 14,
}
});
......
......@@ -17,8 +17,7 @@
'use strict';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import { StyleSheet, ScrollView, Text, View } from 'react-native';
import { Subscribe } from 'unstated';
import colors from '../colors';
import AccountIconChooser from '../components/AccountIconChooser';
......@@ -55,8 +54,9 @@ class AccountNewView extends React.Component {
return (
<View style={styles.body}>
<Background />
<KeyboardAwareScrollView
<ScrollView
style={{ padding: 20 }}
keyboardDismissMode="on-drag"
keyboardShouldPersistTaps="handled"
containerStyle={styles.bodyContainer}
>
......@@ -122,7 +122,7 @@ class AccountNewView extends React.Component {
}}
/>
</View>
</KeyboardAwareScrollView>
</ScrollView>
</View>
);
}
......
......@@ -54,7 +54,9 @@ class AccountPinView extends React.PureComponent {
const { accounts, navigation } = this.props;
const accountCreation = navigation.getParam('isNew');
const { pin } = this.state;
const account = accountCreation ? accounts.getNew() : accounts.getSelected();
const account = accountCreation
? accounts.getNew()
: accounts.getSelected();
if (
this.state.pin.length >= 6 &&
this.state.pin === this.state.confirmation
......@@ -63,15 +65,15 @@ class AccountPinView extends React.PureComponent {
await accounts.submitNew(pin);
const resetAction = StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'AccountList' }),
]
key: undefined, // FIXME workaround for now, use SwitchNavigator later: https://github.com/react-navigation/react-navigation/issues/1127#issuecomment-295841343
actions: [NavigationActions.navigate({ routeName: 'AccountList' })]
});
this.props.navigation.dispatch(resetAction);
} else {
await accounts.save(account, pin);
const resetAction = StackActions.reset({
index: 1,
key: undefined, // FIXME workaround for now, use SwitchNavigator later: https://github.com/react-navigation/react-navigation/issues/1127#issuecomment-295841343
actions: [
NavigationActions.navigate({ routeName: 'AccountList' }),
NavigationActions.navigate({ routeName: 'AccountDetails' })
......
......@@ -17,8 +17,7 @@
'use strict';
import React from 'react';
import { Alert, findNodeHandle, StyleSheet, Text, View } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import { Alert, findNodeHandle, StyleSheet, ScrollView, Text, View } from 'react-native';
import { Subscribe } from 'unstated';
import colors from '../colors';
import AccountCard from '../components/AccountCard';
......@@ -58,7 +57,7 @@ class AccountRecoverView extends React.Component {
return (
<View style={styles.body}>
<Background />
<KeyboardAwareScrollView
<ScrollView
style={{ padding: 20 }}
containerStyle={styles.bodyContainer}
enableOnAndroid
......@@ -107,9 +106,6 @@ class AccountRecoverView extends React.Component {
ENTER RECOVERY WORDS
</Text>
<AccountSeed
onFocus={e => {
this.scroll.props.scrollToFocusedInput(findNodeHandle(e.target));
}}
valid={validateSeed(selected.seed, selected.validBip39Seed).valid}
onChangeText={seed => {
accounts.updateNew({ seed });
......@@ -159,7 +155,7 @@ class AccountRecoverView extends React.Component {
});
}}
/>
</KeyboardAwareScrollView>
</ScrollView>
</View>
);
}
......
......@@ -50,6 +50,7 @@ export class AccountUnlockAndSign extends React.PureComponent {
navigate={() => {
const resetAction = StackActions.reset({
index: 1,
key: undefined, // FIXME workaround for now, use SwitchNavigator later: https://github.com/react-navigation/react-navigation/issues/1127#issuecomment-295841343
actions: [
NavigationActions.navigate({ routeName: 'AccountList' }),
NavigationActions.navigate({ routeName: next })
......@@ -84,6 +85,7 @@ export class AccountUnlock extends React.Component {
} else {
const resetAction = StackActions.reset({
index: 2,
key: undefined, // FIXME workaround for now, use SwitchNavigator later: https://github.com/react-navigation/react-navigation/issues/1127#issuecomment-295841343
actions: [
NavigationActions.navigate({ routeName: 'AccountList' }),
NavigationActions.navigate({ routeName: 'AccountDetails' }),
......
......@@ -19,7 +19,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Alert, StyleSheet, Text, View } from 'react-native';
import Camera from 'react-native-camera';
import { RNCamera } from 'react-native-camera';
import { Subscribe } from 'unstated';
import colors from '../colors';
import AccountsStore from '../stores/AccountsStore';
......@@ -113,7 +113,11 @@ export class QrScannerView extends React.PureComponent {
return <View style={styles.inactive} />;
}
return (
<Camera onBarCodeRead={this.props.onBarCodeRead} style={styles.view}>
<RNCamera
captureAudio={false}
onBarCodeRead={this.props.onBarCodeRead}
style={styles.view}
>
<View style={styles.body}>
<View style={styles.top}>
<Text style={styles.titleTop}>SCANNER</Text>
......@@ -128,7 +132,7 @@ export class QrScannerView extends React.PureComponent {
<Text style={styles.descSecondary}>To Sign a New Transaction</Text>
</View>
</View>
</Camera>
</RNCamera>
);
}
}
......
......@@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
// @flow
import { NetInfo } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import { Container } from 'unstated';
type SecurityState = {
......
This diff is collapsed.
Supports Markdown
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