问题描述
我遵循了它起作用的文档,但是使用捕获后返回的图像数据不会出现在新屏幕上。我已经搜索过但没有任何导航图像数据的解决方案。
this is the code for passing the image data to the next screen,alongside a test
the screen for receiving the captured image
receiving the captured image in an image component
passing image data to state(path and pathBase64)
解决方法
使用此代码导航到屏幕,此处imageFile是从相机捕获后存储图像的状态。
props.navigation.navigate("navigation_route",{image: imageFile})
然后,使用此代码在另一个屏幕上获取图像。
let image = props.navigation.getParam('image')
,
要在下一个屏幕中接收图像,请使用以下代码
let image = props.route.params.image
,
屏幕发送图像
函数:navigation.navigate('RouteName',{imageTobeTransferred:
state.imageInBase64})
接收屏幕。 const {imageTobeTransferred} = route.params; 返回( data:image/jpeg;base64,${imageTobeTransferred}}} /> )