This file contains 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
import { BackHandler } from 'react-native' | |
import { Actions, Router } from 'react-native-router-flux' | |
class App extends Component { | |
componentDidMount () { | |
this.backHandler = BackHandler.addEventListener('hardwareBackPress', this.handleBackPress) | |
} | |
componentWillUnmount() { | |
this.backHandler.remove() |
This file contains 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
import { Actions } from 'react-native-router-flux' | |
export function getPreviousScene (jumpCount = 1) { // if nothing is passed, it defaults to 1 | |
const index = Actions.prevState.routes.length - (jumpCount + 1) // because zero-based index | |
if (index >= 0) { | |
return Actions.prevState.routes[index].routeName | |
} | |
return 'home' |
This file contains 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
// External Dependencies | |
import React, { Component } from 'react' | |
import { View } from 'react-native' | |
import PropTypes from 'prop-types' | |
import _ from 'lodash' | |
// Internal Dependencies | |
import FormField from './FormField/FormField.component' | |
import styles from './Form.styles' |
This file contains 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
const fruits = ['apple', 'banana', 'orange', 'jackfruit'] | |
let separatedList = '' | |
fruits.forEach((fruit, index) => { | |
const isSeparated = fruits.length > 1 && (index + 1 < fruits.length) | |
const isCommaSeparated = isSeparated && (index + 2 < fruits.length) | |
const isAmpersandSeparated = isSeparated && (index + 2 === fruits.length) | |
separatedList = separatedList + fruit |
This file contains 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
import React, { Component } from 'react' | |
import { Animated, ScrollView, StyleSheet, View } from 'react-native' | |
const HEADER_MAX_HEIGHT = 350 | |
const HEADER_MIN_HEIGHT = 175 | |
const SEARCH_AREA_HEIGHT = 100 | |
const SEARCH_AREA_MAX_TOP = HEADER_MAX_HEIGHT - (SEARCH_AREA_HEIGHT / 2) | |
const SEARCH_AREA_MIN_TOP = 120 | |
export default class App extends Component { |