Example and description of function toastandroid in react native

Source: Internet
Author: User

/**
* Function toastandroid (used to display a hover message on Android device)
* */

ImportReact,{purecomponent} from' react '
Import{view,text,touchableopacity,toastandroid} from' react-native '

classVibrationfunctionextendspurecomponent {
Render() {
return(
<View>
<Touchableopacity
onpress={() = toastandroid.Show(' I am the information of the hover window ',20000)}
style={{Height: -,BackgroundColor:' #0f0 ',Borderradius: -,margintop: -,justifycontent:' Center ',Alignitems:' Center '}}
>
<View>
<Textstyle={{textAlign:' Center '}}>Hover tip information (toastandroid)</Text>
</View>
</touchableopacity>
<touchableopacity
onpress={() = toastandroid.showwithgravity(' I am the information of the hover window ',10000, Toastandroid.LONG, Toastandroid.TOP)}
style={{Height: -,BackgroundColor:' #0f0 ',Borderradius: -,margintop: -,justifycontent:' Center ',Alignitems:' Center '}}
>
<View>
<Textstyle={{textAlign:' Center '}}>Hover Tip Top (toastandroid)</Text>
</View>
</touchableopacity>
<touchableopacity
onpress={() = toastandroid.showwithgravity(' I am the information of the hover window ', Toastandroid. Short, Toastandroid.BOTTOM)}
style={{Height: -,BackgroundColor:' #0f0 ',Borderradius: -,margintop: -,justifycontent:' Center ',Alignitems:' Center '}}
>
<View>
<Textstyle={{textAlign:' Center '}}>Suspension of Information Bottom (toastandroid)</Text>
</View>
</touchableopacity>
<touchableopacity
onpress={() = toastandroid.showwithgravity(' I am the information of the hover window ', Toastandroid. Short, Toastandroid.CENTER)}
style={{Height: -,BackgroundColor:' #0f0 ',Borderradius: -,margintop: -,justifycontent:' Center ',Alignitems:' Center '}}
>
<View>
<Textstyle={{textAlign:' Center '}}>Hover Tip Information Center (toastandroid)</Text>
</View>
</touchableopacity>
</View>
);
}
}
Export DefaultVibrationfunction;

/***
*
*
* This module exports the native Toastandroid module as a JS module for displaying a hover message on an Android device. This module contains a show method that accepts the following parameters:

String message: A string that represents the text content that will be displayed.
int Duration: The time at which the message continues to be displayed. It could be toastandroid.short or Toastandroid.long.
There is also a method named Showwithgravity that specifies where to eject. Available options are: Toastandroid.top, Toastandroid.bottom, Toastandroid.center.

Usage Examples:

//method
Static Show (message:string, Duration:number)
Display (Message: String, Duration: number)

static showwithgravity (message, duration, gravity)
showwithgravity (message, duration, location)

Properties
short:memberexpression

long:memberexpression

Time Constants

top:memberexpression
//Top

bottom:memberexpression
//Bottom

center:memberexpression
//Middle

//Position constant


* ***/
function share (used to open a dialog box on an Android device to share or send text content)

Example and description of function toastandroid in react native

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.