React Native【实战范例】银行卡(含素材)

c 复制代码
import React from "react";
import { Image, ImageBackground, StyleSheet, Text, View } from "react-native";
import {
  SafeAreaProvider,
  useSafeAreaInsets,
} from "react-native-safe-area-context";
import bg_card from "../../assets/images/bg_card.png";
import icon_bank from "../../assets/images/icon_bank.png";
export default function HomeScreen() {
  const insets = useSafeAreaInsets();
  return (
    <SafeAreaProvider>
      <View
        style={{
          flex: 1,
          paddingTop: insets.top, // 顶部安全区域
          paddingBottom: insets.bottom, // 底部安全区域
          paddingLeft: 10,
          paddingRight: 10,
        }}
      >
        <View style={styles.root}>
          <ImageBackground
            style={styles.viewStyle}
            imageStyle={styles.imgStyle}
            source={bg_card}
          >
            <Image style={styles.icon_logo} source={icon_bank} />
            <Text style={styles.txtBank}>
              {`招商银行\n`}
              <Text style={styles.cardTypeTxt}>{`储蓄卡\n\n`}</Text>
              <Text style={styles.cardNoTxt}>●●●● ●●●● ●●●● 3068</Text>
            </Text>
          </ImageBackground>
        </View>
      </View>
    </SafeAreaProvider>
  );
}
const styles = StyleSheet.create({
  page: {
    padding: 10,
  },
  root: {
    width: "100%",
    height: "100%",
    flexDirection: "column",
  },
  viewStyle: {
    width: "100%",
    height: 150,
    flexDirection: "row",
    alignItems: "flex-start",
  },
  imgStyle: {
    resizeMode: "cover",
    borderRadius: 12,
  },
  icon_logo: {
    width: 48,
    height: 48,
    borderRadius: 24,
    marginLeft: 20,
    marginTop: 20,
  },
  txtBank: {
    fontSize: 24,
    color: "white",
    marginLeft: 10,
    marginTop: 21,
    fontWeight: "bold",
  },
  cardTypeTxt: {
    fontSize: 20,
    color: "#FFFFFFA0",
    fontWeight: "normal",
  },
  cardNoTxt: {
    fontSize: 26,
    color: "white",
  },
});

assets/images/bg_card.png

assets/images/icon_bank.png

相关推荐
懒人村杂货铺2 小时前
[特殊字符] 跨端视频通话实战:腾讯云 TRTC + IM(React Native & Web)
react native·音视频·腾讯云
木西1 天前
React Native DApp 开发全栈实战·从 0 到 1 系列(流动性挖矿-前端部分)
react native·web3·智能合约
小妖怪的夏天1 天前
react native 出现 FATAL EXCEPTION: OkHttp Dispatcher
react native·react.js·okhttp
qczg_wxg2 天前
高阶组件介绍
开发语言·javascript·react native·ecmascript
qczg_wxg3 天前
React Native的动画系统
javascript·react native·react.js
qczg_wxg3 天前
React Native常用的API
react native
Winson℡3 天前
在 React Native 层禁止 iOS 左滑返回(手势返回/手势退出)
react native·react.js·ios
卸任4 天前
从0到1搭建react-native自动更新(OTA和APK下载)
前端·react native·react.js
wayne2144 天前
「原生 + RN 混合工程」一条命令启动全攻略:解密 react-native.config.js
android·react native
qczg_wxg5 天前
ReactNative系统组件四
javascript·react native·react.js