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.

Snackbar Duration Question

See original GitHub issue

I assumed any number value could be passed to the duration prop. Is this not the case?

Current behaviour

Passing Infinity to the duration prop gives me an error:

Expected dynamic type ‘double’ but had type ‘null’. (constructing arguments for Timing.createTimer at argument index 1)

Expected behaviour

Assumed we could pass any value that is a number to the duration prop.

Code sample

        <Snackbar
          visible={this.props.isBLESnackbarVisible}
          onDismiss={this.onDismiss}
          duration={Infinity}
          theme={theme}
          action={{
            label: 'SETTINGS',
            onPress: () => {
              AndroidOpenSettings.bluetoothSettings();
            },
          }}
        >
          Try resetting bluetooth.
        </Snackbar>

What have you tried

I have passed in other number values with success (i.e. 15000, 30000, etc.)

Your Environment

software version
ios or android Android
react-native 0.57.8
react-native-paper 2.7.0
node 7.0.0
npm or yarn 6.4.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Taym95commented, Mar 7, 2019

I would like to work on this issue!

0reactions
satya164commented, Mar 7, 2019

@Taym95 awesome! PR welcome 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Snackbar duration and height - flutter - Stack Overflow
The problem is that the snackbar appears for seconds and then disappears. So I have two questions: How to stop the snackbar from...
Read more >
Snackbar duration | Thinkwise Community
Therefore it should be displayed short. And the message should be short. If the message is longer to read, it's duration should be...
Read more >
Snackbar duration and height - Stack Overflow
I'm trying to show a snackbar. After I click on a gesture detector, this snack has two buttons. The problem is that the...
Read more >
Snackbars - Material Design
Snackbars provide brief feedback about an operation through a message at the bottom of the screen.
Read more >
Android Snackbar Example Tutorial - DigitalOcean
Snackbar.LENGH_LONG : This is last parameter which is the time limit how long snackbar to be displayed. show() method is used to display...
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