itappspace
|
定义了一个 React 组件 ImageViewer,用于在界面上显示一张图片2025-10-26 10:31 16 0import React from 'react'; import { Image, StyleSheet, View } from 'react-native'; type Props = { imgSource: any; }; export default function ImageViewer({ imgSource }: Props) { return ( <View style={styles.container}> <Image source={imgSource} style={styles.image} /> </View> ); } const styles = StyleSheet.create({ container: { alignItems: 'center', justifyContent: 'center', flex: 1, backgroundColor: '#fff', }, image: { width: 300, height: 300, resizeMode: 'contain', borderRadius: 10, }, }); <ImageViewer imgSource={require('../assets/logo.png')} /> |
| 回复 | |