Files
react-native-svg/apps/common/test/Test2086.tsx
Jakub Grzywacz b3b175a7fb feat: move examples to ./apps (#2507)
# Summary

Due to the large number of example apps in the repository, I decided to
change the structure and move all applications into an "apps" folder to
maintain a clear structure.
2024-10-25 16:12:23 +02:00

46 lines
1.1 KiB
TypeScript

import React, {useState} from 'react';
import Svg, {Path} from 'react-native-svg';
import {StyleSheet, Text, View, Button} from 'react-native';
export default function Test2086() {
const [display, setDisplay] = useState(false);
return (
<View style={styles.container}>
<View>
<Text>Click on the button to crash the app</Text>
<Button onPress={() => setDisplay(state => !state)} title="Run" />
<MySVG style={{width: 100, height: 100}} toggle={display} />
</View>
</View>
);
}
const MySVG = ({style, toggle}) => {
return (
<Svg viewBox="0 0 32 32" style={style}>
{toggle && (
<Path
d="M 16 16 m 16, 0 a 16,16 0 1,1 -32,0 a r,r 0 1,1 32,0"
stroke="#000"
/>
)}
{!toggle && (
<Path
d="M 16 16 m 16, 0 a 16,16 0 1,1 -32,0 a 16,16 0 1,1 32,0"
stroke="#000"
/>
)}
</Svg>
);
};
const styles = StyleSheet.create({
container: {
paddingVertical: 200,
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});