Created
June 1, 2019 00:52
-
-
Save cezar08/50497218036df6f59a2b84d75098250f to your computer and use it in GitHub Desktop.
MineField
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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