Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

Commit

Permalink
removed some dev deps and added prop-types
Browse files Browse the repository at this point in the history
  • Loading branch information
jineshshah36 committed Aug 2, 2017
1 parent 40e896f commit 7a4353b
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 1,110 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

29 changes: 21 additions & 8 deletions components/NavButton.js
@@ -1,12 +1,20 @@
import React, { PropTypes } from 'react'
import { Platform, TouchableOpacity, View, ViewPropTypes } from 'react-native'
import styles from '../styles'
import React from "react"
import PropTypes from "prop-types"
import { Platform, TouchableOpacity, View, ViewPropTypes } from "react-native"
import styles from "../styles"

function NavButton({ style, onPress, children, disabled, disabledStyle, accessibilityLabel }) {
function NavButton({
style,
onPress,
children,
disabled,
disabledStyle,
accessibilityLabel,
}) {
let navButtonStyles = []
if (Platform.OS === 'ios') {
if (Platform.OS === "ios") {
navButtonStyles = [styles.navBarButtonIOS]
} else if (Platform.OS === 'android') {
} else if (Platform.OS === "android") {
navButtonStyles = [styles.navBarButtonAndroid]
}
if (disabled) {
Expand All @@ -18,15 +26,20 @@ function NavButton({ style, onPress, children, disabled, disabledStyle, accessib
const getTouchable = () => {
if (disabled) {
return (
<TouchableOpacity accessibilityLabel={accessibilityLabel} accessibilityTraits={['button', 'disabled']}>
<TouchableOpacity
accessibilityLabel={accessibilityLabel}
accessibilityTraits={["button", "disabled"]}>
<View style={navButtonStyles}>
{children}
</View>
</TouchableOpacity>
)
}
return (
<TouchableOpacity accessibilityLabel={accessibilityLabel} onPress={onPress} accessibilityTraits="button">
<TouchableOpacity
accessibilityLabel={accessibilityLabel}
onPress={onPress}
accessibilityTraits="button">
<View style={navButtonStyles}>
{children}
</View>
Expand Down
7 changes: 4 additions & 3 deletions components/NavButtonText.js
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react';
import { Text } from 'react-native';
import styles from '../styles';
import React from "react"
import PropTypes from "prop-types"
import { Text } from "react-native"
import styles from "../styles"

function NavButtonText({ style, children }) {
return (
Expand Down
7 changes: 4 additions & 3 deletions components/NavGroup.js
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react'
import { View, ViewPropTypes } from 'react-native'
import styles from '../styles'
import React from "react"
import PropTypes from "prop-types"
import { View, ViewPropTypes } from "react-native"
import styles from "../styles"

function NavGroup({ style, children }) {
return (
Expand Down
7 changes: 4 additions & 3 deletions components/NavTitle.js
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react';
import { Text } from 'react-native';
import styles from '../styles'
import React from "react"
import PropTypes from "prop-types"
import { Text } from "react-native"
import styles from "../styles"

function NavTitle({ style, children }) {
return (
Expand Down
35 changes: 15 additions & 20 deletions components/StatusBarEnhanced.js
@@ -1,39 +1,34 @@
import React, { PropTypes } from 'react'
import { Platform, View, StatusBar, ViewPropTypes } from 'react-native'
import styles from '../styles'
import React from "react"
import PropTypes from "prop-types"
import { Platform, View, StatusBar, ViewPropTypes } from "react-native"
import styles from "../styles"

function StatusBarEnhanced({ statusBar, style }) {
let statusBarConfig = {}
if (Platform.OS === 'ios') {
const statusBarConfig = {}
if (Platform.OS === "ios") {
statusBarConfig = {
animated: true,
hidden: false,
barStyle: 'default',
barStyle: "default",
networkActivityIndicatorVisible: false,
showHideTransition: 'fade',
showHideTransition: "fade",
}
} else if (Platform.OS === 'android') {
} else if (Platform.OS === "android") {
statusBarConfig = {
animated: true,
hidden: false,
showHideTransition: 'fade',
backgroundColor: 'rgba(0, 0, 0, 0.2)',
showHideTransition: "fade",
backgroundColor: "rgba(0, 0, 0, 0.2)",
translucent: true,
}
}
const config = Object.assign({}, statusBarConfig, statusBar)

let statusBarStyles = []
if (Platform.OS === 'ios') {
statusBarStyles = [
styles.statusBarIOS,
style,
]
} else if (Platform.OS === 'android') {
statusBarStyles = [
styles.statusBarAndroid,
style,
]
if (Platform.OS === "ios") {
statusBarStyles = [styles.statusBarIOS, style]
} else if (Platform.OS === "android") {
statusBarStyles = [styles.statusBarAndroid, style]
}

return (
Expand Down
26 changes: 12 additions & 14 deletions index.js
@@ -1,22 +1,22 @@
import React, { PropTypes } from 'react'

import { View, Platform,} from 'react-native';
import { StatusBarEnhanced } from './components/StatusBarEnhanced'
export { NavGroup } from './components/NavGroup'
export { NavButton } from './components/NavButton'
export { NavButtonText } from './components/NavButtonText'
export { NavTitle } from './components/NavTitle'
import styles from './styles'
import React from "react"
import PropTypes from "prop-types"
import { View, Platform } from "react-native"
import { StatusBarEnhanced } from "./components/StatusBarEnhanced"
export { NavGroup } from "./components/NavGroup"
export { NavButton } from "./components/NavButton"
export { NavButtonText } from "./components/NavButtonText"
export { NavTitle } from "./components/NavTitle"
import styles from "./styles"

function NavigationBar({ style, children, statusBar }) {
let navBar = null
if (Platform.OS === 'ios') {
if (Platform.OS === "ios") {
navBar = (
<View style={[styles.navBar, styles.navBarIOS, style.navBar]}>
{children}
</View>
)
} else if (Platform.OS === 'android') {
} else if (Platform.OS === "android") {
navBar = (
<View style={[styles.navBar, styles.navBarAndroid, style.navBar]}>
{children}
Expand All @@ -26,9 +26,7 @@ function NavigationBar({ style, children, statusBar }) {

return (
<View style={[styles.navBarContainer, style.navBarContainer]}>
<StatusBarEnhanced style={style.statusBar}
statusBar={statusBar}
/>
<StatusBarEnhanced style={style.statusBar} statusBar={statusBar} />
{navBar}
</View>
)
Expand Down
6 changes: 1 addition & 5 deletions package.json
Expand Up @@ -13,11 +13,7 @@
"react-native": ">= 0.44"
},
"devDependencies": {
"eslint": "4.2.0",
"eslint-config-airbnb": "^15.0.2",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "7.1.0"
"prop-types": "^15.5.10"
},
"repository": {
"type": "git",
Expand Down
28 changes: 14 additions & 14 deletions styles.js
@@ -1,4 +1,4 @@
import { StyleSheet, Platform } from 'react-native'
import { StyleSheet, Platform } from "react-native"

const IOS_NAV_BAR_HEIGHT = 44
const IOS_STATUS_BAR_HEIGHT = 20
Expand All @@ -12,28 +12,28 @@ export default StyleSheet.create({
navBarContainer: {},
statusBarIOS: {
height: IOS_STATUS_BAR_HEIGHT,
backgroundColor: '#f5f5f5',
backgroundColor: "#f5f5f5",
},
statusBarAndroid: {
height: ANDROID_STATUS_BAR_HEIGHT,
backgroundColor: '#f5f5f5',
backgroundColor: "#f5f5f5",
},
navBar: {
borderTopWidth: 0,
borderBottomColor: 'rgba(0, 0, 0, 0.1)',
borderBottomColor: "rgba(0, 0, 0, 0.1)",
borderBottomWidth: 1,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
},
navBarIOS: {
backgroundColor: '#f5f5f5',
backgroundColor: "#f5f5f5",
height: IOS_NAV_BAR_HEIGHT,
paddingLeft: 8,
paddingRight: 8,
},
navBarAndroid: {
backgroundColor: '#f5f5f5',
backgroundColor: "#f5f5f5",
height: ANDROID_NAV_BAR_HEIGHT,
padding: 16,
},
Expand All @@ -46,16 +46,16 @@ export default StyleSheet.create({
navBarButtonText: {
fontSize: 17,
letterSpacing: 0.5,
color: '#939393',
color: "#939393",
},
navBarTitleText: {
fontSize: 17,
letterSpacing: 0.5,
color: '#626262',
fontWeight: '500',
textAlign: 'center',
color: "#626262",
fontWeight: "500",
textAlign: "center",
},
navGroup: {
flexDirection: 'row',
flexDirection: "row",
},
})

0 comments on commit 7a4353b

Please sign in to comment.