Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 930 Bytes

onClick.md

File metadata and controls

46 lines (38 loc) · 930 Bytes

Component prop onClick

Prop onClick mapping lvgl object event LV_EVENT_CLICKED

interface PARAM_TYPE {
    target: componentInstance; // original target
    currentTarget: componentInstance; // current target object, not the original object
    stopPropagation: () => {}; // stop event bubble
}

interface CALLBACK_TYPE {
    (e: PARAM_TYPE): void;
}

Value

onClick callback with the following type

  • CALLBACK_TYPE[]
  • CALLBACK_TYPE
  • null

Usage

import { View, Button, Text } from 'lvlgjs-ui'

function Component () {
    return (
         <View
            onScrollbarScrollingStyle={style.view}
            onPressed={[e => console.log(e.target), e => console.log(e.currentTarget)]}
        >
            <Button onClick={e => e.stopPropagation()}>
                <Text>2222</Text>
            </Button>
        </View>
    )
}

const style = {
    view: {},
    button1: {},
    button2: {}
}