Saturday, December 21, 2024

 

Introduction

           InspireWall is your go-to app for daily inspiration and wallpaper! Discover a collection of beautifully designed wallpapers and powerful quotes that uplift your spirits and keep you focused. Whether you're seeking positivity, encouragement, or simply a touch of beauty for your device, InspireWall has something for everyone. Customize, save, and share your favorite inspirations to brighten not just your day, but others' too!








Key features :

  • Inspirational Quotes: A vast collection of motivational and uplifting quotes for daily encouragement.
  • High-Quality Wallpapers: Beautifully designed wallpapers featuring inspirational themes and  messages
  • Daily Highlights: New quotes and wallpapers delivered every day to keep users inspired.
  • Easy Sharing: Share favorite quotes and wallpapers directly on social media or with friends.
  • Categories & Tags: Browse content by themes like success, love, positivity, or mindfulness.

  •  Downloads: Download and set inspiring wallpapers & quotes directly from the app.

What will you get?

- React Native source code : Android + ios
- Documentation File
- code flexibility

Changelog

 version 1.0 (21-12-2024)
- initial release 



Wednesday, June 2, 2021

How To Implement Responsive Table In React Native Example 2021

                                                  React Native Table

In this article, we are going to look at how to build table in react native and display the data in the table. We will create a responsive table in react native application, this table will be horizontally and vertically Scrollable. The header of the table will be fixed while scrolling the table horizontally or vertically.


Tables help us display information neatly and elegantly in rows and columns. We are using react-native-table-component Library for design a table.

Lets, Start building table component.

1. Install the latest react native CLI by typing the below command in the terminal.

npm install -g react-native-cli

2. Create a new application by typing below command in the terminal.

react-native init ReactNativeTable

3. Enter Inside the Project Folder.

cd ReactNativeTable

4. Install the react-native-table-component package by running the following command in the terminal.

npm i react-native-table-component

Now, we are all set to start creating Android and ios Table in react native application.

To build table in react native , we have to import following methods in App.js file. Define Constructor (props), super(props), and

state inside the export default class app. Inside the state, we declare the Table's header and width of array that we will display in table.

export default class App extends Component{

  constructor(props) {
    super(props);
    this.state = {
      tableHead: ['Id''Name','Age''city''Status'],
      widthArr: [50,90,70,90,100]
     
    }
  }

Next, We will declare the render() method inside the export default class App. Here we set the dummy data which will display in table.

render(){
  const state = this.state;
    const tableData = [
      ['1','John','27','Hairball',' Success '],
      ['2','Krish','29','Canyon',' Success '],
      ['3','Arnold','22','Paradise',' Success'],
      ['4','Mickey','25','Itly',' Success '],
    ];
________________________________________________________________________________________
Final App.js File Code

import React, { Component } from 'react';
import { PlatformStyleSheetTextView, ScrollView, } from 'react-native';
import PropTypes from 'prop-types';
import { TableTableWrapperRowRowsCol } from 'react-native-table-component';

export default class App extends Component{
  constructor(props) {
    super(props);
    this.state = {
      tableHead: ['Id''Name', 'Age''city''Status'],
      widthArr: [50,90,70,90,100]
     
    }
  }
 
render(){
  const state = this.state;
    const tableData = [
      ['1','John','27','Hairball',' Success '],
      ['2','Krish','29','Canyon',' Success '],
      ['3','Arnold','22','Paradise',' Success'],
      ['4','Mickey','25','Itly',' Success '],
    ];
  
  return (
    <View style={styles.MainContainer}> 
    <Text style={{fontSize:20,color:'#D00'}}>React Native Table</Text>
       <ScrollView horizontal={true}>
       <View>
            <Table borderStyle={{borderWidth: 1, borderColor: '#C1C0B9'}}>
              <Row data={state.tableHead} widthArr={state.widthArr} style={styles.header} textStyle={{padding:15,fontWeight:'bold'}}/>
            </Table>
            <ScrollView style={styles.dataWrapper}>
              <Table borderStyle={{borderWidth: 1, borderColor: '#C1C0B9'}}>
                {
                  tableData.map((rowData, index) => (
                    <Row
                      key={index}
                      data={rowData}
                      widthArr={state.widthArr}
                      style={[styles.row, index%2 && {backgroundColor: '#D7DBDD'}]}
                      textStyle={styles.text}
                      
                    />
                  ))
                }
              </Table>
            </ScrollView>
          </View>
      </ScrollView>         
  </View
);
}
}

const styles = StyleSheet.create({
 
  header: { height: 40, backgroundColor: '#D7DBDD' },
  text: {padding:15,fontWeight: '100' },
  dataWrapper: { marginTop: -1 },
  row: { height: 40, backgroundColor: '#FFFFFF' },

MainContainer: {
  flex:1,
backgroundColor: '#FFFFFF',
justifyContent: 'center',
alignItems: 'center',
marginTop:200,
marginLeft:15,
marginRight:10
},

});
_________________________________________________________________________________________

Output:



Thursday, April 1, 2021

React native flatlist right icon

                              React native FlatList right icon

                                  

             Lists are one of the common scrollable components to display similar types of data objects. A list is like an enhanced version of a ScrollView component to display data. React Native provides a FlatList component to create a list. FlatList only renders the list items that can be displayed on the screen. FlatList is a specialized implementation of the Virtualized List component to display a limited number of items that can fit inside the current window. The rest of the items will be rendered with the list scrolling action. FlatList can simply be implemented using the data and renderItem props to create a list. data takes an array of items, of type any, to populate items in the list. renderItem requires a function that takes an item object as an input from the data source to construct and return a list-item component. Optional props are used to decorate FlatList using an item-divider, header/footer, pull-to-refresh, handle refreshing or optimization logic. ItemSeparatorComponent is used to add a separator to visually separate items. keyExtractor is used to provide a unique value (ID, email, etc.) to avoid the recreation of the list by tracking the reordering of the items. extraData takes a boolean value to re-render the current list. FlatList is a Pure Component that does not re-render against any change in the state or props objects, so extraData prop is used to re-render the current list if the data array is being mutated. initialNumToRender is used to render a minimum number of item-components in a FlatList for efficiency. ListEmptyComponent is used to display an empty view while the data is being downloaded. ListHeaderComponent is used to add a header component like search, menu-items, etc. ListFooterComponent is used to add a footer component like total items, data summary etc. getItemLayout returns the predefined size of the list-item component to skip the size calculation process at runtime to speed up the rendering process. horizontal prop takes a boolean value to create a horizontal list by returning like horizontal={true}. numColumns is used to create a column-based list.onRefresh and refreshing are used to implement pull-to-refresh controls, and maintain their visibility using a boolean flag. onEndReached and onEndReachedThreshold are used to implement lazy loading callback with a given threshold value. There are other props that can be used to implement style, scrolling, etc.React always uses a unique key to track the updates in a component.

                        By default, the FlatList looks either for a custom keyExtractor implementation or a field named key in a data item, otherwise it uses the array index as the value of key. The id is a unique value in the response that can be used to implement the keyExtractor. FlatList offers great flexibility to create and configure a list in a React Native app. FlatList can be optimized for static and dynamic data using various layout calculations and rendering props. 

The FlatList component displays the similar structured data in a scrollable list. It works well for large lists of data where the number of list items might change over time. The FlatList shows only those renders elements which are currently displaying on the screen,not all the elements of the list at once. The FlatList component takes two required props: data and renderItem. The data is the source of elements for the list,and renderItem takes one item from the source and returns a formatted component to render. To implement the FlatList component, we need to import FlatList from 'react-native' library.


__________________________________________________________________________

import React from 'react';
import { StyleSheetTextViewFlatListImageTouchableOpacity } from 'react-native';

function Item({ item }) {
  return (
    <View style={styles.listItem}>
      <Image source={{uri:item.photo}}  style={{width:60, height:60,borderRadius:30}} />
      <View style={{alignItems:"center",flex:1}}>
        <Text style={{fontWeight:"bold"}}>{item.name}</Text>
       
      </View>
      
    </View>
  );
}

export default class App extends React.Component {
  state = {
    data:[
        {
            "name""Lotus",
            "photo""https://cdn.pixabay.com/photo/2015/10/09/00/55/lotus-978659_960_720.jpg"
        },
        {
            "name""Rose",
            "photo""https://cdn.pixabay.com/photo/2015/03/26/18/08/rose-693152_960_720.jpg"
        },
        {
            "name""Lily",
            "photo""https://cdn.pixabay.com/photo/2016/06/18/15/36/agapanthus-1465146_960_720.jpg"
        },
        {
            "name""Daisy Flower",
            "photo""https://cdn.pixabay.com/photo/2015/04/19/08/32/marguerite-729510_960_720.jpg"
        },
        {
            "name""Sunflower",
            "photo""https://cdn.pixabay.com/photo/2018/01/28/11/24/sunflower-3113318_960_720.jpg"
        },
        {
            "name""Yellow Tulips",
            "photo""https://cdn.pixabay.com/photo/2015/03/26/09/47/tulips-690320_960_720.jpg"
        },
        {
            "name""Jasmine Flower",
           
            "photo""https://cdn.pixabay.com/photo/2019/07/09/06/12/jasmine-4326292_960_720.jpg"
        },
        {
            "name""Magnolia",
            
            "photo""https://cdn.pixabay.com/photo/2020/04/24/23/34/magnolia-5088974_960_720.jpg"
        },
        {
            "name""Tuberose",
           
            "photo""https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSRMzWEA4sUNLErdQXCBBZzceMMHk7bHZLUJ6WwPSX9Mr6ZGu2QFw-3iMxFxLUoQeuytqE&usqp=CAU"
        },
       
    ]
  }


  render(){
    return (
      <View style={styles.container}>
        <FlatList
          style={{flex:1}}
          data={this.state.data}
          renderItem={({ item }) => <Item item={item}/>}
          keyExtractor={item => item.email}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F7F7F7',
    marginTop:60
  },
  listItem:{
    margin:10,
    padding:10,
    backgroundColor:"#FFF",
    width:"80%",
    flex:1,
    alignSelf:"center",
    flexDirection:"row",
    borderRadius:5
  }
});
_______________________________________________________________________________________
Output:



How to give title in react native?

                                             Title in React Native

React Native is a JavaScript Framework that is employed to create native mobile apps using JavaScript and React. It uses an equivalent style as React and maintained by Facebook and a community of individual developers and corporations. React Native is incredibly helpful to create Android and IOS Apps. Headers are navigation components that display information and actions relating to the current screen.

              In order to use params in the title, we need to make options prop for the screen a function that returns a configuration object. It might be tempting to try to use this.props inside of options, but because it is defined before the component is rendered, this does not refer to an instance of the component and therefore no props are available. Instead, if we make options a function then React Navigation will call it with an object containing { navigation, route } - in this case, all we care about is route, which is the same object that is passed to your screen props as route prop. You may recall that we can get the params through route. params, and so we do this below to extract a param and use it as a title.

how to set navigation title in react native

The static property of a screen component is called navaigationOptions. It is either an object or a function. It returns an object containing several configuration options. you can add navigation dependancy in your project. In following example we create two screens. when we press the button we go to the next screen. we add header in navigationOptions. 

__________________________________________________________________________

import React from 'react';  
import { ViewTextButton } from 'react-native';  
import { createAppContainer } from 'react-navigation';  
import { createStackNavigator} from 'react-navigation-stack';
  
class FirstScreen extends React.Component {  
    static navigationOptions = {  
        title: 'FirstScreen',  
        headerStyle: {  
            backgroundColor: '#f4511e',  
        },  
        //headerTintColor: '#0ff',  
        headerTitleStyle: {  
            fontWeight: 'bold',  
        },  
    };  
  
    render() {  
        return (  
            <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>  
                <Text>First Screen</Text>  
                <Button  
                    title="Go to Next Screen"  
                    onPress={() => this.props.navigation.push('Second')}  
                />  
            </View>  
        );  
    }  
}  
class SecondScreen extends React.Component {  
    static navigationOptions = {  
        title: 'Second',  
        headerStyle: {  
            backgroundColor: '#f4511e',  
        },  
        headerTintColor: '#0ff',  
        headerTitleStyle: {  
            fontWeight: 'bold',  
        },  
    };  
    render() {  
        return (  
            <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>  
                <Text>Second Screen</Text>  
                
            </View>  
    );  
    }  
}  
  
const AppNavigator = createStackNavigator(  
    {  
        FirstFirstScreen,  
        SecondSecondScreen  
    },  
    {  
        initialRouteName: "First"  
    }  
);  
  
const AppContainer = createAppContainer(AppNavigator);  
export default class App extends React.Component {  
    render() {  
        return <AppContainer />;  
    }  
}  
_______________________________________________________________________________________
OUTPUT:




how to set header title in center in react native

First you need to import react-native-gesture-handler, stack navigator, navigation container. in Options you add title name, set headerTitleAlign to center. Then you add style for header using headerStyle set the background for header.

___________________________________________________________________________________

import React from 'react';
import {ViewTextStyleSheetfrom 'react-native';
import 'react-native-gesture-handler';
import {NavigationContainerfrom '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';

const MainStack = createStackNavigator();

const HomeScreen = props => {
  return (
    <View style={styles.screen}>
      <Text>Title Screen</Text>
    </View>
  );
};

function App() {
  return (
    <NavigationContainer>
      <MainStack.Navigator>
        <MainStack.Screen
          name="home"
          component={HomeScreen}
          options={{
            title: 'Title',
            
            // Center the header title on Android
            headerTitleAlign: 'center',
            headerStyle: {  
            backgroundColor: '#34FDC0',  
        },  
            
          }}
        />
      </MainStack.Navigator>
    </NavigationContainer>
  );
}

export default App;

/// Just some styles
const styles = StyleSheet.create({
  screen: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    
  },
});
_______________________________________________________________________________________




Friday, March 26, 2021

How To Improve React Native Performance

                         Improve Your React Native Performance In 2021

                                   

                     For a lot of people, Android is just a mobile operating system, just like they think for iOS. Being introduced to the world for the first time in 2008, Android has received constant updates pretty consistently, which is understandable, given the high levels of features and performance it brings for users.

However, the sheer size of the codebase is pretty difficult to maintain. This issue gets easily resolved with the help of React Native framework.

React Native- A Little Introduction

Originally a JavaScript framework, React Native enables the writing and native rendering of mobile apps for Android and iOS. Proper React Native app development has been on a constant rise since it was first introduced in 2015.

Apps on React Native are written by blending Javascript and XML, which is known as JSX. As a result, you get native apps that absolutely do not compromise the user experience as well. React Native also makes the lives of developers easy- allowing them to keep a single codebase.

As a framework too, React Native has elaborate documentation and a wide community which is a great step to start with.

How do React Native Apps Work?

There are three basic threads that govern the working of React Native apps-

The UI Thread

Also known as the Main Thread, it is responsible for taking care of the UI. It is responsible for every single thing a user sees and interacts with.

JavaScript Thread

It takes a different engine for React Native to execute the JavaScript code. This thread basically decides the pattern through which actions are taken on the UI.

Shadow Tree Thread

The Shadow Tree Thread calculates the defined layouts on the JavaScript and then transfers this information to the app’s native section to generate a view.

Tips to Improve React Native Performance

Here are some amazing tips with which you can improve the React Native performance this year-

1- Issues with Memory

For a large number of Android applications, memory leaks are a big pain during React Native app development, thanks to a number of unnecessary processes running in the background.

Solution

To take care of this memory leak issue in React Native apps, you can use the scrolling list options like flat list and section list among other listing options, which are a departure from the usual list view.

2- Size of Images

Wherever there are images, the overall memory usage heavily increases. Applications in React Native are no different, which makes image optimization a high on priority corrective measure.

Solution

React Native app developers can take the following steps to solve this problem-

Cache the images locally.Reducing the image sizes.
Using PNG image format in place of JPEG format.Convert the concerned images into WebP format.


3- Adding Maps

If a particular app is to make use of maps, a React Native app will face performance issues. However, this is not something that can be brought in check to bring better performance.

Solution

During the integration of the map feature, the following steps can help you out-

Disable auto-updating of geographical locations.

Eradicate console.log so that no extra data gets backed up in XCode.

4- Multiple Library Errors

‘FirebaseCore.h not found’.‘Firebase. h not found’. These are a couple of instances of errors that tend to pop up in React Native libraries. The main reason for such occurrences might be an improper installation of your library or it might have been corrupted.

Solution

The solution to library errors is pretty simple. You just need to install and link your library once again. However, it’s important to make sure that you do this process manually.

5- Failure to Find Modules

This is a pretty common problem, where a module gets misplaced at the time of creating a JavaScript file.

Solution

Common problems sometimes have common solutions, and this one is no different. All you need to do is make a change to the file path, substitute it with the correct path and you are good to go.