Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native make safe view in mobile

//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
Comment

PREVIOUS NEXT
Code Example
Javascript :: MaterialStateProperty width 
Javascript :: dom queryselector 
Javascript :: javascript date parse yyyy-mm-dd 
Javascript :: graphql query 
Javascript :: extract from a string in javascript 
Javascript :: empty check on django json field 
Javascript :: .foreach in javascript 
Javascript :: mongodb mongoose with next js connection 
Javascript :: how to use useref hook in react 
Javascript :: github remote 
Javascript :: loop through nested json object typescript 
Javascript :: jquery fadein to show modal 
Javascript :: check if an array contains a number in javascript 
Javascript :: hackerearth javascript solutions 
Javascript :: js how to calculate factorial 
Javascript :: post to /wp-json/wp/v2/media 
Javascript :: node js do request 
Javascript :: javascript objectentries 
Javascript :: socket.io cdn 
Javascript :: which object key has highest value javascript 
Javascript :: how to make alert in javascript 
Javascript :: open youtube video at specific time javascript 
Javascript :: sweetalert example 
Javascript :: react button onclick components 
Javascript :: js stringify 
Javascript :: svg in react native 
Javascript :: react algolia range slider 
Javascript :: after effects loop wiggle 
Javascript :: javascript slice string from character 
Javascript :: multiple checkbox react 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =