UNPKG

fastcomments-react-native-sdk

Version:

React Native FastComments Components. Add live commenting to any React Native application.

14 lines (13 loc) 777 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { FastCommentsImageAsset } from "../types"; import { Image, Text, TouchableOpacity } from "react-native"; import { useState } from "react"; export function CheckBox(props) { const [value, setValue] = useState(props.value); const imageSrc = props.imageAssets[value ? FastCommentsImageAsset.ICON_CHECKBOX_CHECKED : FastCommentsImageAsset.ICON_CHECKBOX_UNCHECKED]; return _jsxs(TouchableOpacity, { style: props.style, onPress: () => { const newValue = !value; setValue(newValue); props.onValueChange(newValue); }, children: [_jsx(Image, { source: imageSrc, style: props.imageStyle }), _jsx(Text, { style: props.textStyle, children: props.text })] }); }