-
-
Save msahu2595/4e30c33b17fd239d8b55271165586707 to your computer and use it in GitHub Desktop.
Initial Setup (React Native)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @format | |
*/ | |
import React from 'react'; | |
import {AppRegistry, Text, TextInput} from 'react-native'; | |
import App from './App'; | |
import {name as appName} from './app.json'; | |
// This is done to ensure that the text size remains consistent across all devices. | |
if (Text.defaultProps) { | |
Text.defaultProps.allowFontScaling = false; | |
} else { | |
Text.defaultProps = {}; | |
Text.defaultProps.allowFontScaling = false; | |
} | |
if (TextInput.defaultProps) { | |
TextInput.defaultProps.allowFontScaling = false; | |
} else { | |
TextInput.defaultProps = {}; | |
TextInput.defaultProps.allowFontScaling = false; | |
} | |
// Check if app was launched in the background and conditionally render null if so | |
function HeadlessCheck({isHeadless}) { | |
if (isHeadless) { | |
// App has been launched in the background by iOS, ignore | |
return null; | |
} | |
// Render the app component on foreground launch | |
return <App />; | |
} | |
AppRegistry.registerComponent(appName, () => HeadlessCheck); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment