Skip to content

Commit 6c341c4

Browse files
authored
Merge pull request #274 from badger-cash/slider-nav
Pure javascript slider
2 parents 0ee30df + 71b1d0f commit 6c341c4

File tree

10 files changed

+84
-355
lines changed

10 files changed

+84
-355
lines changed

App.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ import { View, LogBox } from "react-native";
99
LogBox.ignoreLogs(["Require cycle"]);
1010
import { PersistGate } from "redux-persist/integration/react";
1111

12-
import AppNavigator from "./navigation/AppNavigator";
1312
import { getStore } from "./data/store";
1413
import { spaceBadger } from "./themes/spaceBadger";
15-
import { StackFrame } from "react-native/Libraries/Core/Devtools/parseErrorStack";
1614
import MainAppStack from "./navigation/MainTabNavigator";
1715
import AuthLoadingScreen from "./navigation/AuthLoadingScreen";
18-
// import AuthStack from "./navigation/AuthStack";
1916
// Auth Screens
2017
import WelcomeScreen from "./screens/WelcomeScreen";
2118
import TermsOfUseScreen from "./screens/TermsOfUseScreen";

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ android {
137137
applicationId "com.badgermobile"
138138
minSdkVersion rootProject.ext.minSdkVersion
139139
targetSdkVersion rootProject.ext.targetSdkVersion
140-
versionCode 9000028
141-
versionName "1.13.5"
140+
versionCode 9000031
141+
versionName "1.13.8"
142142
missingDimensionStrategy 'react-native-camera', 'general'
143143
}
144144
splits {

atoms/SwipeButton/SwipeButton.tsx

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
import React, { useState, useEffect } from "react";
2-
import { ActivityIndicator, View, Dimensions } from "react-native";
2+
import { ActivityIndicator, View, StyleSheet } from "react-native";
3+
import { Slider } from "@miblanchard/react-native-slider";
34
import styled from "styled-components";
4-
5-
// import Swipeable from "react-native-swipeable-patched";
6-
import Ionicons from "react-native-vector-icons/Ionicons";
7-
8-
import SwipeButton from "rn-swipe-button";
5+
import { spaceBadger } from "../../themes/spaceBadger";
96

107
import T from "../T";
8+
import Spacer from "../Spacer";
9+
import Ionicons from "react-native-vector-icons/Ionicons";
1110

1211
const SWIPEABLE_WIDTH_PERCENT = 78;
1312

1413
const SwipeButtonContainer = styled(View)`
15-
overflow: hidden;
14+
overflow: visible;
1615
width: ${SWIPEABLE_WIDTH_PERCENT}%;
17-
height: 64px;
16+
height: 70px;
1817
align-self: center;
1918
`;
2019

21-
const SwipeContent = styled(View)<{ activated: boolean }>`
22-
height: 64px;
23-
padding-right: 10px;
24-
align-items: flex-end;
25-
justify-content: center;
26-
27-
background-color: ${props =>
28-
props.activated ? props.theme.success500 : props.theme.pending500};
20+
const SwipeContent = styled(View)`
21+
border-radius: 45px;
22+
background-color: ${props => props.theme.primary500};
2923
`;
3024

3125
const SwipeActivity = styled(View)`
32-
height: 64px;
3326
align-items: center;
3427
justify-content: center;
3528
align-self: center;
36-
flex-direction: row;
29+
`;
30+
31+
const Swiper = styled(Slider)`
32+
flex: 1;
33+
margin-left: 10;
34+
margin-right: 10;
35+
align-items: stretch;
36+
justify-content: center;
37+
overflow: visible;
3738
`;
3839

3940
type ButtonStates =
@@ -50,24 +51,55 @@ interface Props {
5051
}
5152

5253
const SwipeButtonAtom = ({ swipeFn, labelAction }: Props) => {
54+
const [visible, setVisible] = useState(true);
55+
const [sliderValue, setSliderValue] = useState(0);
56+
57+
const sliding = (value: any) => {
58+
if (value > 90) {
59+
swipeFn();
60+
setVisible(false);
61+
}
62+
setSliderValue(value);
63+
};
64+
65+
const endSlide = () => {
66+
setSliderValue(0);
67+
};
68+
5369
const forwardCircle = () => (
54-
<Ionicons name="ios-arrow-forward-circle" size={25} color="#11a87e" />
70+
<Ionicons
71+
name="ios-chevron-forward-circle"
72+
size={60}
73+
color={spaceBadger.fg100}
74+
/>
5575
);
5676

5777
return (
5878
<SwipeButtonContainer>
59-
<SwipeButton
60-
onSwipeSuccess={() => swipeFn()}
61-
swipeSuccessThreshold={70}
62-
titleColor="#FFFFFF"
63-
railBackgroundColor="#11a87e"
64-
railBorderColor="#11a87e"
65-
railFillBackgroundColor="#FFFFFF"
66-
railFillBorderColor="#FFFFFF"
67-
thumbIconBackgroundColor="#FFFFFF"
68-
thumbIconComponent={forwardCircle}
69-
title={`Slide ${labelAction}`}
79+
<ActivityIndicator
80+
animating={!visible}
81+
hidesWhenStopped={true}
82+
size={visible ? 0 : "large"}
83+
color="#11a87e"
7084
/>
85+
<T center={true} weight={"bold"} type={"primary"}>
86+
{visible ? `Slide ${labelAction}` : ""}
87+
</T>
88+
<Spacer tiny />
89+
{visible && (
90+
<SwipeContent>
91+
<Swiper
92+
minimumValue={0}
93+
maximumValue={100}
94+
minimumTrackTintColor={spaceBadger.primary900}
95+
maximumTrackTintColor={spaceBadger.primary500}
96+
renderThumbComponent={forwardCircle}
97+
value={sliderValue}
98+
onValueChange={value => sliding(value)}
99+
onSlidingComplete={() => endSlide()}
100+
/>
101+
</SwipeContent>
102+
)}
71103
</SwipeButtonContainer>
72104
);
73105
};

navigation/AppNavigator.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

navigation/AuthStack.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)