react-native 背景圖設置文字置底居中

import { StyleSheet, View, Text, ImageBackground, StatusBar } from "react-native";

  render() {
    return (
      <View>
        //隱藏頂部狀態欄    
        <StatusBar backgroundColor="#ff0000"
          translucent={true}
          hidden={true}
          animated={true}/>

        <ImageBackground source={Images.ic_back_advertising} style={styles.backgroundImage}> 
          <Text style={styles.footText}>
            三秒後自動跳轉到主頁或點擊跳過
          </Text>
        </ImageBackground>
      </View>
    )
  }


const styles = StyleSheet.create({
  backgroundImage: {
    width: "100%",
    height: "100%",
  },
  footText: {
    position: "absolute",
    bottom: 10,
    width: 250,
    left: "50%",
    marginLeft: -125,
  },
});

折騰一個上午,總算搞定了這個問題

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章