import React from 'react'; import axios from 'axios'; import {ScrollView, View, Text, useWindowDimensions} from 'react-native'; import ClipList from './ClipList'; import {store} from '../../redux/store'; import {useToast} from 'react-native-toast-notifications'; import {Button} from 'react-native-paper'; import {ps} from '../../utils'; import {useDispatch} from 'react-redux'; import {remoteClipAddToList} from '../../redux/reducers'; export default function ClipViewRemote() { const [clips, setClips] = React.useState( store.getState().remoteClip.remoteClip, ); const toast = useToast(); const dispatch = useDispatch(); const {height, width} = useWindowDimensions(); async function getClips(dispatch) { axios .get( 'http://notifysync.simailadjalim.fr/clipboard?token=' + store.getState().user.token, ) .then((response, status) => { let remoteclips = Object.values(response['data']['clipboard']); setClips(remoteclips); dispatch(remoteClipAddToList(remoteclips)); toast.show('fetched latest clips from remote'); }) .catch(response => { toast.show(response); toast.show('failed to fetch latest clips'); }); } function getSignOutBtn() { return ( ); } let title = 'Remote Clipboard'; return ( 600 ? ps(10) : 0, }}> ); }