1569999374
This tutorial is the third part of our implementation of the Apple app of the day Animation in React native. Therefore, it is suggested to go through part one and two of this tutorial series in order to get the full insight into the app and make ourself comfortable with all the implementations. In the second part of this tutorial, we successfully implemented the enlarge-image animation when we click or press on any image. Here, we are going to add the text section to the enlarged pop-up animation and also close the animation.
The idea is to first complete the text section for the enlarged part and then implement the close animation of the enlarged image with content.
So, let us begin!
In the second part of the tutorial, we created two View
components. One with flex
value 2 and one with flex
value as 1. In the upper View
, we added the copied image which appears with enlarging animation when clicked. Now, we work on the second View
component in order to add the content section.
First, we need to define an animation
variable initialized to Animated
value as 0 as shown in the code snippet below:
constructor(props) {
super(props); ..... this.animation = new Animated.Value(0);
this.state = { activeImage: null, };
}
In this step, we are going to add some content to the second View
component by using the Text
component and then add some styles to the View
as well as the Text
component. Then, we need to change the normal View
component to the Animated View
component. The code and styles required to implement this are provided in the code snippet below:
<Animated.View style={{ flex: 1, backgroundColor: 'white', padding: 20, paddingTop: 50 }}>
<Text style={{ fontSize: 24, paddingBottom: 10 }}>Very Sure Developer</Text>
<Text>Eiusmod consectetur cupidatat dolor Lorem excepteur excepteur. Nostrud sint officia consectetur eu pariatur laboris est velit. Laborum non cupidatat qui ut sit dolore proident.</Text>
</Animated.View>
Hence, we get the following result on the emulator screen as we click on any image:
In this step, we are going to add the fade-in animation to the Text
section. The idea is make the text section appear from the bottom as fading in. In order to do this, we need to defined two animation styles which are opacity
and translateY
which will help to solve this animation effect. In order to configure animation, we are going to use interpolate
method initialized to animatedContentY
constant that takes an object with two properties: inputRange
and outputRange
as shown in the code snippet below:
const animatedContentY = this.animation.interpolate({
inputRange: [0, 1],
outputRange: [-150, 0]
})
To understand how the inputRange
and outputRange
work, let’s match the value from two properties as shown below:
Next, we also initialize the interpolate
method to animatedContentOpacity
constant for the opacity effect as shown in the code snippet below:
const animatedContentOpacity = this.animation.interpolate({
inputRange: [0, 0.5, 1],
outputRange: [0, 1, 1]
})
Here, we want to display 100% opacity when animation reaches 50% so that the inputRange
and outputRange
work like a charm.
Now, we need to finish this section by adding both of animatedContentY
and animatedContentOpacity
constant to animatedContentStyle
constant as an object. The animatedContentStyle
constant is defined as an object which takes two animation values which are opacity
and transform
. The opacity
is initialized to animatedContentOpacity
and transform
is initialized to an array of object with translateY value as animatedContentY
as shown in the code snippet below:
const animatedContentStyle = {
opacity: animatedContentOpacity,
transform: [
{
translateY: animatedContentY,
},
],
};
Now, we need to add the animatedContentStyle
constant to the style
prop array as shown in the code snippet below:
<Animated.View
style={[
{
flex: 1,
backgroundColor: 'white',
padding: 20,
paddingTop: 50,
},
animatedContentStyle,
]}>
<Text style={{fontSize: 24, paddingBottom: 10}}>
Very Sure Developer
</Text>
<Text>
Eiusmod consectetur cupidatat dolor Lorem excepteur excepteur.
Nostrud sint officia consectetur eu pariatur laboris est velit.
Laborum non cupidatat qui ut sit dolore proident.
</Text>
</Animated.View>
Lastly, we need to activate the animation in openImage
function that we defined in the previous part. The animation variable is provided as a parameter to timing
function of Animated
component with toValue
as 1 and duration
of 300ms as shown in the code snippet below:
Animated.parallel([
...........
Animated.timing(this.animation, {
toValue: 1,
duration: 300,
}),
]).start();
Hence, we get the following result in our emulator screen:
The last thing we need to add is the close animation to our pop-up enlarged image element. In order to do this, we need to define a new function named closeImage
. The closeImage
function is configured with all the Animated properties that are required to close the image element as shown in the code snippet below:
closeImage = () => {
Animated.parallel([
Animated.timing(this.position.x, {
toValue: this.oldPosition.x,
duration: 300
}),
Animated.timing(this.position.y, {
toValue: this.oldPosition.y,
duration: 250
}),
Animated.timing(this.dimensions.x, {
toValue: this.oldPosition.width,
duration: 250
}),
Animated.timing(this.dimensions.y, {
toValue: this.oldPosition.height,
duration: 250
}),
Animated.timing(this.animation, {
toValue: 0,
duration: 250
})
]).start(() => {
this.setState({
activeImage: null
})
})
}
The idea of the implementation of closeImage
function is to add the same animation properties from openImage
function that we defined in the last tutorial. And then, we rewind the animation positions to the original positions by using the value that we stored in the oldPosition
variable. Then, when the animation starts, we need to set the activeImage
state to null
.
Finally, we need to add the close button(X) to trigger the closeImage
function. In order to implement the close button, we put a letter “X” inside of Text
component wrapped by the Animated View
component. Then, we need to add the TouchableWithoutFeedback
component wrapping the Animated View
component in order to make the text clickable. Lastly, we add the closeImage
function to the onPress
event of the TouchableWithoutFeedback
component. Then, we need to bind those components with some styles to make it appear at the top right corner. The code and the styles required to implement the close button is provided in the code snippet below:
<TouchableWithoutFeedback onPress={() => this.closeImage()}>
<Animated.View style={{ position: 'absolute', top: 30, right: 30 }}>
<Text style={{ fontSize: 24, fontWeight: 'bold', color: 'white' }}>X</Text>
</Animated.View>
</TouchableWithoutFeedback>
Hence, we get the following result in our emulator screen:
Now, we test the same thing with other images as well and the result is shown in the emulator simulation below:
Hence, we have successfully added the text section as well as implemented the close animation in our React Native app.
This tutorial is a third of part of our implementation of the Apple app of the day example on React Native. In this part of the tutorial, we learned how to add text and configure different animation properties. We also learned how to bind different styles to the components. Then, we finally implemented the close animation to our pop-up enlarged image element from the previous tutorial.
I am very grateful to Nathavarun from UnsureProgrammer for this great and interesting tutorial.
If you like this tutorial please leave feedback on the comment section and do not forget to share!
The content is acquired from the #3 Apple App of the day Animation by Unsureprogrammer.
And the image is acquired from Unsplash.
This post includes affiliate links; I may receive compensation if you purchase
products or services from the different links provided in this article.
The post React native Apple App of the day Animation #3 : Close animation appeared first on Kriss.
#react-native
1598839687
If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?
In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.
Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.
React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.
Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.
Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.
The popularity of React Native comes from its advantages. Some of its advantages are as follows:
Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.
React Native is very close to native. Consider the following aspects as described on the React Native website:
Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.
#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native
1621573085
Expand your user base by using react-native apps developed by our expert team for various platforms like Android, Android TV, iOS, macOS, tvOS, the Web, Windows, and UWP.
We help businesses to scale up the process and achieve greater performance by providing the best react native app development services. Our skilled and experienced team’s apps have delivered all the expected results for our clients across the world.
To achieve growth for your business, hire react native app developers in India. You can count on us for all the technical services and support.
#react native app development company india #react native app developers india #hire react native developers india #react native app development company #react native app developers #hire react native developers
1625050361
React Native is the most popular dynamic framework that provides the opportunity for Android & iOS users to download and use your product. Finding a good React Native development company is incredibly challenging. Use our list as your go-to resource for React Native app development Companies in USA.
List of Top-Rated React Native Mobile App Development Companies in USA:
A Brief about the company details mentioned below:
1. AppClues Infotech
As a React Native Mobile App Development Company in USA, AppClues Infotech offers user-centered mobile app development for iOS & Android. Since their founding in 2014, their React Native developers create beautiful mobile apps.
They have a robust react native app development team that has high knowledge and excellent strength of developing any type of mobile app. They have successfully delivered 450+ mobile apps as per client requirements and functionalities.
Website: https://www.appcluesinfotech.com/
2. WebClues Infotech
WebClues Infotech is the Top-Notch React Native mobile app development company in USA & offering exceptional service worldwide. Since their founding in 2014, they have completed 950+ web & mobile apps projects on time.
They have the best team of developers who has an excellent knowledge of developing the most secure, robust & Powerful React Native Mobile Apps. From start-ups to enterprise organizations, WebClues Infotech provides top-notch React Native App solutions that meet the needs of their clients.
Website: https://www.webcluesinfotech.com/
3. AppClues Studio
AppClues Studio is one of the top React Native mobile app development company in USA and offers the best service worldwide at an affordable price. They have a robust & comprehensive team of React Native App developers who has high strength & extensive knowledge of developing any type of mobile apps.
Website: https://www.appcluesstudio.com/
4. WebClues Global
WebClues Global is one of the best React Native Mobile App Development Company in USA. They provide low-cost & fast React Native Development Services and their React Native App Developers have a high capability of serving projects on more than one platform.
Since their founding in 2014, they have successfully delivered 721+ mobile app projects accurately. They offer versatile React Native App development technology solutions to their clients at an affordable price.
Website: https://www.webcluesglobal.com/
5. Data EximIT
Hire expert React Native app developer from top React Native app development company in USA. Data EximIT is providing high-quality and innovative React Native application development services and support for your next projects. The company has been in the market for more than 8 years and has already gained the trust of 553+ clients and completed 1250+ projects around the globe.
They have a large pool of React Native App developers who can create scalable, full-fledged, and appealing mobile apps to meet the highest industry standards.
Website: https://www.dataeximit.com/
6. Apptunix
Apptunix is the best React Native App Development Company in the USA. It was established in 2013 and vast experience in developing React Native apps. After developing various successful React Native Mobile Apps, the company believes that this technology helps them incorporate advanced features in mobile apps without influencing the user experience.
Website: https://www.apptunix.com/
7. BHW Group
BHW Group is a Top-Notch React Native Mobile App Development Company in the USA. The company has 13+ years of experience in providing qualitative app development services to clients worldwide. They have a compressive pool of React Native App developers who can create scalable, full-fledged, and creative mobile apps to meet the highest industry standards.
Website: https://thebhwgroup.com/
8. Willow Tree:
Willow Tree is the Top-Notch React Native Mobile App Development Company in the USA & offering exceptional React Native service. They have the best team of developers who has an excellent knowledge of developing the most secure, robust & Powerful React Native Mobile Apps. From start-ups to enterprise organizations, Willow Tree has top-notch React Native App solutions that meet the needs of their clients.
Website: https://willowtreeapps.com/
9. MindGrub
MindGrub is a leading React Native Mobile App Development Company in the USA. Along with React Native, the company also works on other emerging technologies like robotics, augmented & virtual reality. The Company has excellent strength and the best developers team for any type of React Native mobile apps. They offer versatile React Native App development technology solutions to their clients.
Website: https://www.mindgrub.com/
10. Prismetric
Prismetric is the premium React Native Mobile App Development Company in the USA. They provide fast React Native Development Services and their React Native App Developers have a high capability of serving projects on various platforms. They focus on developing customized solutions for specific business requirements. Being a popular name in the React Native development market, Prismetric has accumulated a specialty in offering these services.
Website: https://www.prismetric.com/
#top rated react native app development companies in usa #top 10 react native app development companies in usa #top react native app development companies in usa #react native app development technologies #react native app development #hire top react native app developers in usa
1617268431
Do you want to hire talented & highly skilled React Native mobile app developers in USA? AppClues Infotech has the best team of dedicated React Native App designers & developers that provide the complete React Native solution & listed the top-notch USA-based companies list for your kind information.
For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910
#hire best react native app developers in usa #hire react native mobile app developers #top react native development companies #top react native app development company in usa #best react native app development services provider company #custom react native app development company
1616140045
AppClues Infotech is a premier & leading React Native app Development Company in USA having highly skilled React Native app developers offering robust services with the latest technology & functionalities.
For more info:
Website: https://www.appcluesinfotech.com/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910
#react native app development company #top react native app development company in usa #best react native app development services usa #react native mobile development #react native mobile development #top react native app development companies usa