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
// navbar can be imperatively set / overrode via context | |
// this is a little automagical, but also allows for unlimited flexibility including changing route title within one route (e.g. intentBuilder) | |
class SomeScene extends Component { | |
componentWillMount() { | |
this.context.navbar.set({ | |
left, | |
middle, | |
right, | |
//... |
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
import React, { | |
Animated, | |
Component, | |
PropTypes, | |
} from 'react-native' | |
import _ from 'lodash' | |
import config from '../config' | |
class Animation extends Component { |
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
import stringify from 'json-stringify-safe' | |
// use a special rehydrating reducer | |
const rehydratingReducer = (state, action) => { | |
if (action.type === 'REHYDRATE') return action.payload | |
else return reducer(state, action) | |
} | |
// subscribe to store and serialize safely | |
// should either debounce or selectively run this method as it is expensive |
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
<DrawerIOS | |
disabled={!!this.props.modalValues.hasModals} | |
ref="drawer" | |
type="static" | |
content={sidebarContent} | |
onOpen={() => this.setState({isDrawerOpened: true})} | |
onClose={() => this.setState({isDrawerOpened: false})} | |
onOpenStart={() => { | |
this._hideKeyboard(); | |
this._setStatusBarHidden(true); |
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
try { | |
let data = await getSomeData() | |
processData(data) | |
// ... do more stuff | |
} catch (err) { | |
// handle bad data or exception | |
} |
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
import React, { | |
Component, | |
View, | |
Text, | |
TouchableOpacity, | |
StyleSheet , | |
} from '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
export default class App extends Component { | |
state = {initialized: false} | |
componentWillMount () { | |
persistStore(store, config, () => { | |
this.setState({initialized: true}) | |
}) | |
} | |
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
isSomethingTrue | |
? doA() | |
: isSomethingElseTrue | |
? doB() | |
: doC() |
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
// ... | |
<Camera ref='camera' target='disk' /> | |
// ... | |
this.refs.camera.takePicture((err, data) => { | |
NativeFileUploader(uploadUrl, {file: data.uri}, (err, data) => { | |
// ... | |
}) | |
}) |