Geen omschrijving

Transparency.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* eslint-disable react-native/no-inline-styles */
  2. //@flow
  3. import React, { useCallback, useState } from 'react';
  4. import { View, Image } from 'react-native';
  5. import ViewShot from 'react-native-view-shot';
  6. const Transparency = () => {
  7. const [source, setSource] = useState(null);
  8. const onCapture = useCallback(uri => setSource({ uri }), []);
  9. return (
  10. <View
  11. style={{
  12. flexDirection: 'column',
  13. alignItems: 'center',
  14. justifyContent: 'space-around',
  15. flex: 1,
  16. backgroundColor: '#ccc',
  17. }}
  18. >
  19. <ViewShot onCapture={onCapture} captureMode="mount" style={{ width: 100, height: 100 }}>
  20. <View
  21. style={{
  22. borderRadius: 50,
  23. padding: 10,
  24. width: 100,
  25. height: 100,
  26. backgroundColor: 'cyan',
  27. borderWidth: 2,
  28. borderColor: 'blue',
  29. }}
  30. />
  31. </ViewShot>
  32. <View
  33. style={{
  34. backgroundColor: '#f00',
  35. width: 150,
  36. height: 150,
  37. alignItems: 'center',
  38. justifyContent: 'center',
  39. }}
  40. >
  41. <Image fadeDuration={0} source={source} style={{ width: 100, height: 100 }} />
  42. </View>
  43. </View>
  44. );
  45. };
  46. Transparency.navigationProps = {
  47. title: 'Transparency',
  48. };
  49. export default Transparency;