reactnative自动换行

扣得代码,忘了哪来的了

能用就行
import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    TouchableOpacity
} from 'react-native';
import PropType from 'prop-types';

export default class imageType extends Component<{}> {

    constructor(props){
        super(props);
    }

    render() {
        return (
            <View style={styles.container}>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>12asdfa3</Text>
                </View>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>12sd3</Text>
                </View>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>1asdfadfadsf23</Text>
                </View>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>1asdf23</Text>
                </View>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>1a23</Text>
                </View>
                <View style={{ margin: 10, padding: 10, borderRadius: 5, backgroundColor: 'red'}}>
                    <Text>12dfdfdfdfdfdfdfdfs3</Text>
                </View>

            </View>
        );
    }
}

/*声明属性*/
imageType.propTypes = {

};

/*属性默认值*/
imageType.defaultProps = {

};

const styles = StyleSheet.create({
    container: {
        backgroundColor: 'black',
        padding: 10,
        flexDirection: 'row',
        flexWrap: 'wrap',
    },
});

你可能感兴趣的:(前端)