From 3de8a0a99f74cef8032d718e4b51d5c9c364db56 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Thu, 15 Jul 2021 13:54:55 +0200 Subject: made graph interactively tweakable --- app/screens/graph/graph-screen.tsx | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'app/screens/graph') diff --git a/app/screens/graph/graph-screen.tsx b/app/screens/graph/graph-screen.tsx index 4ba2ee0..bba2955 100644 --- a/app/screens/graph/graph-screen.tsx +++ b/app/screens/graph/graph-screen.tsx @@ -1,4 +1,4 @@ -import React from "react" +import React, { useState } from "react" import { observer } from "mobx-react-lite" import { ViewStyle } from "react-native" import { Screen, Text } from "../../components" @@ -7,6 +7,9 @@ import { Screen, Text } from "../../components" import { color } from "../../theme" import { Graph } from "../../components" +import { Tweaks } from "../../components" + +import genRandomTree from "../../data/randomdata"; const ROOT: ViewStyle = { backgroundColor: color.palette.black, @@ -19,10 +22,32 @@ export const GraphScreen = observer(function GraphScreen() { // Pull in navigation via hook // const navigation = useNavigation() + const [charge, setCharge] = useState(-30); + const [collision, setCollision] = useState(false); + const [linkStrength, setLinkStrength] = useState(1); + const [linkIts, setLinkIts] = useState(1); + + const [physics, setPhysics] = useState( + { + charge: -30, + collision: false, + linkStrength: 1, + linkIts: 1 + }); + + const gData = genRandomTree(); + return ( - + + - ) -}) + ); +}); -- cgit v1.2.3