import React, { Component } from 'react' import { StyleSheet, View, Text, Image } from 'react-native' import { TouchableOpacity } from 'react-native-gesture-handler'; import { px2dp } from '../../utils/base'; export interface Props { route?: { params?: { isLongPress?: boolean } }, children?: Array } export interface State { } export default class ActionButton extends React.Component { constructor(props: Props | Readonly) { super(props); } componentDidMount() { } componentWillUnmount() { } public readonly state: Readonly = { } public isLongPress: boolean = false public btnData = [{ title: "画笔" }, { title: "分享" }, { title: "其他" }] onPress = (index: number) => { console.log(index) } renderContainer = () => { let { children } = this.props; return ( <> {/* { children ? children.map((item, index) => { }) : 暂无按钮 } */} { this.btnData && this.btnData.map((item, index) => this.onPress(index)}> {item && item.title} ) } ) } show = () => { console.log("我要打印了") } render() { return ( // // this.show // }> // 111 // // // this.onPress(1)}> // 111 // // // console.log(111)}> 111 ); } } const styles = StyleSheet.create({ main: { width: px2dp(60), height: px2dp(60), backgroundColor: "blue" }, buttonGroup: { width: px2dp(60), height: px2dp(180) }, btnStyle: { width: px2dp(60), height: px2dp(60), backgroundColor: 'red' } })