小编Bha*_*pta的帖子

如何在React Native中使应用程序的背景颜色覆盖整个屏幕(使用样式)?

我正在通过 Snack.expo.io 在 React Native 中为我的应用程序制作一个登录屏幕,但我无法使背景颜色填满整个屏幕。我尝试将宽度和高度设置为 100%,但只有宽度有效。我还尝试使用 Flex 1(我唯一的 Flex 项目),但这也不起作用。我正在关注本教程:https://reactnativemaster.com/react-native-login-screen-tutorial。但是改变了一些小方面,但无论如何我都无法让背景覆盖整个屏幕。

这是我的代码(全部在 app.js 中)

import * as React from 'react';
import { Text, TextInput, View, ScrollView, SecureTextEntry, StyleSheet, TouchableOpacity } from 'react-native';
import Constants from 'expo-constants';

// You can import from local files
import AssetExample from './components/AssetExample';

// or any pure javascript modules available in npm
import { Card } from 'react-native-paper';

export default class App extends React.Component {
  state={
    username:"",
    password:""
  }

  render(){
    return (
      <ScrollView>

        <View …
Run Code Online (Sandbox Code Playgroud)

javascript android reactjs react-native

5
推荐指数
1
解决办法
2884
查看次数

标签 统计

android ×1

javascript ×1

react-native ×1

reactjs ×1