小编Ala*_*uez的帖子

显示使用 React Native Image Picker 拍摄的照片

我正在学习一些有关 React Native 的知识,但出现了一个我无法解决的问题。

\n\n

我正在使用react-native-image-picker 我已经能够从我的设备拍摄照片,问题是我无法在设备屏幕上显示捕获的图像。

\n\n

这是我的代码。

\n\n
import React from \'react\';\nimport { Button, Image, View} from \'react-native\';\n\nimport ImagePicker from \'react-native-image-picker\';\n\n\nconst TomarFoto = () => {\n  const tomarFoto = () => {\n    ImagePicker.launchCamera({}, (response) => {\n      console.log(\'Respuesta =\', response);\n      if (response.didCancel) {\n        alert(\'Subida cancelada\');\n      } else if (response.error) {\n        alert(\'Error encontrado: \', error);\n      } else {\n        const source = {uri:response.uri};\n      }\n    });\n  };\n\n return (\n\n  <View style={{ flex: 1, alignItems: \'center\', justifyContent: \'center\' }}>\n    <Image\n      source={ uri:response.uri}\n      style={ …
Run Code Online (Sandbox Code Playgroud)

javascript android react-native react-native-image-picker

1
推荐指数
1
解决办法
3509
查看次数