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
'use latest'; | |
/** | |
* A simple tasks that renders a page where an user can input a phone number and its recipient to send an SMS message using the Twilio APis. | |
* Please keep in mind that the following environment variables are required: | |
* TWILIO_SID: The SID token of your Twilio account | |
* TWILIO_AUTH_TOKEN: The auth token of your Twilio account | |
* TWILIO_FROM_NUMBER: The sender of the SMS (created in your Twilio account) | |
*/ |
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
# 1. Make sure to globally install the npm ios-deploy module first: | |
npm i -g ios-deploy | |
# 2. Run the following command: | |
react-native run-ios --device | |
# Hint - You can also specify the device name if needed: | |
react-native run-ios --device "Paul's iPhone" |
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
/* @flow */ | |
import React, { Component } from 'react' | |
import { View } from 'react-native-animatable' | |
import metrics from 'src/config/metrics' | |
type Props = { | |
isVisible: boolean, | |
backgroundColor: string, | |
animationTiming?: boolean | |
} |
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, { PropTypes } from 'react' | |
import styles from './index.style.css' | |
const CustomListItem = ({ onClick, leftContent, rightContent, ...props }) => { | |
return ( | |
<div className={styles.container} onClick={onClick} {...props}> | |
<div className={styles.left}>{leftContent}</div> | |
<div className={styles.right}>{rightContent}</div> | |
</div> |
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
// 1. Define a state variable for showing/hiding the action-button | |
state = { | |
isActionButtonVisible: true | |
} | |
// 2. Define a variable that will keep track of the current scroll position | |
_listViewOffset = 0 | |
// 3. Add an onScroll listener to your listview/scrollview | |
<ListView |
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 Parse from 'parse/node' | |
import { afterEach, describe, it } from 'mocha' | |
import chai from 'chai' | |
import chaiAsPromised from 'chai-as-promised' | |
import { resetParse, getAdminUser } from '../../../test/parseHelper' | |
import errors from '../../utils/errors' | |
chai.use(chaiAsPromised) | |
const assert = chai.assert |
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, PropTypes } from 'react' | |
import { DatePickerIOS, Text, TouchableOpacity, View } from 'react-native' | |
import { noop } from 'lodash' | |
import CustomModal from '../CustomModal' | |
import styles from './CustomDatePickerIOS.style' | |
export default class CustomDatePickerIOS extends Component { | |
static propTypes = { | |
visible: PropTypes.bool, |
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 { find, findIndex, pullAt } from 'lodash' | |
import { actionTypes as appActionTypes } from 'reducers/appReducer' | |
export const actionTypes = { | |
CREATE_MENU_ENTRY_REQUEST: 'MENU/CREATE_MENU_ENTRY_REQUEST', | |
CREATE_MENU_ENTRY_SUCCESS: 'MENU/CREATE_MENU_ENTRY_SUCCESS', | |
CREATE_MENU_ENTRY_FAILURE: 'MENU/CREATE_MENU_ENTRY_FAILURE', | |
UPDATE_MENU_ENTRY_REQUEST: 'MENU/UPDATE_MENU_ENTRY_REQUEST', | |
UPDATE_MENU_ENTRY_SUCCESS: 'MENU/UPDATE_MENU_ENTRY_SUCCESS', | |
UPDATE_MENU_ENTRY_FAILURE: 'MENU/UPDATE_MENU_ENTRY_FAILURE', |
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 { call, put } from 'redux-saga/effects' | |
import * as parseService from '../services/parseService' | |
import { actionTypes as authActionTypes } from '../reducers/authReducer' | |
import { actionTypes as navigationActionTypes } from '../reducers/navigationReducer' | |
import * as routes from '../config/routes' | |
export function* autoLogin (action) { | |
const user = yield call(parseService.currentUser) | |
if (user) { | |
yield call(loginSuccess, user) |
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
// ACTIONCREATORS USAGE EXAMPLE 1 | |
// When the action needed are all in a single duck (in this case authReducer) | |
import React, { Component, PropTypes } from 'react' | |
import { connect } from 'react-redux' | |
import { bindActionCreators } from 'redux' | |
import { actionCreators } from '../reducers/authReducer' | |
const mapStateToProps = (state, ownProps) => ({ | |
// blablabla | |
}) |