UNPKG

fastcomments-react-native-sdk

Version:

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

12 lines (11 loc) 774 B
import { jsx as _jsx } from "react/jsx-runtime"; import { Text, TouchableOpacity } from 'react-native'; export function ShowHideCommentsToggle({ state, styles }) { const commentsVisible = state.commentsVisible.get(); let translation = commentsVisible ? state.translations.HIDE_COMMENTS_BUTTON_TEXT.get() : state.translations.SHOW_COMMENTS_BUTTON_TEXT.get(); if (!translation) { translation = 'ERROR'; } translation = translation.replace('[count]', Number(state.commentCountOnServer.get()).toLocaleString()); return _jsx(TouchableOpacity, { style: styles.showHideCommentsToggle?.root, onPress: () => state.commentsVisible.set(!commentsVisible), children: _jsx(Text, { style: styles.showHideCommentsToggle?.text, children: translation }) }); }