import React, {useState} from 'react'; import { Modal, StyleSheet, View, Text, Button, TouchableOpacity, ScrollView, ViewProps, } from 'react-native'; import {RadioCheckbox, CenteredView, OverlayView} from '../common'; import TermsAndConditionsText from './TermsAndConditionsText'; interface TermsConditionsProps extends ViewProps { accepted: boolean; onChange: (accepted: boolean) => void; } const TermsConditions: React.FC = (props) => { // boolean representing if modal is visible const [modalVisible, setModalVisible] = useState(false); // destructure props const {accepted, onChange} = props; /** * Hides the modal. */ const hideModal = (): void => { if (modalVisible) { setModalVisible(false); } }; /** * Sets `accepted` to `true` and hides the modal. */ const handleAccept = (): void => { onChange(true); hideModal(); }; /** * Toggles the value of `accepted`. */ const toggleAccepted = (): void => { onChange(!accepted); }; return ( I accept the setModalVisible(true)}> terms and conditions. Terms and Conditions