Unverified Commit 87886f9e authored by Thibaut Sardan's avatar Thibaut Sardan Committed by GitHub
Browse files

Merge pull request #283 from paritytech/tbaut-icon-selector

Get back the icon selector
parents a6f0d1bd 30d65273
Pipeline #44633 failed with stage
in 45 seconds
......@@ -56,7 +56,7 @@ export default class AccountIconChooser extends React.PureComponent<{
.split(' ')
.map(async () => {
const seed = await words();
const { bip39, address } = await brainWalletAddress(seed);
const { address } = await brainWalletAddress(seed);
return {
seed,
......@@ -73,38 +73,40 @@ export default class AccountIconChooser extends React.PureComponent<{
}
};
render() {
renderIcon = ({ item, index }) => {
const { value, onChange } = this.props;
const iSelected = item.address.toLowerCase() === value.toLowerCase();
const style = [styles.icon];
return (
<TouchableOpacity
key={index}
style={[styles.iconBorder, iSelected ? styles.selected : {}]}
onPress={() =>
onChange({
address: item.address,
seed: item.seed
})
}
>
<AccountIcon style={style} seed={'0x' + item.address} />
</TouchableOpacity>
);
}
render() {
const { value } = this.props;
const { icons } = this.state;
console.log(icons);
return (
<View style={styles.body}>
<FlatList
style={styles.icons}
data={icons}
keyExtractor={item => item.address}
extraData={value}
horizontal
renderItem={({ item, index, separators }) => {
const selected = item.address.toLowerCase() === value.toLowerCase();
const style = [styles.icon];
return (
<TouchableOpacity
key={index}
style={[styles.iconBorder, selected ? styles.selected : {}]}
onPress={() =>
this.props.onChange({
address: item.address,
seed: item.seed
})
}
onShowUnderlay={separators.highlight}
onHideUnderlay={separators.unhighlight}
>
<AccountIcon style={style} seed={'0x' + item.address} />
</TouchableOpacity>
);
}}
keyExtractor={item => item.address}
renderItem={this.renderIcon}
style={styles.icons}
/>
<Text
numberOfLines={1}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment