removed old appliction.js

This commit is contained in:
ue 2018-11-21 22:45:57 +03:00
parent 53db09b000
commit de141c7d96
6 changed files with 11 additions and 189 deletions

View File

@ -1,4 +1,4 @@
{
"name": "esteem",
"displayName": "esteem"
"name": "eSteem",
"displayName": "eSteem"
}

View File

@ -1,68 +0,0 @@
import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import EStyleSheet from 'react-native-extended-stylesheet';
import { IntlProvider, addLocaleData } from 'react-intl';
import en from 'react-intl/locale-data/en';
import tr from 'react-intl/locale-data/tr';
import { ReduxNavigation } from './config/reduxNavigation';
import { flattenMessages } from './utils/flattenMessages';
import messages from './config/locales';
// themes
import darkTheme from './themes/darkTheme';
import lightTheme from './themes/lightTheme';
addLocaleData([...en, ...tr]);
// symbol polyfills
global.Symbol = require('core-js/es6/symbol');
require('core-js/fn/symbol/iterator');
// collection fn polyfills
require('core-js/fn/map');
require('core-js/fn/set');
require('core-js/fn/array/find');
class Application extends Component {
constructor() {
super();
this.state = {
shouldRender: true,
};
}
componentDidMount() {
const { isDarkTheme } = this.props;
EStyleSheet.build(isDarkTheme ? darkTheme : lightTheme);
}
componentWillReceiveProps(nextProps) {
const { isDarkTheme } = this.props;
if (isDarkTheme !== nextProps.isDarkTheme) {
const theme = nextProps.isDarkTheme ? darkTheme : lightTheme;
EStyleSheet.build(theme);
this.setState({ shouldRender: false }, () => this.setState({ shouldRender: true }));
}
}
render() {
const { children, shouldRender, selectedLanguage } = this.props;
const locale = (navigator.languages && navigator.languages[0])
|| navigator.language
|| navigator.userLanguage
|| selectedLanguage;
return (
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
<ReduxNavigation />
</IntlProvider>
);
}
}
const mapStateToProps = state => ({
isDarkTheme: state.application.isDarkTheme,
selectedLanguage: state.application.language,
});
export default connect(mapStateToProps)(Application);

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Provider } from 'react-redux';
import Application from './application';
import { Application } from './screens/application';
import store from './redux/store/store';
export default () => (

View File

@ -1,109 +0,0 @@
/* eslint-disable no-unused-vars */
import React from 'react';
import {
View, Text, BackHandler, AsyncStorage, Picker,
} from 'react-native';
import { Navigation } from 'react-native-navigation';
/* eslint-enable no-unused-vars */
class ProfilePage extends React.Component {
static get options() {
return {
_statusBar: {
visible: true,
drawBehind: false,
},
topBar: {
animate: true,
hideOnScroll: false,
drawBehind: false,
leftButtons: {},
},
layout: {
backgroundColor: '#f5fcff',
},
bottomTabs: {
visible: false,
drawBehind: true,
},
};
}
constructor() {
super();
this.saveServer = this.saveServer.bind(this);
this.state = {
server: '',
clients: [],
};
}
async componentWillMount() {
const clients = await fetch(
'https://storage.googleapis.com/esteem/public_nodes.json',
);
const clientsJson = await clients.json();
console.log(clientsJson.steemd);
this.setState({
clients: clientsJson.steemd,
});
const server = await AsyncStorage.getItem('server');
if (server === null || server === undefined || server === '') {
this.setState({
server: 'https://api.steemit.com',
});
} else {
this.setState({
server,
});
}
BackHandler.addEventListener('hardwareBackPress', () => {
Navigation.pop(this.props.componentId);
return true;
});
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress');
}
navigationButtonPressed({ buttonId }) {
console.log(buttonId);
if (buttonId === 'back') {
Navigation.pop(this.props.componentId);
}
}
saveServer = async (server) => {
try {
await AsyncStorage.setItem('server', server);
this.setState({
server,
});
} catch (error) {
console.log(error);
}
};
render() {
return (
<View>
<Text>Settings</Text>
<Picker
selectedValue={this.state.server}
style={{ height: 50, width: 250 }}
onValueChange={(itemValue, itemIndex) => this.saveServer(itemValue)
}
>
{this.state.clients.map(client => <Picker.Item value={client} label={client} />)}
</Picker>
</View>
);
}
}
export default ProfilePage;

View File

@ -6,8 +6,8 @@ import { flattenMessages } from '../../../utils/flattenMessages';
import messages from '../../../config/locales';
class ApplicationScreen extends Component {
constructor() {
super();
constructor(props) {
super(props);
this.state = {};
}

View File

@ -53,9 +53,9 @@ class SettingsScreen extends Component {
id: 'settings.currency',
})}
type="dropdown"
actionType="language"
options={LANGUAGE}
selectedOptionIndex={LANGUAGE_VALUE.indexOf(selectedLanguage)}
actionType="currency"
options={CURRENCY}
selectedOptionIndex={CURRENCY_VALUE.indexOf(selectedCurrency)}
handleOnChange={handleOnChange}
/>
<SettingsItem
@ -63,9 +63,9 @@ class SettingsScreen extends Component {
id: 'settings.language',
})}
type="dropdown"
actionType="currency"
options={CURRENCY}
selectedOptionIndex={CURRENCY_VALUE.indexOf(selectedCurrency)}
actionType="language"
options={LANGUAGE}
selectedOptionIndex={LANGUAGE_VALUE.indexOf(selectedLanguage)}
handleOnChange={handleOnChange}
/>
<SettingsItem
@ -88,7 +88,6 @@ class SettingsScreen extends Component {
handleOnChange={handleOnChange}
/>
<SettingsItem
title="Push Notification"
title={intl.formatMessage({
id: 'settings.push_notification',
})}