No Description

ART.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* eslint-disable react-native/no-inline-styles */
  2. //@flow
  3. import React, { useState, useCallback } from 'react';
  4. import { SafeAreaView, Image, View } from 'react-native';
  5. import ViewShot from 'react-native-view-shot';
  6. import { Surface, Group, Shape } from '@react-native-community/art';
  7. import Desc from './Desc';
  8. const dimension = { width: 300, height: 300 };
  9. const ARTExample = () => {
  10. const [source, setSource] = useState(null);
  11. const onCapture = useCallback(uri => setSource({ uri }), []);
  12. return (
  13. <SafeAreaView>
  14. <ViewShot onCapture={onCapture} captureMode="mount" style={dimension}>
  15. <View
  16. style={{
  17. height: 100,
  18. alignItems: 'center',
  19. justifyContent: 'center',
  20. backgroundColor: 'blue',
  21. }}
  22. >
  23. <Surface width={200} height={100}>
  24. <Group>
  25. <Shape d="M 0,50 L 320,60" stroke="red" strokeWidth={10} />
  26. </Group>
  27. </Surface>
  28. <View
  29. style={{
  30. width: 10,
  31. height: 10,
  32. backgroundColor: 'orange',
  33. position: 'absolute',
  34. top: 50,
  35. }}
  36. />
  37. </View>
  38. </ViewShot>
  39. <Desc desc="ART overlapping test" />
  40. <Image source={source} style={dimension} />
  41. </SafeAreaView>
  42. );
  43. };
  44. ARTExample.navigationOptions = {
  45. title: '@react-native-community/art',
  46. };
  47. export default ARTExample;