|
@ -8,16 +8,17 @@ import Icons from '../themes/Icons'; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
import { styles } from "../screens/styles/AppStyles"; |
|
|
import { styles } from "../screens/styles/AppStyles"; |
|
|
|
|
|
import finalPropsSelectorFactory from "react-redux/es/connect/selectorFactory"; |
|
|
|
|
|
|
|
|
function ScrollingPicker() { |
|
|
function ScrollingPicker(props) { |
|
|
const scrollX = useRef(new Animated.Value(0)).current; |
|
|
const scrollX = useRef(new Animated.Value(0)).current; |
|
|
const [selected, setSelected] = useState(0); |
|
|
const [selected, setSelected] = useState(0); |
|
|
|
|
|
|
|
|
function onScroll(event){ |
|
|
function onScroll(event){ |
|
|
if (event.nativeEvent.contentOffset.x === 0) { |
|
|
if (event.nativeEvent.contentOffset.x === 0) { |
|
|
setSelected(0); |
|
|
props.modeSetter(0); |
|
|
} else if (event.nativeEvent.contentOffset.x === (Metrics.icons.buttonIcon * 2)) { |
|
|
} else if (event.nativeEvent.contentOffset.x === (Metrics.icons.buttonIcon * 2)) { |
|
|
setSelected(1); |
|
|
props.modeSetter(1); |
|
|
} |
|
|
} |
|
|
Animated.event([ |
|
|
Animated.event([ |
|
|
{ |
|
|
{ |
|
@ -43,13 +44,13 @@ function ScrollingPicker() { |
|
|
name={Icons.squareIcons.square} |
|
|
name={Icons.squareIcons.square} |
|
|
color={Colors.material.dark} |
|
|
color={Colors.material.dark} |
|
|
size={Metrics.icons.buttonIcon} |
|
|
size={Metrics.icons.buttonIcon} |
|
|
style={{marginLeft: Metrics.icons.buttonIcon * 0.5, marginRight: Metrics.icons.buttonIcon * 0.5}} |
|
|
style={styles.modePickerMargin} |
|
|
/> |
|
|
/> |
|
|
<MaterialIcon |
|
|
<MaterialIcon |
|
|
name={Icons.squareIcons.plus} |
|
|
name={Icons.squareIcons.plus} |
|
|
color={Colors.material.dark} |
|
|
color={Colors.material.dark} |
|
|
size={Metrics.icons.buttonIcon} |
|
|
size={Metrics.icons.buttonIcon} |
|
|
style={{marginLeft: Metrics.icons.buttonIcon * 0.5, marginRight: Metrics.icons.buttonIcon * 0.5}} |
|
|
style={styles.modePickerMargin} |
|
|
/> |
|
|
/> |
|
|
</ScrollView> |
|
|
</ScrollView> |
|
|
); |
|
|
); |
|
|