Gaëtan Renaudeau 4 lat temu
rodzic
commit
d527afcc92
No account linked to committer's email address

+ 2
- 1
example/src/ART.js Wyświetl plik

@@ -1,8 +1,9 @@
1
+/* eslint-disable react-native/no-inline-styles */
1 2
 //@flow
2 3
 import React, { useState, useCallback } from 'react';
3 4
 import { SafeAreaView, Image, View } from 'react-native';
4 5
 import ViewShot from 'react-native-view-shot';
5
-import { Surface, Group, Shape, Path } from '@react-native-community/art';
6
+import { Surface, Group, Shape } from '@react-native-community/art';
6 7
 import Desc from './Desc';
7 8
 
8 9
 const dimension = { width: 300, height: 300 };

+ 2
- 4
example/src/Canvas.js Wyświetl plik

@@ -1,9 +1,7 @@
1 1
 //@flow
2 2
 import React, { useRef, useState, useEffect, useCallback } from 'react';
3
-import { SafeAreaView, Image, View } from 'react-native';
3
+import { SafeAreaView, Image } from 'react-native';
4 4
 import ViewShot from 'react-native-view-shot';
5
-import { Surface, Group, Shape } from '@react-native-community/art';
6
-import Desc from './Desc';
7 5
 import Canvas from 'react-native-canvas';
8 6
 
9 7
 const dimension = { width: 300, height: 300 };
@@ -20,7 +18,7 @@ const CanvasRendering = ({ onDrawn }) => {
20 18
     ctx.fillRect(140, 50, 60, 60);
21 19
     const timeout = setTimeout(onDrawn, 1000); // hack. react-native-canvas have no way to tell when it's executed
22 20
     return () => clearTimeout(timeout);
23
-  }, []);
21
+  }, [onDrawn]);
24 22
   return <Canvas ref={ref} style={dimension} />;
25 23
 };
26 24
 

+ 1
- 1
example/src/Desc.js Wyświetl plik

@@ -12,7 +12,7 @@ const styles = StyleSheet.create({
12 12
   },
13 13
 });
14 14
 
15
-const Desc = ({ desc }) => {
15
+const Desc = ({ desc }: { desc: string }) => {
16 16
   return <Text style={styles.desc}>{desc}</Text>;
17 17
 };
18 18
 

+ 1
- 0
example/src/FS.js Wyświetl plik

@@ -1,3 +1,4 @@
1
+/* eslint-disable react-native/no-inline-styles */
1 2
 //@flow
2 3
 import React, { useState, useCallback } from 'react';
3 4
 import { SafeAreaView, Image, View } from 'react-native';

+ 3
- 2
example/src/Transparency.js Wyświetl plik

@@ -1,6 +1,7 @@
1
+/* eslint-disable react-native/no-inline-styles */
1 2
 //@flow
2
-import React, { Component, useCallback, useState } from 'react';
3
-import { ScrollView, StyleSheet, Text, View, Button, Image } from 'react-native';
3
+import React, { useCallback, useState } from 'react';
4
+import { View, Image } from 'react-native';
4 5
 import ViewShot from 'react-native-view-shot';
5 6
 
6 7
 const Transparency = () => {

+ 4
- 2
example/src/Viewshoot.js Wyświetl plik

@@ -83,8 +83,10 @@ export default class Viewshoot extends Component {
83 83
     );
84 84
   }
85 85
 
86
+  full = React.createRef();
87
+
86 88
   captureViewShoot() {
87
-    this.refs.full.capture().then(uri => {
89
+    this.full.current.capture().then(uri => {
88 90
       console.log('do something with ', uri);
89 91
       this.setState({ res: { uri: uri } });
90 92
     });
@@ -94,7 +96,7 @@ export default class Viewshoot extends Component {
94 96
     return (
95 97
       <ScrollView style={styles.container}>
96 98
         <ViewShot
97
-          ref="full"
99
+          ref={this.full}
98 100
           options={{ format: this.state.options.format, quality: this.state.options.quality }}
99 101
           style={styles.container}
100 102
         >