Remove autobind decorator. Fix bugs in AR view

This commit is contained in:
John Lyon-Smith
2018-05-28 16:12:20 -07:00
parent eb3649547a
commit f07c61c3b5
26 changed files with 1512 additions and 1481 deletions

View File

@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { View, Text, TouchableHighlight } from "react-native"
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
export class BoundButton extends React.Component {
static propTypes = {
@@ -14,6 +14,7 @@ export class BoundButton extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
const { name, binder } = this.props
@@ -21,7 +22,6 @@ export class BoundButton extends React.Component {
this.state = binder.getBindingState(name)
}
@autobind
updateValue(e) {
this.setState(e.state)
}

View File

@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { Header } from "."
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
const headerButtonShape = {
icon: PropTypes.string.isRequired,
@@ -19,6 +19,7 @@ export class BoundHeader extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
const { name, binder } = this.props
@@ -26,7 +27,6 @@ export class BoundHeader extends React.Component {
this.state = binder.getBindingState(name)
}
@autobind
updateValue(e) {
this.setState(e.state)
}

View File

@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { TextInput, Text, View, Platform } from "react-native"
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
export class BoundInput extends React.Component {
static propTypes = {
@@ -20,11 +20,11 @@ export class BoundInput extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
const { name, binder } = this.props
this.state = binder.getBindingState(name)
this.handleChangeText = this.handleChangeText.bind(this)
}
componentWillReceiveProps(nextProps) {
@@ -33,7 +33,6 @@ export class BoundInput extends React.Component {
}
}
// @autobind : There seems to be a bug with using this here, so we just do it the old way
handleChangeText(newText) {
const { binder, name } = this.props

View File

@@ -2,7 +2,7 @@ import React from "react"
import PropTypes from "prop-types"
import { View, Text } from "react-native"
import { OptionStrip } from "."
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
export class BoundOptionStrip extends React.Component {
static propTypes = {
@@ -17,10 +17,10 @@ export class BoundOptionStrip extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = props.binder.getBindingState(props.name)
}
@autobind
handleValueChanged(newValue) {
this.setState(
this.props.binder.updateBindingValue(this.props.name, newValue)

View File

@@ -12,7 +12,7 @@ import {
import { Icon } from "."
import ImagePicker from "react-native-image-picker"
import ImageResizer from "react-native-image-resizer"
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
import { api } from "../API"
const getScreenPortraitDimensions = () => {
@@ -35,10 +35,8 @@ export class BoundPhotoPanel extends Component {
constructor(props) {
super(props)
const { name, binder } = this.props
this.state = binder.getBindingState(name)
reactAutoBind(this)
this.state = this.props.binder.getBindingState(this.props.name)
}
componentWillReceiveProps(nextProps) {
@@ -47,7 +45,6 @@ export class BoundPhotoPanel extends Component {
}
}
@autobind
handlePhotoPress(index) {
const { onUploadStarted, onUploadEnded, onUploadProgress } = this.props
@@ -98,7 +95,6 @@ export class BoundPhotoPanel extends Component {
)
}
@autobind
handleLayout(e) {
if (!this.state.photoSize) {
const { layout } = e.nativeEvent

View File

@@ -1,7 +1,7 @@
import React from "react"
import PropTypes from "prop-types"
import { View, Switch, Text } from "react-native"
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
export class BoundSwitch extends React.Component {
static propTypes = {
@@ -12,10 +12,10 @@ export class BoundSwitch extends React.Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = props.binder.getBindingState(props.name)
}
@autobind
handleValueChange(newValue) {
const { binder, name } = this.props
const state = binder.getBindingState(name)

View File

@@ -1,7 +1,6 @@
import React from "react"
import PropTypes from "prop-types"
import { TextInput, Text, View, Platform } from "react-native"
import autobind from "autobind-decorator"
export class FormStaticInput extends React.Component {
static propTypes = {

View File

@@ -1,7 +1,6 @@
import React, { Component } from "react"
import { Image, View } from "react-native"
import PropTypes from "prop-types"
import autobind from "autobind-decorator"
export class Geolocation extends Component {
static propTypes = {

View File

@@ -1,7 +1,7 @@
import React, { Component } from "react"
import { View, Text, TouchableHighlight } from "react-native"
import PropTypes from "prop-types"
import autobind from "autobind-decorator"
import { reactAutoBind } from "auto-bind2"
export class OptionStrip extends Component {
static propTypes = {
@@ -14,12 +14,12 @@ export class OptionStrip extends Component {
constructor(props) {
super(props)
reactAutoBind(this)
this.state = {
selectedOption: this.getSelectedOption(props.options, props.value),
}
}
@autobind
getSelectedOption(options, value) {
return options.find((option) => value === option.value) || null
}
@@ -38,7 +38,6 @@ export class OptionStrip extends Component {
}
}
@autobind
handlePress(option) {
const { onValueChanged } = this.props