This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getBarId(id: string, groupIndex: number, seriesIndex: number) { | |
return `${id}-series-${groupIndex}-${seriesIndex}`; | |
} | |
export function removeFalsyValues(object) { | |
return Object.entries(object) | |
.filter(([_, value]) => value != null) | |
.reduce((acc, [key, value]) => ({...acc, [key]: value}), {}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Svg, { | |
Circle, | |
Rect | |
} from 'react-native-svg'; | |
function SomeComponent() { | |
return ( | |
<Svg viewBox='0 0 100 100'> | |
<Circle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function usePrefersReducedMotion() { | |
const prefersReducedMotion = | |
typeof window === 'undefined' | |
? false | |
: window.matchMedia('(prefers-reduced-motion: reduce)').matches; | |
return {prefersReducedMotion}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {AccessibilityInfo} from 'react-native'; | |
export function usePrefersReducedMotion() { | |
AccessibilityInfo.isReduceMotionEnabled() | |
.then((result) => { | |
return { prefersReducedMotion: result }; | |
}) | |
.catch((error) => { | |
return { prefersReducedMotion: error }; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react'; | |
import {View, Text, Button} from 'react'; | |
export function HelloWorldApp() { | |
const [count, setCount] = useState(0) | |
return ( | |
<View> | |
<Text>You clicked {count} times</Text> | |
<Button onPress={() => setCount(count + 1)}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react'; | |
export function HelloWorldApp() { | |
const [count, setCount] = useState(0) | |
return ( | |
<div> | |
<p>You clicked {count} times</p> | |
<button onClick={() => setCount(count + 1)}> | |
Click me! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {Text, View} from 'react-native'; | |
export function HelloWorldApp() { | |
return ( | |
<View | |
style={{ | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export function HelloWorldApp() { | |
return ( | |
<div | |
style={{ | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
}}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<BarChart | |
data={[ | |
{ | |
name: 'Ordered Items', | |
data: OrderedItemsDataPoints | |
color: GreenGradient, | |
}, | |
]} | |
/> |