From the course: Learning React Native

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Native APIs

Native APIs

From the course: Learning React Native

Start my 1-month free trial

Native APIs

- [Narrator] An API is a set of classes or functions that gives developers access to an underlying operating system, service, or application. It's an acronym. It stands for Application Programmable Interface. In this case, the React Native API gives us access to underlying features of the phone. Currently, when the user presses a button, we are logging the button press string along with a timestamp to the console. Both iOS and Android have native UI for alerting the user. All I need to do is import the alert API, and instead of console logging this message, we can use the Alert.alert function. Now when we click our button, the message is displayed in a native iOS alert. There is also an API for dimensions. We can use this API to get the height and width of the current device. So I can destructure the height and the width from dimensions.get, and we want to get the dimensions of the current window. Notice that I have…

Contents