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

相关推荐
Swift社区12 小时前
RN 项目中“页面存在 ≠ 页面可见”会导致哪些隐藏 Bug?
react native·bug·react
赵财猫._.1 天前
React Native鸿蒙开发实战(十):鸿蒙NEXT深度适配与未来展望
react native·react.js·harmonyos
2401_860319521 天前
在React Native鸿蒙跨平台开发采用分类网格布局,通过paramRow和paramLabel/paramValue的组合展示关键配置信息
react native·react.js·harmonyos
2301_796512521 天前
使用如Redux、MobX或React Context等状态管理库来管理状态,React Native鸿蒙跨平台开发来实战
react native·react.js·harmonyos
洞窝技术1 天前
自建 React Native 热修复,让线上事故 30 秒“归零”
react native
2401_860494702 天前
在React Native中实现鸿蒙跨平台开发中开发一个运动类型管理系统,使用React Navigation设置应用的导航结构,创建一个堆栈导航器
react native·react.js·harmonyos
2301_796512522 天前
使用状态管理、持久化存储或者利用现有的库来辅助React Native鸿蒙跨平台开发开发一个允许用户撤销删除的操作
javascript·react native·react.js
2301_796512522 天前
React Native鸿蒙跨平台开发包含输入收入金额、选择收入类别、记录备注和日期等功能,实战react-native-paper组件
javascript·react native·react.js
2401_860319522 天前
react-native-calendarsReact Native库来帮助你处理日期和时间,实现鸿蒙跨平台开发日历组件
react native·react.js·harmonyos
赵财猫._.2 天前
React Native鸿蒙开发实战(九):复杂业务场景实战与架构设计
react native·react.js·harmonyos