Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed passing in title props, Keyextractor warning #3

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/IconPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ class IconPicker extends Component {

const {visible} = this.state;
const {icons} = this.props;
const title = this.props.title ? this.props.title : 'Choose icon...';
// This version did not work with adding the title props
//const title = this.props.title ? this.props.title : 'Choose icon...';
const title = icons[0].title ? icons[0].title : 'Choose icon...';
const openText = icons[0].openText ? icons[0].openText : "Open Picker";

const data = [];
icons.map( i => {
Expand All @@ -97,10 +100,16 @@ class IconPicker extends Component {
}}>
<View style={styles.wrapper}>
<View style={styles.content}>
<View style={styless.headerText}>
<TouchableOpacity onPress={() => {this.setState({visible: false})}}>
<Ionicons name='close-outline' size={30} color="#000" />
</TouchableOpacity>
</View>
<Text style={styles.title}>{title}</Text>
<View>
<FlatList
data={this.formatData(data, numColumns)}
keyExtractor={(item) => item.icon}
// style={styles.listContainer}
renderItem={this.renderItem}
numColumns={numColumns}
Expand All @@ -110,7 +119,7 @@ class IconPicker extends Component {
</View>
</Modal>
<TouchableOpacity onPress={() => this.setState({visible: true})}>
<Text>Open picker</Text>
<Text>{openText}</Text>
</TouchableOpacity>
</>
);
Expand Down