Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
react navigation - prop value being used as navigation setOption: paremeter key

Is it possible to the something as follows:

const MyComponent = (position) => {

  useLayoutEffect(() => {
    navigation.setOptions({
      position: () => <CustomComponent />
    });
  }, [navigation, position]);

...
};

So the position value being passed to MyComponent will either be: 'headerLeft' or 'headerRight'

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Assuming that position is a string containing 'headerLeft' or 'headerRight', you could just create the object and pass it in:

useLayoutEffect(() => {
  let opts = { };
  opts[position] = () => <CustomComponent />;

  navigation.setOptions(opts);
}, [ navigation, position ]);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!