Unit II
Unit II
Native apps can often work offline or in areas with poor internet connectivity
by storing data locally. This feature is particularly useful for certain types of
apps like productivity tools or games.
Native apps can be distributed through app stores like Google Play Store and
Apple App Store. This makes them easily discoverable to a broad user base and
allows for seamless updates and app management.
6. Security:
Native apps have the advantage of following the security guidelines of the
platform they are built for, reducing the risk of security vulnerabilities.
7. Better Integration:
Native apps can be integrated more effectively with other apps on the
device, allowing for a more cohesive user experience when switching
between applications.
8. Performance Analytics:
App stores and developer tools provide detailed analytics on how users
interact with native apps. This data can help developers make data-driven
decisions to improve app performance and user engagement.
Application Verify for the 4. Enter the details 4. All the details
installed on the launching and sign first name, last should remain on
device. up name, email id, and the page.
mobile number. 5. A notification
5. Click on submit appears “Please
button. check your mail
and verify the
account”.
Mail should trigger
with the
verification code.
Dr. Y. AROCKIA RAJ, AP/CSE, PSNA CET. 22
Scenarios to create Native App
Difference Between Test Cases and Test Scenarios?
It is the process to validate the Test It is the process to test the complete
Scenario. functionality of the application.
1. React Native:
◦ Developed by Facebook, React Native is a widely
used crossplatform framework that allows
developers to build native apps using JavaScript
and React.
◦ It offers a vast community and extensive third-
party libraries, enabling code sharing between
iOS and Android platforms.
2. Flutter:
◦ Developed by Google, Flutter is another popular
cross-platform framework that uses the Dart
programming language.
◦ It allows developers to create native apps with a
single codebase for iOS, Android, and other
platforms, offering a rich set of widgets and high-
performance rendering.
3. Xamarin:
◦ Owned by Microsoft, Xamarin is a cross-
platform framework that enables developers to
build native apps for Android, iOS, and Windows
using C# and .NET.
◦ It provides access to platform-specific APIs and
features and allows code sharing among different
platforms.
4. NativeScript:
◦ NativeScript is an open-source framework that
enables developers to build native apps using
JavaScript, TypeScript, or Angular.
◦ It provides direct access to native APIs, enabling
the creation of high-performance apps.
6. Ionic:
◦ Ionic is a popular open-source framework for
building hybrid apps using web technologies like
HTML, CSS, and JavaScript.
◦ While not fully native, it uses WebView to run
inside a native container, allowing for cross-
platform compatibility.
Primitive Type Primitive types in Java are not Primitive types are objects.
objects.
Widening Conversion Java supports the implicit Kotlin does not support
conversion so we can the implicit conversion. So,
convert a smaller type to we cannot convert the
a bigger one. smaller type to a bigger
one.
Code Comparison The line of code is just It reduces the line of code
doubled than Kotlin. to half.
Null Values We can assign null values to We cannot assign null values
variables but cannot assign to any variable and objects.
null values to an object.
Data Classes If we need a class that can If we want to do the same in Kotlin,
hold data only, for this we we declare the class with the
need to define getter, and keyword Data. Rest the work such
setter methods, constructors, as creating constructor, getter, and
and other functions. setter methods for the fields are
done by the compiler.
Hot Reloading: Making a few changes in the code of your app will
be immediately visible during development. If business logic is
changed, its reflection is live reloaded on screen.
Improving with Time: Some features of iOS and Android are still
not supported, and the community is always inventing the best
practices.
Disadvantages:
Native Components: We will need to write some platform
specific code if we want to create native functionality which is not
designed yet.
Existence is Uncertain: As the Facebook develop this framework,
its presence is uncertain since it keeps all the rights to kill off the
project anytime. As the popularity of React Native rises, it is unlikely
to happen.
Difference between React and React Native
React Fundamentals
React Native runs on React, a popular open source
library for building user interfaces with JavaScript.
To make the most of React Native, it helps to
understand React itself.
We’re going to cover the core concepts behind React:
components
JSX
props
state
Components of React Native
React Native Components
React Native provides a set of built-in components
like View, Text, Image, Scroll View, etc., which are
similar to the ones in React for the web. For
example,
Components of React Native
Custom Components
You can render this
component multiple times and
in multiple places without
repeating your code by using
<Cat>:
Any component that renders
other components is a parent
component.
Here, Cafe is the parent
component and each Cat is a
child component.
Components of React Native
https://reactnative.dev/docs/components-and-apis
Native Components
Image: is similar to <img> HTML tag.
ImageBackground: sets the image as background to all the child
components.
KeyboardAvoidingView: will adjust the component on the screen
when keyboard pops in.
Modal: is a popup screen with a message or requesting some action on
button.
RefreshControls: refreshes the screen when drag down the section
list.
SafeAreaView: Avoids the camera notch, rounded corners etc.
StatusBar: Controls status bar like matching the theme.
Native Components
TouchableHighlight: Highlights the area on touch (increase
brightness)
TouchableOpacity: Make the area transparent slowly
(decrease brightness)
Pressable: Highly recommended which gives onPress in, out,
long, hoverin, out.
Button: normal button.
Basic Hooks
useState
useEffect
useContext
Other hooks…
useReducer
useRef
useMemo
useCallback
https://react.dev/reference/react/hooks
Components of React Native
Style
React Native uses JavaScript for styling the application.
All core components use a prop named “style.”
The style names and values are similar to CSS that works
for the web.
To style our components, we can either use inline styling
or use Style Sheet, which is a React Native component.
getDerivedStateFromProps(): {
console.log('getDerivedStateFromProps called.');
}
componentDidMount() {
console.log('componentDidMount called.');
}
componentDidCatch(error, info) {
console.log('componentDidCatch called.');
}