Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useRef Array

/*both useRef({}) and useRef([]) work..*/
import CalendarStrip from 'react-native-calendar-strip';
export default function App() {
const one = useRef({});
 let x= [];
 
function q()
{
   one.current.getNextWeek();
   two.current.getNextWeek();
}

return (
    <View>
    <CalendarStrip 
    ref={(el)=> one.current[0] = el}
      style={{height:150, paddingTop: 20, paddingBottom: 10}} rightSelector={x} leftSelector={x}
    />

<CalendarStrip 
    ref={(el)=>one.current[1] =el}
      style={{height:150, paddingTop: 20, paddingBottom: 10}}
    />
    <TouchableOpacity onPress={()=>q()}>
      <Text>
        Click Me
      </Text>
    </TouchableOpacity>
    </View>
  );
}
 
PREVIOUS NEXT
Tagged: #useRef #Array
ADD COMMENT
Topic
Name
4+2 =