mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 21:35:04 +03:00
commit
3641726fa0
25
package-lock.json
generated
25
package-lock.json
generated
@ -7710,6 +7710,15 @@
|
|||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
"jsonfile": "^2.1.0"
|
"jsonfile": "^2.1.0"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"react-native-keyboard-aware-scroll-view": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-nGXsACZBCiWuwRrZy+UjiSJqb4tZ/6ePHUSY8M+09g4VfNm/ogvvWpwBa6B999NZ6DwhZTKBjVWeZxX9XG8bbQ==",
|
||||||
|
"requires": {
|
||||||
|
"prop-types": "^15.6.0",
|
||||||
|
"react-native-iphone-x-helper": "^1.0.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8867,17 +8876,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-iphone-x-helper": {
|
"react-native-iphone-x-helper": {
|
||||||
"version": "1.0.3",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.2.0.tgz",
|
||||||
"integrity": "sha512-QHzpx4fv9u30VVU1DMgotiZsUB+m4BRjypca2rOczyj3cZBny5I+QDplrpFIBhzsa1iADNkziWa7kInzmKs00Q=="
|
"integrity": "sha512-xIeTo4s77wwKgBZLVRIZC9tM9/PkXS46Ul76NXmvmixEb3ZwqGdQesR3zRiLMOoIdfOURB6N9bba9po7+x9Bag=="
|
||||||
},
|
},
|
||||||
"react-native-keyboard-aware-scroll-view": {
|
"react-native-keyboard-aware-scroll-view": {
|
||||||
"version": "0.5.0",
|
"version": "0.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.7.2.tgz",
|
||||||
"integrity": "sha512-nGXsACZBCiWuwRrZy+UjiSJqb4tZ/6ePHUSY8M+09g4VfNm/ogvvWpwBa6B999NZ6DwhZTKBjVWeZxX9XG8bbQ==",
|
"integrity": "sha512-FCVKAmM5jHwbWZFW/zUOhid18OoSGcbyx2jGk+q6eVjjtj+RPomeqX0aAHf2ALXYJ1BuC5+OtXhFA/hp8ombcQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"prop-types": "^15.6.0",
|
"prop-types": "^15.6.2",
|
||||||
"react-native-iphone-x-helper": "^1.0.1"
|
"react-native-iphone-x-helper": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-lightbox": {
|
"react-native-lightbox": {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
"react-native-extended-stylesheet": "^0.10.0",
|
"react-native-extended-stylesheet": "^0.10.0",
|
||||||
"react-native-fast-image": "^4.0.14",
|
"react-native-fast-image": "^4.0.14",
|
||||||
"react-native-html-renderer": "^1.0.0",
|
"react-native-html-renderer": "^1.0.0",
|
||||||
|
"react-native-keyboard-aware-scroll-view": "^0.7.2",
|
||||||
"react-native-markdown-editor": "^1.0.1",
|
"react-native-markdown-editor": "^1.0.1",
|
||||||
"react-native-modal": "^6.5.0",
|
"react-native-modal": "^6.5.0",
|
||||||
"react-native-modal-popover": "0.0.10",
|
"react-native-modal-popover": "0.0.10",
|
||||||
|
BIN
src/assets/steem_connect.png
Normal file
BIN
src/assets/steem_connect.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -1,5 +1,5 @@
|
|||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
import { TouchableWithoutFeedback, Text } from "react-native";
|
import { TouchableWithoutFeedback, Text, View } from "react-native";
|
||||||
|
|
||||||
import styles from "./greetingHeaderButtonStyles";
|
import styles from "./greetingHeaderButtonStyles";
|
||||||
|
|
||||||
@ -9,7 +9,9 @@ const GreetingHeaderButtonView = ({ text, onPress, style }) => (
|
|||||||
style={[styles.button, style]}
|
style={[styles.button, style]}
|
||||||
onPress={() => onPress && onPress()}
|
onPress={() => onPress && onPress()}
|
||||||
>
|
>
|
||||||
<Text style={styles.buttonText}>{text}</Text>
|
<View>
|
||||||
|
<Text style={styles.buttonText}>{text}</Text>
|
||||||
|
</View>
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ export default EStyleSheet.create({
|
|||||||
borderTopLeftRadius: 8,
|
borderTopLeftRadius: 8,
|
||||||
borderTopRightRadius: 8,
|
borderTopRightRadius: 8,
|
||||||
marginHorizontal: 30,
|
marginHorizontal: 30,
|
||||||
marginVertical: 20,
|
marginVertical: 10,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
backgroundColor: "#f5f5f5",
|
backgroundColor: "#f5f5f5",
|
||||||
height: 60,
|
height: 60,
|
||||||
|
@ -5,7 +5,7 @@ export default EStyleSheet.create({
|
|||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
paddingLeft: 50,
|
paddingLeft: 50,
|
||||||
paddingRight: 32,
|
paddingRight: 32,
|
||||||
marginTop: 10,
|
marginTop: 20,
|
||||||
},
|
},
|
||||||
infoIcon: {
|
infoIcon: {
|
||||||
flex: 0.125,
|
flex: 0.125,
|
||||||
|
@ -26,7 +26,7 @@ class LoginHeaderView extends Component {
|
|||||||
// Component Functions
|
// Component Functions
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { description, title } = this.props;
|
const { description, title, onPress, isKeyboardOpen } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View styles={styles.container}>
|
<View styles={styles.container}>
|
||||||
@ -36,21 +36,23 @@ class LoginHeaderView extends Component {
|
|||||||
source={require("../../../assets/esteem.png")}
|
source={require("../../../assets/esteem.png")}
|
||||||
/>
|
/>
|
||||||
<View style={styles.headerButton}>
|
<View style={styles.headerButton}>
|
||||||
<GreetingHeaderButton text="Sign up" />
|
<GreetingHeaderButton onPress={onPress} text="Sign up" />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.body}>
|
{!isKeyboardOpen && (
|
||||||
<View style={styles.titleText}>
|
<View style={styles.body}>
|
||||||
<Text style={styles.title}>{title}</Text>
|
<View style={styles.titleText}>
|
||||||
<Text style={styles.description}>{description}</Text>
|
<Text style={styles.title}>{title}</Text>
|
||||||
|
<Text style={styles.description}>{description}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 0.7 }}>
|
||||||
|
<Image
|
||||||
|
style={styles.mascot}
|
||||||
|
source={require("../../../assets/love_mascot.png")}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ flex: 0.7 }}>
|
)}
|
||||||
<Image
|
|
||||||
style={styles.mascot}
|
|
||||||
source={require("../../../assets/love_mascot.png")}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<LineBreak />
|
<LineBreak />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
3
src/components/mainButton/index.js
Normal file
3
src/components/mainButton/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import MainButton from "./view/mainButtonView";
|
||||||
|
|
||||||
|
export { MainButton };
|
48
src/components/mainButton/view/mainButtonStyles.js
Normal file
48
src/components/mainButton/view/mainButtonStyles.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import EStyleSheet from "react-native-extended-stylesheet";
|
||||||
|
|
||||||
|
export default EStyleSheet.create({
|
||||||
|
wrapper: {},
|
||||||
|
touchable: {
|
||||||
|
maxWidth: 200,
|
||||||
|
minWidth: 56,
|
||||||
|
height: 56,
|
||||||
|
borderRadius: 30,
|
||||||
|
backgroundColor: "#357ce6",
|
||||||
|
flexDirection: "row",
|
||||||
|
margin: 5,
|
||||||
|
shadowOffset: {
|
||||||
|
height: 5,
|
||||||
|
},
|
||||||
|
shadowColor: "#5f5f5fbf",
|
||||||
|
shadowOpacity: 0.3,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
alignSelf: "center",
|
||||||
|
fontSize: 25,
|
||||||
|
marginLeft: 20,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
color: "white",
|
||||||
|
fontWeight: "400",
|
||||||
|
alignSelf: "center",
|
||||||
|
fontSize: 14,
|
||||||
|
paddingLeft: 10,
|
||||||
|
paddingRight: 20,
|
||||||
|
},
|
||||||
|
secondText: {
|
||||||
|
fontWeight: "bold",
|
||||||
|
},
|
||||||
|
activityIndicator: {
|
||||||
|
minWidth: 56,
|
||||||
|
height: 56,
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
flexDirection: "row",
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
marginLeft: 20,
|
||||||
|
alignSelf: "center",
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
},
|
||||||
|
});
|
93
src/components/mainButton/view/mainButtonView.js
Normal file
93
src/components/mainButton/view/mainButtonView.js
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
import React, { Component, Fragment } from "react";
|
||||||
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
|
Image,
|
||||||
|
Text,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from "react-native";
|
||||||
|
import Ionicons from "react-native-vector-icons/Ionicons";
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
|
||||||
|
// Components
|
||||||
|
|
||||||
|
// Styles
|
||||||
|
import styles from "./mainButtonStyles";
|
||||||
|
|
||||||
|
class MainButton extends Component {
|
||||||
|
/* Props
|
||||||
|
* ------------------------------------------------
|
||||||
|
* @prop { string } isLoading - TODO:
|
||||||
|
* @prop { string } text - TODO:
|
||||||
|
* @prop { boolean } secondText - TODO:
|
||||||
|
* @prop { boolean } iconColor - TODO:
|
||||||
|
* @prop { boolean } iconName - TODO:
|
||||||
|
* @prop { boolean } isDisable - TODO:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.state = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Component Life Cycles
|
||||||
|
|
||||||
|
// Component Functions
|
||||||
|
_handleOnPress = () => {
|
||||||
|
const { onPress, isDisable, source } = this.props;
|
||||||
|
|
||||||
|
onPress && !isDisable && onPress();
|
||||||
|
};
|
||||||
|
|
||||||
|
_getBody = () => {
|
||||||
|
const {
|
||||||
|
isLoading,
|
||||||
|
text,
|
||||||
|
secondText,
|
||||||
|
iconColor,
|
||||||
|
iconName,
|
||||||
|
source,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<ActivityIndicator color="white" style={styles.activityIndicator} />
|
||||||
|
);
|
||||||
|
} else if (text) {
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
{source ? (
|
||||||
|
<Image source={source} style={styles.image} resizeMode="contain" />
|
||||||
|
) : (
|
||||||
|
<Ionicons color={iconColor} name={iconName} style={styles.icon} />
|
||||||
|
)}
|
||||||
|
<Text style={styles.text}>
|
||||||
|
{text}
|
||||||
|
{secondText && <Text style={styles.secondText}>{secondText}</Text>}
|
||||||
|
</Text>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return <Ionicons color={iconColor} name={iconName} style={styles.icon} />;
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { wrapperStyle, isDisable } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={wrapperStyle}>
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => this._handleOnPress()}
|
||||||
|
style={styles.touchable}
|
||||||
|
>
|
||||||
|
<View style={styles.body}>{this._getBody()}</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MainButton;
|
@ -1,151 +1,143 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import {
|
import {
|
||||||
Text,
|
Text,
|
||||||
View,
|
View,
|
||||||
Animated,
|
Animated,
|
||||||
TouchableNativeFeedback,
|
TouchableNativeFeedback,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
Platform,
|
Platform,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
import styles from "./tabBarStyles";
|
import styles from "./tabBarStyles";
|
||||||
|
|
||||||
export default class TabBar extends Component {
|
export default class TabBar extends Component {
|
||||||
/* Props
|
/* Props
|
||||||
* ------------------------------------------------ TODO: Fill fallowlines
|
* ------------------------------------------------ TODO: Fill fallowlines
|
||||||
* @prop { type } name - Description.
|
* @prop { type } name - Description.
|
||||||
* @prop { type } name - Description.
|
* @prop { type } name - Description.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {};
|
this.state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
_renderTab = (name, page, isTabActive, onPressHandler) => {
|
_renderTab = (name, page, isTabActive, onPressHandler) => {
|
||||||
const { activeColor, inactiveColor } = this.props;
|
const { activeColor, inactiveColor } = this.props;
|
||||||
const textColor = isTabActive ? activeColor : inactiveColor;
|
const textColor = isTabActive ? activeColor : inactiveColor;
|
||||||
const fontWeight = isTabActive ? "bold" : "normal";
|
const fontWeight = isTabActive ? "bold" : "normal";
|
||||||
const Button = Platform.OS == "ios" ? ButtonIos : ButtonAndroid;
|
const Button = Platform.OS == "ios" ? ButtonIos : ButtonAndroid;
|
||||||
// TODO: make generic component!!
|
// TODO: make generic component!!
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
style={styles.tabButton}
|
style={styles.tabButton}
|
||||||
key={name}
|
key={name}
|
||||||
accessible={true}
|
accessible={true}
|
||||||
accessibilityLabel={name}
|
accessibilityLabel={name}
|
||||||
accessibilityTraits="button"
|
accessibilityTraits="button"
|
||||||
onPress={() => onPressHandler(page)}
|
onPress={() => onPressHandler(page)}
|
||||||
>
|
>
|
||||||
<View style={styles.tab}>
|
<View style={styles.tab}>
|
||||||
<Text style={[{ color: textColor, fontWeight }]}>
|
<Text style={[{ color: textColor, fontWeight }]}>{name}</Text>
|
||||||
{name}
|
</View>
|
||||||
</Text>
|
</Button>
|
||||||
</View>
|
);
|
||||||
</Button>
|
};
|
||||||
);
|
|
||||||
|
_renderUnderline = () => {
|
||||||
|
const {
|
||||||
|
activeColor,
|
||||||
|
tabs,
|
||||||
|
tabUnderlineDefaultWidth,
|
||||||
|
tabUnderlineScaleX,
|
||||||
|
scrollValue,
|
||||||
|
underlineStyle,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const containerWidth = Dimensions.get("window").width;
|
||||||
|
const numberOfTabs = tabs.length;
|
||||||
|
const underlineWidth =
|
||||||
|
tabUnderlineDefaultWidth || containerWidth / (numberOfTabs * 2);
|
||||||
|
const scale = tabUnderlineScaleX || 2;
|
||||||
|
const deLen = (containerWidth / numberOfTabs - underlineWidth) / 2;
|
||||||
|
const tabUnderlineStyle = {
|
||||||
|
position: "absolute",
|
||||||
|
width: underlineWidth,
|
||||||
|
height: 2,
|
||||||
|
borderRadius: 2,
|
||||||
|
backgroundColor: activeColor,
|
||||||
|
bottom: 0,
|
||||||
|
left: deLen,
|
||||||
};
|
};
|
||||||
|
|
||||||
_renderUnderline = () => {
|
const translateX = scrollValue.interpolate({
|
||||||
const {
|
inputRange: [0, 1],
|
||||||
activeColor,
|
outputRange: [0, containerWidth / numberOfTabs],
|
||||||
tabs,
|
});
|
||||||
tabUnderlineDefaultWidth,
|
|
||||||
tabUnderlineScaleX,
|
|
||||||
scrollValue,
|
|
||||||
underlineStyle,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
const containerWidth = Dimensions.get("window").width;
|
const scaleValue = defaultScale => {
|
||||||
const numberOfTabs = tabs.length;
|
const number = 4;
|
||||||
const underlineWidth =
|
const arr = new Array(number * 2);
|
||||||
tabUnderlineDefaultWidth || containerWidth / (numberOfTabs * 2);
|
|
||||||
const scale = tabUnderlineScaleX || 2;
|
|
||||||
const deLen = (containerWidth / numberOfTabs - underlineWidth) / 2;
|
|
||||||
const tabUnderlineStyle = {
|
|
||||||
position: "absolute",
|
|
||||||
width: underlineWidth,
|
|
||||||
height: 2,
|
|
||||||
borderRadius: 2,
|
|
||||||
backgroundColor: activeColor,
|
|
||||||
bottom: 0,
|
|
||||||
left: deLen,
|
|
||||||
};
|
|
||||||
|
|
||||||
const translateX = scrollValue.interpolate({
|
return arr.fill(0).reduce(
|
||||||
inputRange: [0, 1],
|
function(pre, cur, idx) {
|
||||||
outputRange: [0, containerWidth / numberOfTabs],
|
idx == 0
|
||||||
});
|
? pre.inputRange.push(cur)
|
||||||
|
: pre.inputRange.push(pre.inputRange[idx - 1] + 0.5);
|
||||||
const scaleValue = defaultScale => {
|
idx % 2
|
||||||
const number = 4;
|
? pre.outputRange.push(defaultScale)
|
||||||
const arr = new Array(number * 2);
|
: pre.outputRange.push(1);
|
||||||
|
return pre;
|
||||||
return arr.fill(0).reduce(
|
},
|
||||||
function(pre, cur, idx) {
|
{ inputRange: [], outputRange: [] }
|
||||||
idx == 0
|
);
|
||||||
? pre.inputRange.push(cur)
|
|
||||||
: pre.inputRange.push(pre.inputRange[idx - 1] + 0.5);
|
|
||||||
idx % 2
|
|
||||||
? pre.outputRange.push(defaultScale)
|
|
||||||
: pre.outputRange.push(1);
|
|
||||||
return pre;
|
|
||||||
},
|
|
||||||
{ inputRange: [], outputRange: [] }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const scaleX = scrollValue.interpolate(scaleValue(scale));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Animated.View
|
|
||||||
style={[
|
|
||||||
tabUnderlineStyle,
|
|
||||||
{
|
|
||||||
transform: [{ translateX }, { scaleX }],
|
|
||||||
},
|
|
||||||
underlineStyle,
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
const scaleX = scrollValue.interpolate(scaleValue(scale));
|
||||||
const { activeTab, backgroundColor, goToPage, style } = this.props;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.tabs,
|
tabUnderlineStyle,
|
||||||
{ backgroundColor: backgroundColor },
|
{
|
||||||
style,
|
transform: [{ translateX }, { scaleX }],
|
||||||
]}
|
},
|
||||||
>
|
underlineStyle,
|
||||||
{this.props.tabs.map((name, page) => {
|
]}
|
||||||
const isTabActive = activeTab === page;
|
/>
|
||||||
return this._renderTab(name, page, isTabActive, goToPage);
|
);
|
||||||
})}
|
};
|
||||||
{this._renderUnderline()}
|
|
||||||
</View>
|
render() {
|
||||||
);
|
const { activeTab, backgroundColor, goToPage, style } = this.props;
|
||||||
}
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.tabs, { backgroundColor: backgroundColor }, style]}>
|
||||||
|
{this.props.tabs.map((name, page) => {
|
||||||
|
const isTabActive = activeTab === page;
|
||||||
|
return this._renderTab(name, page, isTabActive, goToPage);
|
||||||
|
})}
|
||||||
|
{this._renderUnderline()}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ButtonAndroid = props => (
|
const ButtonAndroid = props => (
|
||||||
<TouchableNativeFeedback
|
<TouchableNativeFeedback
|
||||||
delayPressIn={0}
|
delayPressIn={0}
|
||||||
background={TouchableNativeFeedback.SelectableBackground()}
|
background={TouchableNativeFeedback.SelectableBackground()}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</TouchableNativeFeedback>
|
</TouchableNativeFeedback>
|
||||||
);
|
);
|
||||||
|
|
||||||
const ButtonIos = props => (
|
const ButtonIos = props => (
|
||||||
<TouchableOpacity {...props}>{props.children}</TouchableOpacity>
|
<TouchableOpacity {...props}>{props.children}</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
@ -1,68 +1,26 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import {
|
import { View, BackHandler, Linking, StatusBar } from "react-native";
|
||||||
View,
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
|
||||||
ActivityIndicator,
|
|
||||||
Text,
|
|
||||||
Image,
|
|
||||||
TouchableOpacity,
|
|
||||||
TextInput,
|
|
||||||
BackHandler,
|
|
||||||
Linking,
|
|
||||||
StatusBar,
|
|
||||||
} from "react-native";
|
|
||||||
|
|
||||||
import { Navigation } from "react-native-navigation";
|
|
||||||
import Ionicons from "react-native-vector-icons/Ionicons";
|
|
||||||
import FastImage from "react-native-fast-image";
|
|
||||||
|
|
||||||
import { TabBar } from "../../../components/tabBar";
|
|
||||||
import { LoginHeader } from "../../../components/loginHeader";
|
|
||||||
import { FormInput } from "../../../components/formInput";
|
|
||||||
import { InformationArea } from "../../../components/informationArea";
|
|
||||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||||
|
|
||||||
|
// Internal Components
|
||||||
|
import { FormInput } from "../../../components/formInput";
|
||||||
|
import { GreetingHeaderButton } from "../../../components/buttons";
|
||||||
|
import { InformationArea } from "../../../components/informationArea";
|
||||||
import { Login } from "../../../providers/steem/auth";
|
import { Login } from "../../../providers/steem/auth";
|
||||||
|
import { LoginHeader } from "../../../components/loginHeader";
|
||||||
|
import { MainButton } from "../../../components/mainButton";
|
||||||
|
import { Navigation } from "react-native-navigation";
|
||||||
|
import { TabBar } from "../../../components/tabBar";
|
||||||
import { addNewAccount } from "../../../redux/actions/accountAction";
|
import { addNewAccount } from "../../../redux/actions/accountAction";
|
||||||
|
|
||||||
import { lookupAccounts } from "../../../providers/steem/dsteem";
|
|
||||||
import { goToAuthScreens } from "../../../navigation";
|
import { goToAuthScreens } from "../../../navigation";
|
||||||
|
import { lookupAccounts } from "../../../providers/steem/dsteem";
|
||||||
|
import STEEM_CONNECT_LOGO from "../../../assets/steem_connect.png";
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
import styles from "./loginStyles";
|
import styles from "./loginStyles";
|
||||||
|
|
||||||
class LoginScreen extends Component {
|
class LoginScreen extends Component {
|
||||||
static get options() {
|
|
||||||
return {
|
|
||||||
_statusBar: {
|
|
||||||
visible: true,
|
|
||||||
drawBehind: false,
|
|
||||||
},
|
|
||||||
topBar: {
|
|
||||||
animate: true,
|
|
||||||
hideOnScroll: false,
|
|
||||||
drawBehind: false,
|
|
||||||
noBorder: true,
|
|
||||||
visible: true,
|
|
||||||
elevation: 0,
|
|
||||||
leftButtons: {},
|
|
||||||
rightButtons: [
|
|
||||||
{
|
|
||||||
id: "signup",
|
|
||||||
text: "Sign Up",
|
|
||||||
color: "#a7adaf",
|
|
||||||
marginRight: 50,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
layout: {
|
|
||||||
backgroundColor: "#f5fcff",
|
|
||||||
},
|
|
||||||
bottomTabs: {
|
|
||||||
visible: false,
|
|
||||||
drawBehind: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
Navigation.events().bindComponent(this);
|
Navigation.events().bindComponent(this);
|
||||||
@ -72,6 +30,7 @@ class LoginScreen extends Component {
|
|||||||
password: "",
|
password: "",
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isUsernameValid: true,
|
isUsernameValid: true,
|
||||||
|
keyboardIsOpen: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,15 +86,13 @@ class LoginScreen extends Component {
|
|||||||
this.setState({ password: value });
|
this.setState({ password: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
navigationButtonPressed({ buttonId }) {
|
_handleSignUp = () => {
|
||||||
if (buttonId === "signup") {
|
Linking.openURL("https://signup.steemit.com/?ref=esteem").catch(err =>
|
||||||
Linking.openURL("https://signup.steemit.com/?ref=esteem").catch(err =>
|
console.error("An error occurred", err)
|
||||||
console.error("An error occurred", err)
|
);
|
||||||
);
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loginwithSc2 = () => {
|
_loginwithSc2 = () => {
|
||||||
Navigation.push(this.props.componentId, {
|
Navigation.push(this.props.componentId, {
|
||||||
component: {
|
component: {
|
||||||
name: "navigation.eSteem.SteemConnect",
|
name: "navigation.eSteem.SteemConnect",
|
||||||
@ -152,170 +109,88 @@ class LoginScreen extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { isLoading, username, isUsernameValid, keyboardIsOpen } = this.state;
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<StatusBar hidden translucent />
|
<StatusBar hidden translucent />
|
||||||
<LoginHeader
|
<LoginHeader
|
||||||
|
isKeyboardOpen={keyboardIsOpen}
|
||||||
title="Sign in"
|
title="Sign in"
|
||||||
description="To get all the benefits using eSteem"
|
description="To get all the benefits using eSteem"
|
||||||
|
onPress={() => this._handleSignUp()}
|
||||||
/>
|
/>
|
||||||
<ScrollableTabView
|
<KeyboardAwareScrollView
|
||||||
style={styles.tabView}
|
onKeyboardWillShow={() => this.setState({ keyboardIsOpen: true })}
|
||||||
renderTabBar={() => (
|
onKeyboardWillHide={() => this.setState({ keyboardIsOpen: false })}
|
||||||
<TabBar
|
|
||||||
style={styles.tabbar}
|
|
||||||
tabUnderlineDefaultWidth={100} // default containerWidth / (numberOfTabs * 4)
|
|
||||||
tabUnderlineScaleX={2} // default 3
|
|
||||||
activeColor={"#357ce6"}
|
|
||||||
inactiveColor={"#222"}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<View tabLabel="Sign in" style={styles.tabbarItem}>
|
<ScrollableTabView
|
||||||
<FormInput
|
locked={isLoading}
|
||||||
rightIconName="md-at"
|
style={styles.tabView}
|
||||||
leftIconName="md-close-circle"
|
renderTabBar={() => (
|
||||||
isValid={this.state.isUsernameValid}
|
<TabBar
|
||||||
onChange={value => this.handleUsername(value)}
|
style={styles.tabbar}
|
||||||
placeholder="Username"
|
tabUnderlineDefaultWidth={100} // default containerWidth / (numberOfTabs * 4)
|
||||||
isEditable
|
tabUnderlineScaleX={2} // default 3
|
||||||
type="username"
|
activeColor={"#357ce6"}
|
||||||
isFirstImage
|
inactiveColor={"#222"}
|
||||||
value={this.state.username}
|
/>
|
||||||
/>
|
)}
|
||||||
<FormInput
|
>
|
||||||
rightIconName="md-lock"
|
<View tabLabel="Sign in" style={styles.tabbarItem}>
|
||||||
leftIconName="md-close-circle"
|
<FormInput
|
||||||
isValid={this.state.isUsernameValid}
|
rightIconName="md-at"
|
||||||
onChange={value => this._handleOnPasswordChange(value)}
|
leftIconName="md-close-circle"
|
||||||
placeholder="Password or WIF"
|
isValid={isUsernameValid}
|
||||||
isEditable
|
onChange={value => this.handleUsername(value)}
|
||||||
secureTextEntry
|
placeholder="Username"
|
||||||
type="password"
|
isEditable
|
||||||
/>
|
type="username"
|
||||||
|
isFirstImage
|
||||||
<InformationArea
|
value={username}
|
||||||
description="User credentials are kept locally on the device. Credentials are
|
/>
|
||||||
|
<FormInput
|
||||||
|
rightIconName="md-lock"
|
||||||
|
leftIconName="md-close-circle"
|
||||||
|
isValid={isUsernameValid}
|
||||||
|
onChange={value => this._handleOnPasswordChange(value)}
|
||||||
|
placeholder="Password or WIF"
|
||||||
|
isEditable
|
||||||
|
secureTextEntry
|
||||||
|
type="password"
|
||||||
|
/>
|
||||||
|
<InformationArea
|
||||||
|
description="User credentials are kept locally on the device. Credentials are
|
||||||
removed upon logout!"
|
removed upon logout!"
|
||||||
iconName="ios-information-circle-outline"
|
iconName="ios-information-circle-outline"
|
||||||
/>
|
/>
|
||||||
<View style={{ flexDirection: "row", margin: 30 }}>
|
{/* It will remove */}
|
||||||
<View style={{ flex: 0.6 }}>
|
<GreetingHeaderButton onPress={goToAuthScreens} text="cancel" />
|
||||||
<TouchableOpacity
|
<MainButton
|
||||||
onPress={goToAuthScreens}
|
wrapperStyle={styles.mainButtonWrapper}
|
||||||
style={{
|
|
||||||
alignContent: "center",
|
|
||||||
padding: "9%",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
color: "#788187",
|
|
||||||
alignSelf: "center",
|
|
||||||
fontWeight: "bold",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
<TouchableOpacity
|
|
||||||
onPress={this._handleOnPressLogin}
|
onPress={this._handleOnPressLogin}
|
||||||
style={{
|
iconName="md-person"
|
||||||
flex: 0.4,
|
iconColor="white"
|
||||||
width: 100,
|
text="LOGIN"
|
||||||
height: 50,
|
isLoading={isLoading}
|
||||||
borderRadius: 30,
|
/>
|
||||||
backgroundColor: "#357ce6",
|
|
||||||
flexDirection: "row",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!this.state.isLoading ? (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: "row",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Ionicons
|
|
||||||
color="white"
|
|
||||||
name="md-person"
|
|
||||||
style={{
|
|
||||||
alignSelf: "center",
|
|
||||||
fontSize: 25,
|
|
||||||
flex: 0.4,
|
|
||||||
left: 15,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
color: "white",
|
|
||||||
fontWeight: "600",
|
|
||||||
alignSelf: "center",
|
|
||||||
fontSize: 16,
|
|
||||||
flex: 0.6,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
LOGIN
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
) : (
|
|
||||||
<ActivityIndicator
|
|
||||||
color="white"
|
|
||||||
style={{ alignSelf: "center", flex: 1 }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
<View tabLabel="SteemConnect" style={styles.steemConnectTab}>
|
||||||
<View tabLabel="SteemConnect" style={styles.steemConnectTab}>
|
<InformationArea
|
||||||
<InformationArea
|
description="If you don't want to keep your password encrypted and saved on your device, you can use Steemconnect."
|
||||||
description="If you don't want to keep your password encrypted and saved on your device, you can use Steemconnect."
|
iconName="ios-information-circle-outline"
|
||||||
iconName="ios-information-circle-outline"
|
/>
|
||||||
/>
|
|
||||||
<View
|
<MainButton
|
||||||
style={{
|
wrapperStyle={styles.mainButtonWrapper}
|
||||||
alignItems: "flex-end",
|
onPress={this._loginwithSc2}
|
||||||
backgroundColor: "#ffffff",
|
iconName="md-person"
|
||||||
}}
|
source={STEEM_CONNECT_LOGO}
|
||||||
>
|
text="steem"
|
||||||
<TouchableOpacity
|
secondText="connect"
|
||||||
onPress={this.loginwithSc2}
|
/>
|
||||||
style={{
|
|
||||||
width: 200,
|
|
||||||
height: 50,
|
|
||||||
borderRadius: 30,
|
|
||||||
backgroundColor: "#357ce6",
|
|
||||||
flexDirection: "row",
|
|
||||||
margin: 20,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<View style={{ flex: 1, flexDirection: "row" }}>
|
|
||||||
<Ionicons
|
|
||||||
color="white"
|
|
||||||
name="md-person"
|
|
||||||
style={{
|
|
||||||
alignSelf: "center",
|
|
||||||
fontSize: 25,
|
|
||||||
marginHorizontal: 20,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
color: "white",
|
|
||||||
fontWeight: "400",
|
|
||||||
alignSelf: "center",
|
|
||||||
fontSize: 16,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
steem
|
|
||||||
<Text style={{ fontWeight: "800" }}>connect</Text>
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</ScrollableTabView>
|
||||||
</ScrollableTabView>
|
</KeyboardAwareScrollView>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,18 @@ export default EStyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: "#ffffff",
|
backgroundColor: "#ffffff",
|
||||||
minWidth: "$deviceWidth",
|
minWidth: "$deviceWidth",
|
||||||
|
height: "$deviceHeight / 1.95",
|
||||||
},
|
},
|
||||||
steemConnectTab: {
|
steemConnectTab: {
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
minWidth: "$deviceWidth",
|
minWidth: "$deviceWidth",
|
||||||
|
flex: 1,
|
||||||
|
height: "$deviceHeight / 1.95",
|
||||||
|
},
|
||||||
|
mainButtonWrapper: {
|
||||||
|
position: "absolute",
|
||||||
|
right: 24,
|
||||||
|
bottom: 24,
|
||||||
|
flexDirection: "row",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user