04-Apr-2023
.
Admin
Hi Guys,
In this blog, I will explain you how to create tips in react native. You can easily create tips in react native. First i will import stylesheet namespace from react-native-tips, after I will make tips using in react native.
Here, I will give you full example for simply display tips using react native as bellow.
Step 1 - Create project
In the first step Run the following command for create project.
expo init nicesnippetsApp
Step 2 - Install Package
In the step,I will install npm i react-native-tips.
yarn add react-native-tips
Step 3 - App.js
In this step, You will open App.js file and put the code.
import React, { Component } from "react";
import { Text, View,StyleSheet, Button} from 'react-native';
import { Provider ,Appbar} from 'react-native-paper';
import Tips from 'react-native-tips';
const MyWebtutsComponent = () => {
const CopilotText = walkthroughable(Text);
const _goBack = () => console.log('Went back');
const _handleSearch = () => console.log('Searching');
const _handleMore = () => console.log('Shown more');
return (
<Provider>
<Appbar.Header style={styles.header}>
<Appbar.BackAction onPress={_goBack} />
<Appbar.Content title="Home" />
<Appbar.Action icon="magnify" onPress={_handleSearch} />
<Appbar.Action icon="dots-vertical" onPress={_handleMore} />
</Appbar.Header>
<View style={styles.container}>
<Tips visible
text="This is a tips !">
<Button
title="Learn More"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
</Tips>
</View>
</Provider>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
marginHorizontal: 16,
},
header:{
backgroundColor: '#ffffff',
}
});
export default MyWebtutsComponent;
Step 4 - Run project
In the last step run your project using bellow command.
npm start
Output
It will help you...
#React Native