fastcomments-react-native-sdk
Version:
React Native FastComments Components. Add live commenting to any React Native application.
21 lines (20 loc) • 1.33 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { View } from "react-native";
import { ReplyArea } from "./reply-area";
import { useHookstate } from "@hookstate/core";
import { useState } from "react";
export function LiveCommentingBottomArea(props) {
const { imageAssets, onAuthenticationChange, onNotificationSelected, onReplySuccess, pickGIF, pickImage, styles, translations } = props;
const state = useHookstate(props.state); // OPTIMIZATION: creating scoped state
const [parentComment, setParentComment] = useState();
props.callbackObserver.replyingTo = (comment) => {
if (comment) {
setParentComment(comment);
}
else {
setParentComment(null);
}
};
return _jsx(View, { style: props.styles.bottomArea?.root, children: _jsx(View, { children: state.config.inputAfterComments.get({ stealth: true }) &&
_jsx(View, { style: props.styles.bottomArea?.replyArea, children: _jsx(ReplyArea, { imageAssets: imageAssets, onAuthenticationChange: onAuthenticationChange, onNotificationSelected: onNotificationSelected, onReplySuccess: onReplySuccess, parentComment: parentComment, pickGIF: pickGIF, pickImage: pickImage, replyingTo: props.callbackObserver.replyingTo, state: state, styles: styles, translations: translations }) }) }) });
}