react-native-view-shot icon indicating copy to clipboard operation
react-native-view-shot copied to clipboard

[Error: Failed to snapshot view tag 440]

Open AkilUnik opened this issue 1 year ago • 0 comments

`import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; import React from 'react'; import {RFValue} from 'react-native-responsive-fontsize'; import {captureRef} from 'react-native-view-shot';

const SettingScreen = () => { const imageRef = React.useRef(null);

const onSaveImageAsync = async () => { try { const localUri = await captureRef(imageRef, { height: 440, quality: 1, });

  // await MediaLibrary.saveToLibraryAsync(localUri);
  // if (localUri) {
  //   alert('Saved!');
  // }
} catch (e) {
  console.log(e);
}

};

return ( <View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}> <View ref={imageRef} collapsable={false}> <Image source={{uri: 'https://i.pravatar.cc/300'}} style={{ height: 200, width: 200, borderRadius: 100, resizeMode: 'cover', }} /> </View>

  <TouchableOpacity
    style={{marginTop: RFValue(100)}}
    onPress={onSaveImageAsync}>
    <Text>Save</Text>
  </TouchableOpacity>
</View>

); };

export default SettingScreen;

const styles = StyleSheet.create({}); `

its not working i also add collapsable={false} but it seems to be broke

version ==> "react-native-view-shot": "^4.0.3",

AkilUnik avatar Feb 04 '25 05:02 AkilUnik