File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useEffect } from 'react' ;
1+ import React from 'react' ;
22import { StyleSheet , Text , View } from 'react-native' ;
33import { SafeAreaProvider } from 'react-native-safe-area-context' ;
44
55import ContactsDemoScreen from './screens/ContactsDemoScreen' ;
6- import { getUpdatedSincePaged } from '@omarsdev/react-native-contacts' ;
76
87export default function App ( ) {
98 const [ totalContacts , setTotalContacts ] = React . useState < number | null > ( null ) ;
109
11- useEffect ( ( ) => {
12- const getContacts = async ( ) => {
13- await getUpdatedSincePaged . listen (
14- { since : '' , pageSize : 1 } ,
15- async ( page ) => {
16- console . log ( `Page mode=${ page . mode } size=${ page . items . length } ` , {
17- items : page . items ,
18- } ) ;
19- }
20- ) ;
21- } ;
22-
23- getContacts ( ) ;
24- } ) ;
25-
2610 return (
2711 < SafeAreaProvider >
2812 < View style = { styles . container } >
Original file line number Diff line number Diff line change @@ -23,23 +23,19 @@ const InfoPanel = React.memo(
2323 since,
2424 listLabel,
2525 listCount,
26- totalCount,
2726 } : Props ) => (
2827 < View style = { styles . info } >
2928 < Text style = { styles . text } > Delta status: { deltaStatus } </ Text >
3029 < Text style = { styles . text } >
3130 Granted: { String ( granted ) } • Loading: { String ( loading ) }
3231 </ Text >
33- < Text style = { styles . text } >
32+ < Text style = { styles . text } numberOfLines = { 1 } >
3433 Since: { since || '(empty)' }
3534 { since ?. startsWith ( 'fp:' ) ? ' • fingerprint' : '' }
3635 </ Text >
3736 < Text style = { styles . text } >
3837 Showing { listCount } { listLabel }
3938 </ Text >
40- { typeof totalCount === 'number' ? (
41- < Text style = { styles . text } > Total device contacts: { totalCount } </ Text >
42- ) : null }
4339 </ View >
4440 )
4541) ;
Original file line number Diff line number Diff line change 22#import < Contacts/Contacts.h>
33#import < Foundation/Foundation.h>
44
5- - (void )getAll:(RCTPromiseResolveBlock)resolve
6- reject:(RCTPromiseRejectBlock)reject
7- {
8- resolve (CLUFetchAllContacts ());
9- }
10-
115@implementation ContactsLastUpdated
126RCT_EXPORT_MODULE ()
137
You can’t perform that action at this time.
0 commit comments