实现效果
import Share from 'react-native-share' import ViewShot from 'react-native-view-shot' const shotRef = useRef<ViewShot>(null) const getTime = () => { return new Date().getTime().toString() } const OnShare = () => { shotRef.current!.capture().then(uri => { Share.open({ url: uri }) }) } <Button onPress={OnShare}>Share</Button> <ViewShot style={styles.shotWrap} ref={shotRef} options={{ fileName: getTime(), format: 'png', quality: 0.9 }}> //内容可自定义 <Image style={[styles.imgsShera]} resizeMode="cover" source={require('./assets/shera.png')}></Image> </ViewShot>
标签:const,getTime,Share,react,shotRef,自带,native From: https://www.cnblogs.com/tlfe/p/17564895.html