Code Monkey home page Code Monkey logo

react-native-snackbar's Introduction

React Native Snackbar

Build status npm downloads npm version Latest GitHub tag

Material Design "Snackbar" component for Android and iOS. Supports custom colors, fonts, and languages.

Snackbar screenshot

Snackbars are used for displaying a brief message to the user, along with an optional action. They animate up from the bottom of the screen and then disappear shortly afterward.

See Google's Material Design guidelines for more info on Snackbars and when to use them.

How it works

Snackbar.show({
  text: 'Hello world',
  duration: Snackbar.LENGTH_SHORT,
});

Or, to include an action button:

Snackbar.show({
  text: 'Hello world',
  duration: Snackbar.LENGTH_INDEFINITE,
  action: {
    text: 'UNDO',
    textColor: 'green',
    onPress: () => { /* Do something. */ },
  },
});

Installation

  1. Install:

    • Using npm: npm install react-native-snackbar --save
    • Using Yarn: yarn add react-native-snackbar
  2. Link:

    • RN >= 0.60 supports autolinking: first cd ios && pod install && cd ..
    • RN < 0.60: react-native link react-native-snackbar
    • Or if that fails, link manually using these steps
    • Note that because this is a native module, Expo does not support it -- to use with Expo you need to eject to ExpoKit
  3. Import it in your JS:

    import Snackbar from 'react-native-snackbar';

Usage

Snackbar.show(options)

Shows a Snackbar, dismissing any existing Snackbar first. Accepts an object with the following options:

Key Data type Default value? Description
text string Required. The message to show.
duration See below Snackbar.LENGTH_SHORT How long to display the Snackbar.
numberOfLines number 2 The max number of text lines to allow before ellipsizing.
marginBottom number 0 Margin from bottom.
textColor string or style 'white' The color of the message text.
backgroundColor string or style undefined (dark gray) The background color for the whole Snackbar.
fontFamily string undefined [Android only] The basename of a .ttf font from assets/fonts/ (see setup guide and example app, remember to react-native link after).
rtl boolean false [Android only, API 17+] Whether the Snackbar should render right-to-left (requires android:supportsRtl="true", see setup guide and example app).
action object (described below) undefined (no button) Optional config for the action button (described below).

Where duration can be one of the following (timing may vary based on device):

  • Snackbar.LENGTH_SHORT (just over a second)
  • Snackbar.LENGTH_LONG (about three seconds)
  • Snackbar.LENGTH_INDEFINITE (stays on screen until dismissed, replaced, or action button is tapped)

The optional action object can contain the following options:

Key Data type Default value? Description
text string Required. The button text.
textColor string or style 'white' The color of the button text.
onPress function undefined (Snackbar is simply dismissed) A callback for when the user taps the button.

Deprecation note: The old keys title and color have been replaced by text and textColor for consistency. The old keys will continue to work for now but are deprecated and may be removed at any time.

Snackbar.dismiss()

Dismisses any existing Snackbars.

Advanced usage

Snackbar events

You can have information on snackbar visibility.

  componentDidMount() {
    const SnackbarEventEmitter = new NativeEventEmitter(
      NativeModules.RNSnackbar,
    );
    this.eventListener = SnackbarEventEmitter.addListener('onSnackbarVisibility', (event) => {
      console.log(event.event);
    });
  }

  componentWillUnmount() {
    this.eventListener.remove();
  }

Or, with functional components:

  useEffect(() => {
    const subscription = new NativeEventEmitter(
      NativeModules.RNSnackbar,
    ).addListener('onSnackbarVisibility', event => {
      console.log(event.event);
    });
    return () => {
      subscription.remove();
    };
  }, []);

Where event is one of the following options :

Key Data type Value Description
Snackbar.DISMISS_EVENT_SWIPE number 0 Indicates that the Snackbar was dismissed via a swipe.
Snackbar.DISMISS_EVENT_ACTION number 1 Indicates that the Snackbar was dismissed via an action click.
Snackbar.DISMISS_EVENT_TIMEOUT number 2 Indicates that the Snackbar was dismissed via a timeout.
Snackbar.DISMISS_EVENT_MANUAL number 3 Indicates that the Snackbar was dismissed via Snackbar.dismiss() call.
Snackbar.DISMISS_EVENT_CONSECUTIVE number 4 Indicates that the Snackbar was dismissed from a new Snackbar being shown.
Snackbar.SHOW_EVENT number 5 Indicates that Snackbar appears

Troubleshooting

Snackbar not appearing [Android]

The Snackbar is designed to attach to whatever view is on top of your screen when show is called. If that view happens to be a temporary alert modal or some other view that goes away, you'll never see the Snackbar.

A workaround in some cases is to use setTimeout to show the Snackbar a few seconds later after the modal is gone. See issue #28 for further discussion. If you want to submit a PR to improve the view-finding logic, feel free.

Undefined import

If you see errors similar to Cannot read property 'LENGTH_LONG' of undefined or Undefined not an object (NativeModules.RNSnackbar), please refer to issue #43 for help.

Compiling [Android]

If you have issues compiling for Android after linking this library, please try updating your Gradle and Android configs to the latest versions. For example:

In your android/build.gradle:

  • com.android.tools.build:gradle:3.4.1 (or higher)

In your android/app/build.gradle:

  • compileSdkVersion 28 (or higher)
  • buildToolsVersion "28.0.3" (or higher)

Compiling [iOS]

Make sure your Deployment Target is iOS 9.0 or above.

Software development

If you want to help contribute to this library, here are local setup steps:

  1. Clone this git repo
  2. Install main dependencies: yarn install
  3. Set up the example app too: cd example && yarn install
  4. Within the example directory, react-native run-android to run it

The example app will update automatically when changing JS code. To see your changes in the example app after updating native library code, reinstall it via:

  1. yarn add file:.. && react-native run-android in the example directory
  2. Type "rr" in the app to trigger a reload

react-native-snackbar's People

Contributors

abartolo avatar abrahambotros avatar alijamaliz avatar bhullnatik avatar boceto1 avatar cooperka avatar dependabot[bot] avatar iroachie avatar jacque006 avatar jazz747 avatar jeffgukang avatar maheshwarimrinal avatar manuelmgm avatar mortezaheydari97 avatar mpatric avatar mrbrentkelly avatar polarisation avatar pozdena avatar rafalolszewski94 avatar remstos avatar rkbhochalya avatar rvasseur31 avatar sandromachado avatar sonicdoe avatar sudendrakl avatar tcodes0 avatar testauthbasic avatar thomasw avatar valdio avatar wodka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-snackbar's Issues

Compile issues since last update for COLOR [Android]

Android 4.4.4 - API 19

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

Compile error on Android

Hi, I try to run react-native run-android after implementing your module and I received the following error.

D:\ASOSApp\android\app\src\main\java\com\shoppingapp\MainApplication.java:6: error: package com.azendoo.reactnativesnackbar does not exist
import com.azendoo.reactnativesnackbar.SnackbarPackage;
                                      ^
D:\ASOSApp\android\app\src\main\java\com\shoppingapp\MainApplication.java:28: error: cannot find symbol
            new SnackbarPackage(),
                ^
  symbol: class SnackbarPackage
2 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

Do you know anyway to solve this?

Error while building for Android

This is the error I'm getting when I run react-native run-android

D:\Rizwan\RN\BBXAPP\android\app\src\main\java\com\bbxapp\MainApplication.java:6: error: package com.azendoo.reactnativesnackbar does not exist
import com.azendoo.reactnativesnackbar.SnackbarPackage;
                                      ^
D:\Rizwan\RN\BBXAPP\android\app\src\main\java\com\bbxapp\MainApplication.java:37: error: cannot find symbol
            new SnackbarPackage(),
                ^
  symbol: class SnackbarPackage
2 errors
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

Update to Android API version 27

As you mention in the README some people get problem building their project (if using newer Android API versions) when using react-native-snackbar. Is it fine to update to 27? I was also considering updating android gradle plugin to 3.1.0 but not sure if that could break things for people, please advise. I'll send a PR for the first part.

Flush against bottom

The material guidelines is saying that on Android the snackbar should be flush against the bottom of the screen like this:

They shows this video:

https://storage.googleapis.com/material-design/publish/material_v_12/assets/0B6Okdz75tqQsZV9TS3lTVHFzRUE/components-snackbar-usage-fabdo-005.webm

Is it possible to get this flush against bottom with this module?

Also I was looking at the code but not sure, is this a custom implementation of snackbar? Or is it using the actual Android SDK snackbar?

Build error: No resource found that matches the given name 'Animation.AppCompat.Dialog'.

I am getting error

.../node_modules/react-native-snackbar/android/build/intermediates/exploded-aar/com.android.support/design/23.3.0/res/values/values.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'Animation.AppCompat.Dialog'.
.../node_modules/react-native-snackbar/android/build/intermediates/exploded-aar/com.android.support/design/23.3.0/res/values/values.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Display1'.
.../node_modules/react-native-snackbar/android/build/intermediates/exploded-aar/com.android.support/design/23.3.0/res/values/values.xml:2 : Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Caption'
...

I am using fresh react 0.39 project. Here is my app/build.gradle file:

...
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.uzpaynet"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
...

What am I doing wrong?

Add Flow / TypeScript?

Are you interested in having typings, for those using react native with typescript? I've already started on it.

Add method to dismiss indefinite snackbar

Hi, Is it possible to destroy an indefinite Snackbar?

I planned to have a snackbar show up for speech recognition with the word "listening" and close it when I get a finished event from the speech module.

Crashing when triggering again with the same action object

Description

I've created a lookup with some configs defined for different notifications and one button to show each one. It works fine until I tap the same button a second time and then I get an error message about the background color (see below).

I should add that this is from a completely fresh React Native project.

Example

// @flow

import React, { Component } from "react";
import { StyleSheet, Text, Button, View } from "react-native";
import Snackbar from "react-native-snackbar";

const NOTIFICATIONS = {
  CANCELLED: {
    title: "Cancelled",
    duration: Snackbar.LENGTH_INDEFINITE,
    backgroundColor: "#DA2446",
    action: {
      title: "View",
      onPress: () => null
    }
  },
  COMPLETED: {
    title: "Completed",
    duration: Snackbar.LENGTH_LONG,
    backgroundColor: "#3DC217"
  },
  REQUEST: {
    title: "New Request",
    duration: 5000,
    backgroundColor: "#5B408E",
    action: {
      title: "Open",
      onPress: () => null
    }
  }
};

export default class App extends Component<null> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Button
          title="Show Cancelled"
          onPress={() => Snackbar.show(NOTIFICATIONS.CANCELLED)}
        />
        <Button
          title="Show Completed"
          onPress={() => Snackbar.show(NOTIFICATIONS.COMPLETED)}
        />
        <Button
          title="Show Request"
          onPress={() => Snackbar.show(NOTIFICATIONS.REQUEST)}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#F5FCFF"
  },
  welcome: {
    fontSize: 20,
    textAlign: "center",
    margin: 10
  }
});

simulator screen shot - iphone 6 - 2018-03-19 at 10 57 41

Not working

Saying cannot read property show of undefined

Snackbar not showing when called from a Promise.then()?

Below code works:

import Snackbar from 'react-native-snackbar';

// ...

          <Button onPress={
            ()=>{
              Snackbar.show({
                title: 'Log-in successful',
                action: {
                  title: 'OK',
                  color: 'yellow'
                }
              });
            }
          }>
            <Text>Test Snackbar</Text>
          </Button>

But this one where I use promises doesn't:

  • It allows the user to log-in w/ Facebook
  • Snackbar supposed to show on the part where we've logged in
  • The console log for hey1 and hey2 gets called, but Snackbar doesn't show
import Snackbar from 'react-native-snackbar';

// ...

          <Button onPress={
            ()=>{
              const requestPermissions = () => {
                const permissions = ['public_profile', 'email'];
                LoginManager
                  .logInWithReadPermissions(permissions)
                  .then(({grantedPermissions, isCancelled})=>{
                    if (!isCancelled) {
                      if (grantedPermissions.length !== permissions.length) {
                        requestPermissions();
                      } else {

                        AccessToken.getCurrentAccessToken().then((data) => {
                            console.log(data);
                          });
                        console.log('hey1');
                        Snackbar.show({
                          title: 'Log-in successful',
                          action: {
                            title: 'OK',
                            color: 'white'
                          }
                        });
                        console.log('hey2');

                      }
                    } else {
                      console.log('Login is cancelled bruh.');
                    }
                  }, (error)=>{
                    console.log('Login failed with error bruh: ' + error);
                  });
              };
              requestPermissions();
            }
          }>
            <Text>Log-in with Facebook</Text>
          </Button>

Any clues on what's going on with this behavior? I've tried looking in the closed issues but haven't found anything similar ๐Ÿ’ฏ Thanks

Edit: I've also tried attaching Nuclide's adb logcat debugger, there are no Java errors at all.

Edit: I even tried Toast instead, it worked. I'm wondering why this Snackbar won't.

ToastExample.show('Log-in successful.', ToastExample.SHORT);

Native on Android and JS on ios?

Hi there I was trying to learn about this module. Does it use a native snack bar component (is there one?) on Andoid? And if iOS it does a js polyfill?

Thanks for this superb module.

Build crash in Android

Hi, I've done npm install and react-native link react-native-snackbar and I get this output:

node_modules/react-native-snackbar/android/src/main/java/com/azendoo/reactnativesnackbar/SnackbarModule.java:70: error: package android.support.design.R does not exist TextView snackbarText = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);

I've tried with 23 and 25 compile sdk version and it persists. What could I do?

Thanks

libRNSnackbar.a was built for newer iOS version (9.1) than being linked (8.0)

This warning is showing up:

object file (/Users/daniel/Library/Developer/Xcode/DerivedData/MyApp-eukdcxeysdexiigripbtdscwtxsa/Build/Products/Debug-iphonesimulator/libRNSnackbar.a(RNSnackBarView.o)) was built for newer iOS version (9.1) than being linked (8.0)

It looks like the podspec's target is 8.0 but the xcode project's settings are 9.1.

'React/RCTBridgeModule.h' file not found while building

Hello,

I'm trying to run my app with react-native-snackbar' (react-native run-ios) and got this error (during building phase):

fatal error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.



** BUILD FAILED **

I'm using react-native 0.48 and snackbar 0.4.2.
I followed installation instruction (yarn add and react-native link which successfully ended)
My application succeed to build without snackbar module.

What am I doing wrong? :x

tx !

Add onDismiss callback

It would be useful to be able to hook a callback when the snackbar is dismissed, both for automatic dismiss (when duration reaches its end) and when the user opens another snackbar when the current one is active

PodSpec file not found

Installed the latest version of the react-native-snackbar lib, then I added the pod specific code in the Podfile: pod 'RNSnackbar', :path =>'../node_modules/react-native-snackbar'

On executing the pod install command I'm getting the following error:

Fetching podspec for `RNSnackbar` from `../node_modules/react-native-snackbar
[!] No podspec found for `RNSnackbar` in `../node_modules/react-native-snackbar

After looking into the package dir itself, I found that the pod specific file was not created on npm install. I installed the lib using npm itself, not sure if I missed something.

NativeModules.RNSnackbar.LENGTH_LONG - Cannot read property 'LENGTH_LONG' of undefined

Hello, when I am writing a 'Hello world' example according to readme, I got this error
"Cannot read property 'LENGTH_LONG' of undefined"
I think it's because this expression: "LENGTH_LONG: NativeModules.RNSnackbar.LENGTH_LONG,", which in src/index.js

I used "expo": "^27.0.1" with react native version 0.55.2
I imported react-native-snackbar this way:
import * as SnackBar from 'react-native-snackbar', I think error occured when importing.

Can somebody help me on this?

Feature: Displaying snackbar at the top/bottom of desired component

It would be nice to have the snackbar displayed at the top/bottom of required components instead of displaying at the very bottom of the whole app. This is especially useful if the app has tabBar at the bottom or when the snackbar has to show on top (again not at the very top but at the top of the desired component)


Edit from maintainer:

A simple, generic way to accomplish this might be to use a top and bottom value similar to how CSS works. With top: 0, the Snackbar would be at the very top of the screen. With bottom: 50, the Snackbar would be 50 dp above the bottom of the screen.

This was originally attempted in #137 but the PR was abandoned before it could be merged. Feel free to take that work as an example.

Crash when repeatedly tapping the action button

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.XXXXX, PID: 16540
java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:30)
at com.azendoo.reactnativesnackbar.SnackbarModule$1.onClick(SnackbarModule.java:103)
at android.support.design.widget.Snackbar$1.onClick(Snackbar.java:250)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

How to hide snackbar ?

Hi,

If snackbar is shown with duration LENGTH_INDEFINITE, then user should be able to cancel it by swiping or clicking the close button.
How to implement that?

Thanks

Compilation failed on iOS?

I just followed the instructions, any idea why this could be happening? I fear maybe my react-native version may be too low (react 15.3.2, react-native 0.35.0.

The following build commands failed:
	CompileC .../ios/build/Build/Intermediates/RNSnackbar.build/Debug-iphonesimulator/RNSnackbar.build/Objects-normal/x86_64/RNSnackbar.o RNSnackbar.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Does not work with modals

If I try to show a Snackbar in a Modal, the Snackbar will be displayed behind the modal and it will not be visible.

Future React Native breakage

This warning is showing up in the log in Xcode.

[RCTModuleData.mm:69] Module RNSnackbar requires main queue setup since it overrides constantsToExport but doesn't implement requiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

not able to import snackbar

I am getting the following error on importing snackbar after installing and linking the library,

TypeError: undefined is not an object (evaluating '_this3._savePrefrences.bind')

This error is located at:
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:78)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at RootNavigation.js:44)
    in RootNavigator (at App.js:15)
    in RCTView (at View.js:78)
    in View (at App.js:13)
    in App (at renderApplication.js:35)
    in RCTView (at View.js:78)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:78)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)
navigationOptions
    D:\reactnative\Denticiti\screens\NotificationSettingScreen.js:32:60
applyConfig
    D:\reactnative\Denticiti\node_modules\react-navigation\src\routers\createConfigGetter.js:12:9
<unknown>
    D:\reactnative\Denticiti\node_modules\react-navigation\src\routers\createConfigGetter.js:76:4
_getScreenDetails
    D:\reactnative\Denticiti\node_modules\react-navigation\src\views\CardStack\CardStack.js:138:41
render
    D:\reactnative\Denticiti\node_modules\react-navigation\src\views\CardStack\CardStack.js:272:47
proxiedMethod
    D:\reactnative\Denticiti\node_modules\react-proxy\modules\createPrototypeProxy.js:44:35
finishClassComponent
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:8888:23
updateClassComponent
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:8839:6
beginWork
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:9647:10
performUnitOfWork
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:12361:25
workLoop
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:12384:43
renderRoot
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:12427:17
performWorkOnRoot
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:13034:34
performWork
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:12951:26
performSyncWork
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:12913:16
batchedUpdates
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:13130:8
batchedUpdates
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2558:27
_receiveRootNodeIDEvent
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2694:17
receiveTouches
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2770:28
__callFunction
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:353:47
<unknown>
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:118:26
__guardSafe
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:316:6
callFunctionReturnFlushedQueue
    D:\reactnative\Denticiti\node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:117:17

Snackbar goes offscreen with modals/back button [Android]

SnackBar.show({
        title: "Timeout, reverting to old one...",
        duration: SnackBar.LENGTH_LONG,
        backgroundColor: "#493d46",
});
this.props.navigation.dispatch({
    type: NavigationActions.BACK,
});

It does show on IOS but it doesnt on Android...
using

react-navigation

@cooperka

Android only - Possible to respect bottom bar?

Hi there,

Thanks for this module I have been absolutely loving it!!

However I had an issue please. In my Android only version, The proper way for snackbar to respect bottom bar is to show above it. Like this article here shows - https://android.jlelse.eu/scroll-your-bottom-navigation-view-away-with-10-lines-of-code-346f1ed40e9e#2514

I have installed native CollapsibleToolbarLayout component for Android, but am not able to figure this one. I got this native element from here - https://github.com/cesardeazevedo/react-native-collapsing-toolbar

Demos of snackbar with static bottom bar, images from the article above:

https://cdn-images-1.medium.com/max/1600/1*cTdKeZzyboy97eWor-B7ow.png

Collapsing:

https://cdn-images-1.medium.com/max/1600/1*GcRVkeB7XkLGdPfllbF4Wg.gif

Callback button causes crash [iOS 8.1]

Seems to be fine on 10.1, but crashes on 8.1 as soon as you press the callback button on the snackbar.

Error:

EXC_BAD_ACCESS in RNSnackbar
Attempted to dereference null pointer.
at -[RNSnackbar show:callback:]_block_invoke_2

I'm currently working on a fix.

Related to this, I'm also fixing the example project since it apparently no longer works on either Android or iOS (dependencies are too far out of date).

Snackbar text black on older devices

The text for the Snackbar appears black on devices using android 4.4.

screen shot 2016-12-08 at 9 18 45 pm

Currently making this change to SnackbarModule.java to display it correctly.

Snackbar snackbar = Snackbar.make(view, Html.fromHtml("<font color=\"#ffffff\">" + title + "</font>"), duration);

Support for multiple snackbars (cascading)

Is it possible to modify this library such that new snacks are inserted below the previous ones (if the previous ones have not timed out). Similar to how react native displays errors and warnings...
Would this be a feature you would be willing to incorporate?

Snackbar accessibility label.

Hi,

I just realized that the snacker does not accept that accessibilityLabel option, I think it would be nice to have them accepting this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.