React Native Dynamically Add Render View Component on Button Click in Android iOS App Example Using Animation

Views are the base of every react native application and without them we cannot make certain type of shapes and designs. View can be created programmatically at application run time on a certain event like button click. So in this tutorial we would going to Dynamically Add Render View Component on Button Click in Android iOS App Example Using Animation. We are using the Parent View as ScrollView and will render all the Views inside ScrollView. So let’s get started 🙂 .

See the live app example :

Contents in this project Dynamically Add Render View Component on Button Click in Android iOS App Example Using Animation:

1. Import StyleSheet, View, Text, Image, ScrollView, TouchableOpacity, Animated and Platform component in your project.

2. Create constructor() in your class and make 2 State named as ViewArray and Disable_Button and animatedValue object with default animation value of Zero with Array_Value_Index.

ViewArray : View array is our main array to make Views.

Disable_Button : This State will used to disable the Floating Button while animation is executing.

animatedValue : Used to set the default animated value as 0.

Array_Value_Index : This array will increase(+1) each time when user trying to add new View and the Value of this would store inside ViewArray.

3. Create a function named as Add_New_View_Function(), Inside this function we would first set the Animated value as 0 and we would save the Array_Value_Index inside a New_Added_View_Value variable. Now we would change the Button State and make the button disable and start the View adding animation and after done inserting View would would increase the Array_Value_Index value to +1 and make the button enable again.

4. Create a constant AnimationValue inside the render’s block and define the input and output range of translateY.

5. Now we would make Render_Animated_View and start printing View dynamically and stored them into this Render_Animated_View.

6. Create a Root View inside render’s return block and inside it would make a ScrollView component and inside the ScrollView we would render the Render_Animated_View variable, We would also make a floating action button using TouchableOpacity after ScrollView closed.

7. Creating Style.

8. Complete source code for App.js File :

Screenshot in Android device:

Dynamically Add Render View Component on Button Click

Screenshot in iOS device:


  1. how I can add button remove another view in scrollview?

  2. Hello how I can make this to happen after fetching data from server and load new rows with the fetched response?

    • Anu you want to add all the rows with animation while loading from server .

      • I’ve tried something in my case , after clicking the ‘plus’ button a popup will appear and there will be a field for submitting user input (fetching data from server , here I’m pasting a url , that will be sent to server by clicking ” Ok ” button and response I’m getting will be a json containing title of article ,author, image etc..)I want two functions to be performed when clicking on “Ok” button 1. Submit request 2. perform Add_New_View_Function .So I want the response from server to be displayed within Text.Can you please check my code.How do I show my code?

  3. Please say to me how remove another button add and click singal to singal swep {delete}

  4. Hello.
    Can you please tell me how to add dynamic views of different type based on a condition. Suppose we have A and B as choice . If we click A we will add a view and then if we click B we will add the view associated with B just after A and so on. Any help would be appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *