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 { createFetch } from 'callstackFetch'; // or import callstackFetch from 'callstackFetch' | |
const customFetch = createFetch({ // or new callstackFetch({}) | |
onError: (parseError) => {}, | |
onSuccess: (parsedBody) => {}, | |
parseError: (error) => {}, | |
parseBody: (body) => {}, | |
parseResponseHeaders: (headers) => ({ page: headers.get('Link') }), |
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
test2(id) { | |
this.test(id); | |
}, |
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
{ | |
activeSelectable: ?Object; | |
selectables: Array<{ | |
x: number; | |
y: number; | |
onFocus: Function; | |
onPress: Function; | |
onBlur: Function; | |
}>; | |
} |
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
_handleKeyDown = (key: number) => { | |
switch (key) { | |
case keyCodes.up: | |
this._selectNewActive(x => x - 1); | |
break; | |
case keyCodes.down: | |
this._selectNewActive(x => x + 1); | |
break; | |
case keyCodes.center: | |
if (this.state.activeSelectable) { |
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 { TextInput } from 'react-native'; | |
import selectable from './selectable'; | |
const Selectable = selectable(TextInput); // The most important line in this implementation! | |
export default class SelectableInput extends Component { | |
_input: any |
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 Input from './Input'; | |
import { validate } from './validation'; | |
class LoginForm extends Component { | |
rules = { | |
name: (value) => !value && 'name cannot be empty' // Some rules for each fields | |
} | |
handleSubmit = () => { |
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 Input from './Input'; | |
import withValidation from './withValidation'; | |
class LoginForm extends Component { | |
handleSubmit = () => { | |
const isValid = this.props.validate(); | |
if (isValid) { | |
// TODO: submit data | |
} |
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'; | |
... | |
type State = { | |
passwordVisable: boolean, | |
email: string, | |
password: string, |
OlderNewer