1- import { useCallback , useMemo , useState } from 'react'
2- import { View , StyleSheet , Text , Button , ScrollView } from 'react-native'
3- import { LineGraph } from 'react-native-graph'
1+ import { useCallback , useMemo , useState } from 'react' ;
2+ import { View , StyleSheet , Text , Button , ScrollView } from 'react-native' ;
3+ import { LineGraph } from 'react-native-graph' ;
44// import StaticSafeAreaInsets from 'react-native-static-safe-area-insets'
5- import type { GraphRange } from '../../../src/LineGraphProps'
6- import { SelectionDot } from '../components/CustomSelectionDot'
7- import { Toggle } from '../components/Toggle'
5+ import type { GraphRange } from '../../../src/LineGraphProps' ;
6+ import { SelectionDot } from '../components/CustomSelectionDot' ;
7+ import { Toggle } from '../components/Toggle' ;
88import {
99 generateRandomGraphData ,
1010 generateSinusGraphData ,
11- } from '../data/GraphData'
12- import { HapticFeedbackTypes } from 'react-native-haptic-feedback'
13- import { useColors } from '../hooks/useColors'
14- import { hapticFeedback } from '../utils/HapticFeedback'
11+ } from '../data/GraphData' ;
12+ import { HapticFeedbackTypes } from 'react-native-haptic-feedback' ;
13+ import { useColors } from '../hooks/useColors' ;
14+ import { hapticFeedback } from '../utils/HapticFeedback' ;
1515
16- const POINT_COUNT = 70
17- const POINTS = generateRandomGraphData ( POINT_COUNT )
18- const COLOR = '#6a7ee7'
19- const GRADIENT_FILL_COLORS = [ '#7476df5D' , '#7476df4D' , '#7476df00' ]
20- const SMALL_POINTS = generateSinusGraphData ( 9 )
16+ const POINT_COUNT = 70 ;
17+ const POINTS = generateRandomGraphData ( POINT_COUNT ) ;
18+ const COLOR = '#6a7ee7' ;
19+ const GRADIENT_FILL_COLORS = [ '#7476df5D' , '#7476df4D' , '#7476df00' ] ;
20+ const SMALL_POINTS = generateSinusGraphData ( 9 ) ;
2121
2222export function GraphPage ( ) {
23- const colors = useColors ( )
23+ const colors = useColors ( ) ;
2424
25- const [ isAnimated , setIsAnimated ] = useState ( true )
26- const [ enablePanGesture , setEnablePanGesture ] = useState ( true )
27- const [ enableFadeInEffect , setEnableFadeInEffect ] = useState ( false )
25+ const [ isAnimated , setIsAnimated ] = useState ( true ) ;
26+ const [ enablePanGesture , setEnablePanGesture ] = useState ( true ) ;
27+ const [ enableFadeInEffect , setEnableFadeInEffect ] = useState ( false ) ;
2828 const [ enableCustomSelectionDot , setEnableCustomSelectionDot ] =
29- useState ( false )
30- const [ enableGradient , setEnableGradient ] = useState ( false )
31- const [ enableRange , setEnableRange ] = useState ( false )
32- const [ enableIndicator , setEnableIndicator ] = useState ( false )
33- const [ indicatorPulsating , setIndicatorPulsating ] = useState ( false )
29+ useState ( false ) ;
30+ const [ enableGradient , setEnableGradient ] = useState ( false ) ;
31+ const [ enableRange , setEnableRange ] = useState ( false ) ;
32+ const [ enableIndicator , setEnableIndicator ] = useState ( false ) ;
33+ const [ indicatorPulsating , setIndicatorPulsating ] = useState ( false ) ;
3434
35- const [ points , setPoints ] = useState ( POINTS )
35+ const [ points , setPoints ] = useState ( POINTS ) ;
3636
3737 const refreshData = useCallback ( ( ) => {
38- setPoints ( generateRandomGraphData ( POINT_COUNT ) )
39- hapticFeedback ( HapticFeedbackTypes . impactLight )
40- } , [ ] )
38+ setPoints ( generateRandomGraphData ( POINT_COUNT ) ) ;
39+ hapticFeedback ( HapticFeedbackTypes . impactLight ) ;
40+ } , [ ] ) ;
4141
4242 const highestDate = useMemo (
4343 ( ) =>
4444 points . length !== 0 && points [ points . length - 1 ] != null
4545 ? points [ points . length - 1 ] ! . date
4646 : undefined ,
4747 [ points ]
48- )
48+ ) ;
4949 const range : GraphRange | undefined = useMemo ( ( ) => {
5050 // if range is disabled, default to infinite range (undefined)
51- if ( ! enableRange ) return undefined
51+ if ( ! enableRange ) return undefined ;
5252
5353 if ( points . length !== 0 && highestDate != null ) {
5454 return {
@@ -60,16 +60,16 @@ export function GraphPage() {
6060 min : - 200 ,
6161 max : 200 ,
6262 } ,
63- }
63+ } ;
6464 } else {
6565 return {
6666 y : {
6767 min : - 200 ,
6868 max : 200 ,
6969 } ,
70- }
70+ } ;
7171 }
72- } , [ enableRange , highestDate , points ] )
72+ } , [ enableRange , highestDate , points ] ) ;
7373
7474 return (
7575 < View style = { [ styles . container , { backgroundColor : colors . background } ] } >
@@ -153,7 +153,7 @@ export function GraphPage() {
153153
154154 < View style = { styles . spacer } />
155155 </ View >
156- )
156+ ) ;
157157}
158158
159159const styles = StyleSheet . create ( {
@@ -192,4 +192,4 @@ const styles = StyleSheet.create({
192192 controlsScrollViewContent : {
193193 justifyContent : 'center' ,
194194 } ,
195- } )
195+ } ) ;
0 commit comments