import * as React from 'react' import { ScrollView, StyleProp, TextStyle, TouchableOpacity, View, ViewStyle, StyleSheet, Button, } from 'react-native' import { observer } from 'mobx-react-lite' import { color, typography } from '../../theme' import { Text } from '../' import { flatten } from 'ramda' import Slider from '@react-native-community/slider' import { useState } from 'react' import Accordion from 'react-native-collapsible/Accordion' import * as Animatable from 'react-native-animatable' import Icon from 'react-native-vector-icons/MaterialCommunityIcons' import { Switch } from 'react-native-elements' const CONTAINER: ViewStyle = { justifyContent: 'center', } const TEXT: TextStyle = { fontFamily: typography.primary, fontSize: 14, color: color.primary, } export interface TweaksProps { /** * An optional style override useful for padding & margin. */ style?: StyleProp physics setPhysics } /** * Describe your component here */ export const Tweaks = observer(function Tweaks( props: TweaksProps, ): JSX.Element { const { style, physics, setPhysics } = props // const styles = flatten([CONTAINER, style]) const content = [ { title: 'Physics', content: ( { setPhysics({ ...physics, gravityOn: !physics.gravityOn }) }} /> { setPhysics({ ...physics, gravity: value }) }} value={physics.gravity} step={0.01} /> { setPhysics({ ...physics, charge: value }) }} value={physics.charge} step={1} /> { setPhysics({ ...physics, linkStrength: value }) }} value={physics.linkStrength} step={0.01} /> { setPhysics({ ...physics, linkIts: value }) }} value={physics.linkIts} step={1} /> { setPhysics({ ...physics, collision: !physics.collision }) }} /> { setPhysics({ ...physics, alphaDecay: value }) }} value={physics.alphaDecay} step={0.01} /> { setPhysics({ ...physics, alphaTarget: value }) }} value={physics.alphaTarget} step={0.1} /> { setPhysics({ ...physics, velocityDecay: value }) }} value={physics.velocityDecay} step={0.01} /> { setPhysics({ ...physics, galaxy: !physics.galaxy }) }} /> ), }, { title: 'Visual', content: ( { setPhysics({ ...physics, colorful: !physics.colorful }) }} /> { setPhysics({ ...physics, hover: !physics.hover }) }} /> { setPhysics({ ...physics, linkOpacity: value }) }} value={physics.linkOpacity} step={0.01} /> { setPhysics({ ...physics, linkWidth: value }) }} value={physics.linkWidth} step={0.1} /> { setPhysics({ ...physics, nodeRel: value }) }} value={physics.nodeRel} step={0.01} /> { setPhysics({ ...physics, particles: value }) }} value={physics.particles} step={1} /> { setPhysics({ ...physics, particleWidth: value }) }} value={physics.particleWidth} step={0.1} /> { setPhysics({ ...physics, labels: !physics.labels }) }} /> { setPhysics({ ...physics, labelScale: value }) }} value={physics.labelScale} step={0.1} /> ), }, { title: 'Modes', content: , }, ] const [activeSections, setActiveSections] = useState([]) const setSections = (sections) => { setActiveSections(sections.includes(undefined) ? [] : sections) } const renderHeader = (section, _, isActive) => { return ( {section.title} ) } const renderContent = (section, _, isActive) => { return ( {section.content} ) } const [tweaks, setTweaks] = useState(true) if (true) { if (tweaks) { return ( { setTweaks(false) }} > ) } else { return ( { setTweaks(true) }} style={{ position: 'absolute', top: 50, left: 50, width: 30, color: '#ffffff', zIndex: 100, }} > ) } } else { return ( { setPhysics({ ...physics, charge: value }) }} value={physics.charge} step={1} /> { setPhysics({ ...physics, linkStrength: value }) }} value={physics.linkStrength} step={0.1} /> { setPhysics({ ...physics, linkIts: value }) }} value={physics.linkIts} step={1} /> { setPhysics({ ...physics, collision: !physics.collision }) }} /> { setPhysics({ ...physics, particles: value }) }} value={physics.particles} step={1} /> { setPhysics({ ...physics, collapse: !physics.collapse }) }} /> { setPhysics({ ...physics, threedim: !physics.threedim }) }} /> ) } }) const styles = StyleSheet.create({ container: { display: 'flex', backgroundColor: '#2a2e38', position: 'absolute', zIndex: 5, marginLeft: '2%', marginTop: '2%', maxWidth: 275, borderRadius: 10, borderStyle: 'solid', borderWidth: 10, borderColor: '#2a2e38', maxHeight: '80%', paddingBottom: 20, }, title: { textAlign: 'left', fontSize: 22, fontWeight: '300', marginBottom: 20, paddingLeft: 10, }, header: { backgroundColor: '#2a2e38', padding: 10, paddingBottom: 20, textAlign: 'left', }, headerText: { textAlign: 'left', paddingLeft: 30, fontSize: 16, fontWeight: '500', }, content: { padding: 20, paddingLeft: 60, backgroundColor: '#000000', }, active: { backgroundColor: '#2a2e38', }, inactive: { backgroundColor: '#2a2e38', }, selectors: { marginBottom: 10, flexDirection: 'row', justifyContent: 'center', }, selector: { backgroundColor: '#2a2e38', padding: 10, }, activeSelector: { fontWeight: 'bold', }, selectTitle: { fontSize: 14, fontWeight: '500', padding: 10, }, multipleToggle: { flexDirection: 'row', justifyContent: 'center', marginVertical: 30, alignItems: 'center', }, multipleToggle__title: { fontSize: 16, marginRight: 8, }, slider: { minimumTrackTintColor: '#a991f1', thumbTintColor: '#a991f1', height: 40, width: '90%', }, switch: { width: '5', height: 20, marginVertical: 10, }, })