🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

react-native-toastjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-toastjs

React-Native Best Toast Message

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Installation

1. npm install

npm install react-native-toastjs

2. Wrap top view with ToastProvider

// before
<App />

// after
import ToastProvider from 'react-native-toastjs'
...

render(){
    return (
        <ToastProvider>
            <App />
        </ToastProvider>
    )
}

3. Using Toast

import { Toast } from 'react-native-toastjs'
Toast('Toast 테스트').show()

Example

import React from 'react';
import { SafeAreaView, View, Text } from 'react-native';

import ToastProvider, { Toast } from 'react-native-toastjs'

class App extends React.Component {
    componentDidMount(){
        Toast('Toast 테스트').show()
    }
    render(){
        return (
        <SafeAreaView style={{ flex: 1 }}>
            <ToastProvider>{/* ToastProvider는 필수로 감싸줘야함 */}

                {/* My Real View */}
                <View style={{ flex: 1 }}>
                    <View style={{ height: 100, backgroundColor:'red' }}>
                        <Text>HEAD</Text>
                    </View>
                    <View style={{ flex: 1, backgroundColor:'blue' }}>
                        <Text>Body</Text>
                    </View>
                </View>

            </ToastProvider>
        </SafeAreaView>
        )
    }
};

export default App;

Options

Toast Position

position top

Toast('Toast 테스트', { position: 'top' }).show()

position bottom

Toast('Toast 테스트', { position: 'bottom' }).show()

duration 2000

  • 2000ms(2초) 동안 천천히 나타납니다 Toast('Toast 테스트').show({ duration: 2000 })

length 10000

  • toast가 나타난 후 10000ms(10초) 동안 유지되다가 사라집니다 Toast('Toast 테스트').show({ length: 10000 })

Keywords

react-native

FAQs

Package last updated on 28 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts