Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

making the radio button a touch target for the thread select screen #713

Merged
merged 2 commits into from
Dec 6, 2018

Conversation

saranrapjs
Copy link
Contributor

textile is great! i've honestly waiting for something like this to bubble up and am excited to see how usable it is even for not p2p heads like me :)
this PR fixes something i ran into when initially poking around in the app, where tapping on the radio button in the "Thread select" view for an image wouldn't select the corresponding thread. hopefully uncontroversial, but let me know if there's anything i should do differently

@asutula
Copy link
Member

asutula commented Dec 5, 2018

Awesome, thanks for the PR @saranrapjs! Looking at the code now, I think there's a (more) simple fix. Will insert a couple comments.

{ selected && <Image style={styles.buttonImage} source={require('./statics/check.png')} /> }
{ selected && <View style={[styles.buttonSelected, disabled && styles.buttonDisabled]} /> }
</TouchableOpacity>
)
}

RadioButton.defaultProps = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, this component is just a simple stateless component. It's a function that takes in props and return a component. Setting defaultProps has no effect I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stateless components are no different from class components: they will pull in static properties like defaultProps/propTypes in the same way. I wasn't exactly sure where all else this radio button was being used, & had wanted to have a default in case!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow cool, didn't know!

Copy link
Member

@asutula asutula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you have any questions about that. Just seems like the simple solution. Easier to understand than passing a callback to two different components, one nested inside the other.

@asutula asutula merged commit a7776c6 into textileio:master Dec 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants