© Bohua Xu

React Native

Oct 11, 2022 · 2min

react native初体验

使用得最新版的react native 0.7 同时 java 环境需从1.8改到11,再就是虚拟机环境变量。

rn的样式没有继承性

import { View, Text, StyleSheet } from 'react-native'
import React from 'react'

export default function index() {
  return (
    <View>
      <Text style={[{fontSize:100},{color:'green'}]}>Hi react native!</Text>
      <Text style={[styles.h1]}>hi react_native</Text> //行内样式
      <Text style={[styles.h2]}>hi react_native</Text>
    </View>
  )
}

const styles = StyleSheet.create({
    h1:{
        fontSize:50,
        fontWeight:'bold'
    },
    h2:{
        fontSize:40,
        fontWeight:'bold'
    }
})
import { View, Text, StyleSheet } from 'react-native'
import React from 'react'

export default function index() {
  return (
    <View>
      <Text style={[{fontSize:100},{color:'green'}]}>Hi react native!</Text>
      <Text style={[styles.h1]}>hi react_native</Text> //行内样式
      <Text style={[styles.h2]}>hi react_native</Text>
    </View>
  )
}

const styles = StyleSheet.create({
    h1:{
        fontSize:50,
        fontWeight:'bold'
    },
    h2:{
        fontSize:40,
        fontWeight:'bold'
    }
})
CC BY-NC-SA 4.0 2021-PRESENT © Bohua Xu