Skip to content

Instantly share code, notes, and snippets.

@lenivene
Created April 24, 2019 04:40
Show Gist options
  • Save lenivene/7d9506f69a51592259382e0d93b50f8f to your computer and use it in GitHub Desktop.
Save lenivene/7d9506f69a51592259382e0d93b50f8f to your computer and use it in GitHub Desktop.
Constants React Native
import { Dimensions } from "react-native";
const { width, height } = Dimensions.get("window");
const Constants = {
useReactotron: true, // Debug
Language: "en",
fontFamily: "system font", // Default font
WordPress: { // No required
defaultDateFormat: "YYYY-MM-DD HH:mm:ss"
},
SplashScreen: {
Duration: 2000,
},
EmitCode: {
SideMenuOpen: "OPEN_SIDE_MENU",
SideMenuClose: "CLOSE_SIDE_MENU",
SideMenuToggle: "TOGGLE_SIDE_MENU",
Toast: "toast",
MenuReload: "menu.reload",
},
Window: {
width,
height,
headerHeight: (65 * height) / 100,
headerBannerAndroid: (55 * height) / 100,
profileHeight: (45 * height) / 100,
},
Dimension: {
ScreenWidth(percent = 1) {
return Dimensions.get("window").width * percent;
},
ScreenHeight(percent = 1) {
return Dimensions.get("window").height * percent;
}
}
}
export default Constants;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment