Skip to content

Instantly share code, notes, and snippets.

@cezar08
Created June 1, 2019 00:52
Show Gist options
  • Select an option

  • Save cezar08/50497218036df6f59a2b84d75098250f to your computer and use it in GitHub Desktop.

Select an option

Save cezar08/50497218036df6f59a2b84d75098250f to your computer and use it in GitHub Desktop.
MineField
import React from 'react'
import { View, StyleSheet } from 'react-native'
import Field from './Field'
export default props => {
const rows = props.board.map((row, r) => {
const columns = row.map((field, c) => {
return <Field {...field} key={c}
onOpen={() => props.onOpenField(r, c)}
onSelect={e => props.onSelectField(r, c)} />
})
return <View key={r}
style={{flexDirection: 'row'}}>{columns}</View>
})
return <View style={styles.container}>{rows}</View>
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#EEE',
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment