question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v6.4.1 (React-Native 0.39.2) Dirty flag is not set on iOS

See original GitHub issue

Hi,

I’m trying to show a “Save” button on the NavBar when the form is “dirty”. So I use “this.props.dirty” to check that and show the state of the form (“Clean” or “Dirty”). But “this.props.dirty” is never set on iOS simulator, however working fine on Android simulator. Any idea?

componentDidMount() {
    Actions.refresh({ renderRightButton: this.renderRightButton });
  }

  renderRightButton = () => {
    if (this.props.dirty) {
      return (
        <TouchableOpacity onPress={this.onAddAccount}>
          <Text>Dirty</Text>
        </TouchableOpacity>
      );
    }

    return (
      <TouchableOpacity onPress={this.onAddAccount}>
        <Text>Clean</Text>
      </TouchableOpacity>
    );
 }

screen shot 2017-01-02 at 10 10 47 pm screen shot 2017-01-02 at 10 11 15 pm

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ooiclcommented, Jan 3, 2017

I solved it by forcing the NavBar to re-render when the component is updated.

  componentDidMount() {
    Actions.refresh({ renderRightButton: this.renderRightButton });
  }

  componentDidUpdate() {
    Actions.refresh({ renderRightButton: this.renderRightButton });
  }
1reaction
ooiclcommented, Jan 2, 2017

The redux store for the Form seems identical but I don’t know where the “dirty” flag is stored…

screen shot 2017-01-02 at 10 59 49 pm screen shot 2017-01-02 at 11 01 08 pm

Read more comments on GitHub >

github_iconTop Results From Across the Web

homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found