My Blog

My WordPress Blog

My Blog

My WordPress Blog

Components and APIs

Geolocation

In this chapter, we will show you how to use Geolocation. Step 1: App.js Step 2: Geolocation We will start by setting up the initial state for that will hold the initial and the last position. Now, we need to get current position of the device when a component is mounted using the navigator.geolocation.getCurrentPosition. We will stringify […]

Text

In this chapter, we will talk about Text component in React Native. This component can be nested and it can inherit properties from parent to child. This can be useful in many ways. We will show you example of capitalizing the first letter, styling words or parts of the text, etc. Step 1: Create File The file […]

Switch

In this chapter, we will explain the Switch component in a couple of steps. Step 1: Create File We will use the HomeContainer component for logic, but we need to create the presentational component. Let us now create a new file: SwitchExample.js. Step 2: Logic We are passing value from the state and functions for toggling switch items to SwitchExample component. Toggle functions will […]

Picker

In this chapter, we will create simple Picker with two available options. Step 1: Create File Here, the App.js folder will be used as a presentational component. App.js Step 2: Logic this.state.user is used for picker control. The updateUser function will be triggered when a user is picked. PickerExample.js Output If you click on the name it prompts you all […]

Modal

In this chapter, we will show you how to use the modal component in React Native. Let us now create a new file: ModalExample.js We will put logic inside ModalExample. We can update the initial state by running the toggleModal. After updating the initial state by running the toggleModal, we will set the visible property to our modal. This prop will […]

WebView

In this chapter, we will learn how to use WebView. It is used when you want to render web page to your mobile app inline. Using WebView The HomeContainer will be a container component. App.js Let us create a new file called WebViewExample.js inside the src/components/home folder. web_view_example.js The above program will generate the following output.

Scroll to top