“Как управлять Safearea как в iPhone, так и в Android в RACET Native” Ответ

React Есть ли в безопасной площадке для Android

import { StyleSheet, Platform } from 'react-native';
export default StyleSheet.create({
    droidSafeArea: {
        flex: 1,
        backgroundColor: npLBlue,
        paddingTop: Platform.OS === 'android' ? 25 : 0
    },
});
Stupid Skipper

React Есть ли в безопасной площадке для Android

import GlobalStyles from './GlobalStyles';
import { SafeAreaView } from "react-native";

render() {
    return (
      <SafeAreaView style={GlobalStyles.droidSafeArea}>
          //More controls and such
      </SafeAreaView>
    );
  }
}
Stupid Skipper

Как управлять Safearea как в iPhone, так и в Android в RACET Native

//import libraries to create components
import React from 'react'
import { Text, StyleSheet, View, SafeAreaView, StatusBar } from 'react-native'

//create a component that return some jsx/simple function
//======following code use SafeAreaView and statusBar.currentHeight to 
//    solve this problem===============================
const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.textStyle}>hello world</Text>
    </SafeAreaView>
  )
}

//Create a StyleSheet object to style the component
const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: StatusBar.currentHeight || 0,
  },
})

//export the component, so it can be used in other parts of the app
export default App
Sab Tech

Ответы похожие на “Как управлять Safearea как в iPhone, так и в Android в RACET Native”

Вопросы похожие на “Как управлять Safearea как в iPhone, так и в Android в RACET Native”

Больше похожих ответов на “Как управлять Safearea как в iPhone, так и в Android в RACET Native” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования