Skip to main content

Posts

Showing posts with the label react native

How react native application runs ?

 During development, you run your react native application using the development server provided by Metro Bundler. The development server serves the JavaScript bundle to the device or emulator. We have three phases in the whole process of running/bundling the application 1. Development server When you run "npx react-native start",  It start the "Metro Bundler" which serves the JavaScript bundle. 2. Bundling and Packaging When you run "npx react-native run-android" It make build of your react native application and install it in the device and emulator. 3. Code Execution As you make changes to your code and save it. Metro Bundler detect the changes and reload the app in the device or emulator automatically also  known as Hot Reloading. 4. Debugging You can debug your code using the react native debug tools like ReactDevTools or Flipper.  What is Metro Bundler? Metro Bundler is a JavaScript bundler that is primarily use in react native development. It serve...

Brain App Project Plan

 1st Phase of App development 1. Setup the Project 2. Setup the directory structure of the project. Make sure screens, components, api-services, styles, common-styles must be separate and well organized. assets folder structure assets/images // all images of the application assets/fonts // fonts using in the applicaton src folder structure Reuseable components src/components // reusables components need to be use in any component Authentication components src/screens/auth/login.js src/screens/auth/register.js src/screens/auth/reset_password.js src/screens/auth/verify_password.js src/screens/components/ // auth component specific components Dashboard components src/screens/dashboard/dashboard.js // show customer balance components src/screens/dashboard/components/customer_balance.js Package plans components Package categories src/screens/package_catgories/categories.js Package plans src/screens/package_plans/plans.js src/screens/package_plans/components/plan_details.js Subscriptions...

React native project setup guide

React Native is a kind of app in different kind of environment, which allows us to compile it in both ios and android platforms.  1. Install expo globally in your local machine. -npx i -g expo-cli 2. Install reacr-native project. It will start starting template of our app. It will install all the the depandencies we need to start or run our app. 3. Install DOM dependencies.   If you want to open react app in you browser than you really need to download these dependencies in your project. -npx expo install react-native-web@~0.18.10 react-dom@18.2.0 @expo/webpack-config@^18.0.1 4. For front-end styles we will use tailwind css. for that we will install ReactWind react native package. Go to the official ReactWind site https://www.nativewind.dev/quick-starts/expo a. Install tailwindcss pakcage -npm i react-wind b. Install tailwind dev dependencies -npm i --dev tailwindcss Now go to package.json file and check these dependencies are installed. c. Now we need to create tailwind confi...

11. SectionList in react native

 If you have nested array mean array have another array than you can display the data in section wise. SectionList provide many features like 1) Scroll Loading. 2) Pull to refresh the list. 3) Selection separator support. 4) ScrollView effect. Example code for SectioList. import { StyleSheet , SectionList , View , Text } from "react-native" ; const SelectionListExp = () => {     const students = [         {             id : 1 ,             name : 'Adnan Zaib' ,             data : [ 'PHP' , 'Laravel' , 'JS' ]         },         {             id : 2 ,             name : 'Aiza Adnan' ,             data : [ 'PHP' , 'Laravel' , 'HTML' , 'CSS' , 'JS' ]         },         {    ...

10. Use components or display components in loop using flat list in react native

 I this article we will discuss and cover two major points. 1) How to  use / display components in flatlist. 2) How to use props while using components in Flat list. Let say we have array of student data we can iterate over it using flat list .just the normal behaviour. But if i want to pass the single by single student data to StudentProfile component in flatlist. Here is the example code read and understand the logic.    import { FlatList , StyleSheet , Text , View } from "react-native" ;   const ComponentInFlatList = () => {     const students = [         {             id : 1 ,             name : 'Adnan' ,             email : 'exp@email.com'         },         {             id : 2 ,             name : 'Zaib' ,     ...