mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 22:47:03 +08:00
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import { useFonts } from "@use-expo/font";
|
|
import { AppLoading } from "expo";
|
|
import * as React from "react";
|
|
import { StyleSheet, View } from "react-native";
|
|
import { VictoryBar, VictoryChart } from "victory-native";
|
|
|
|
const data = [
|
|
{ quarter: 1, earnings: 13000 },
|
|
{ quarter: 2, earnings: 16500 },
|
|
{ quarter: 3, earnings: 14250 },
|
|
{ quarter: 4, earnings: 19000 },
|
|
];
|
|
|
|
export default function App() {
|
|
const [isLoaded] = useFonts({
|
|
Roboto: require("./Roboto.ttf"),
|
|
});
|
|
|
|
if (!isLoaded) {
|
|
return <AppLoading />;
|
|
}
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<VictoryChart
|
|
width={350}
|
|
/**
|
|
* the material theme uses the Roboto font, and react-native-svg isn't
|
|
* compatible with expo-font, so we can't use this theme:
|
|
* theme={VictoryTheme.material}
|
|
**/
|
|
>
|
|
<VictoryBar data={data} x="quarter" y="earnings" />
|
|
</VictoryChart>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
backgroundColor: "#f5fcff",
|
|
},
|
|
});
|