From 29c045884d42727d9fd7b7330073409a33b61ddc Mon Sep 17 00:00:00 2001 From: "Andrew W. Hill" Date: Mon, 25 Mar 2019 08:55:31 -0700 Subject: [PATCH] Fix android onboarding (#978) * remove pages totally, slips a few permissions fixes in for android --- App/Containers/OnboardingScreen/index.tsx | 61 +++++++++++++---------- android/app/src/main/AndroidManifest.xml | 7 ++- package.json | 1 - yarn.lock | 8 +-- 4 files changed, 42 insertions(+), 35 deletions(-) diff --git a/App/Containers/OnboardingScreen/index.tsx b/App/Containers/OnboardingScreen/index.tsx index 6e43c600f..8e3aa1d56 100644 --- a/App/Containers/OnboardingScreen/index.tsx +++ b/App/Containers/OnboardingScreen/index.tsx @@ -1,6 +1,5 @@ import React from 'react' import { SafeAreaView, ViewStyle, View, TouchableOpacity } from 'react-native' -import { Pages } from 'react-native-pages' import { NavigationScreenProps } from 'react-navigation' import { connect } from 'react-redux' import { Dispatch } from 'redux' @@ -21,6 +20,14 @@ const CONTAINER: ViewStyle = { backgroundColor: color.screen_primary } +const DOT: ViewStyle = { + margin: 3, + height: 8, + width: 8, + backgroundColor: color.action_6, + borderRadius: 4 +} + const ARROW_FORWARD: ViewStyle = { position: 'absolute', bottom: spacing._016, @@ -41,6 +48,7 @@ type Props = StateProps & DispatchProps & NavigationScreenProps interface State { showArrow: boolean currentPage: number + disableNext: boolean } class OnboardingScreen extends React.Component { @@ -51,7 +59,8 @@ class OnboardingScreen extends React.Component { super(props) this.state = { showArrow: false, - currentPage: 0 + currentPage: 0, + disableNext: false } } @@ -62,28 +71,22 @@ class OnboardingScreen extends React.Component { } showArrowForIndex = (index: number) => { - if (!this.pages || !this.pages.props.children[index]) { - return false - } - const showArrow = this.pages.props.children[index].props.showArrow - return showArrow + return index <= 2 } nextPage = () => { - if (this.pages && this.pages.props.children.length - 1 > this.state.currentPage) { + if (!this.state.disableNext && this.pages && this.pages.length - 1 > this.state.currentPage) { this.setState({ - showArrow: this.showArrowForIndex(this.state.currentPage + 1) + showArrow: this.showArrowForIndex(this.state.currentPage + 1), + currentPage: this.state.currentPage + 1, + disableNext: true }) - this.pages.scrollToPage(this.state.currentPage + 1) + setTimeout(() => { + this.setState({disableNext: false}) + }, 750) } } - onScrollEnd = () => { - this.setState({ - currentPage: this.state.currentPage + 1 - }) - } - complete = () => { this.props.complete() this.props.navigation.navigate('StatusCheck') @@ -153,20 +156,26 @@ class OnboardingScreen extends React.Component { } render() { - const pages = this.pagesArray() + this.pages = this.pagesArray() return ( - { this.pages = pages ? pages : undefined }} - style={[CONTAINER]} - containerStyle={{ marginBottom: spacing._016 }} - indicatorColor={color.accent2_2} - scrollEnabled={false} - onScrollEnd={this.onScrollEnd} + - {pages} - + {this.pages[this.state.currentPage]} + + {this.state.currentPage < 7 && + + + + + + + + + + } {this.state.showArrow && diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b31b7c0d6..2171baa98 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ + package="com.textile" + xmlns:tools="http://schemas.android.com/tools"> @@ -8,6 +9,10 @@ + + + + diff --git a/package.json b/package.json index acbe8c19b..e89eb3afd 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "react-native-fs": "^2.11.17", "react-native-image-picker": "^0.27.1", "react-native-modal": "^6.5.0", - "react-native-pages": "^0.7.0", "react-native-push-notification": "^3.1.1", "react-native-qrcode": "^0.2.7", "react-native-scalable-image": "^0.4.0", diff --git a/yarn.lock b/yarn.lock index 203bb540c..97e8de3dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4693,7 +4693,7 @@ prompts@^0.1.9: kleur "^2.0.1" sisteransi "^0.1.1" -prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2: +prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2: version "15.6.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102" dependencies: @@ -4912,12 +4912,6 @@ react-native-modal@^6.5.0: prop-types "^15.6.1" react-native-animatable "^1.2.4" -react-native-pages@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/react-native-pages/-/react-native-pages-0.7.0.tgz#1ae1cddc136cdca54d3a61a47db79bae8d432fb8" - dependencies: - prop-types "^15.5.9" - react-native-platform-touchable@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/react-native-platform-touchable/-/react-native-platform-touchable-1.1.1.tgz#fde4acc65eea585d28b164d0c3716a42129a68e4"